OrderTransactionsFindForOrder Endpoint

Overview

When working with an order, it might be convenient to list or parse the transactions it has to display them or update other systems with them.  This endpoint allows you to find all of the transactions in your store that are applied to an order.

Requirements

The following pre-requisites will be necessary to accomplish the goals of this article:

  • General understanding of REST and API’s
  • Understanding of C# and/or JavaScript
  • Visual Studio 2012 or newer

Getting Started

You should already have a project open and ready to accept code to allow you to use this REST API endpoint.  You should also have one or more orders and transactions created so that you can successfully find some transactions based upon the order.

OrderTransactionsFindForOrder

This REST API endpoint allows you to find all transactions in your store that have been applied to a specific order. 

Example URL

This is what the REST endpoint will look like if you are calling it using JavaScript.  See our REST API URL documentation for more information.

http://example.com/DesktopModules/Hotcakes/API/rest/v1/ordertransactions?key=[YOURKEY]&orderbvin=[BVIN]

BVIN is the ID (bvin) of the orderas described in the parameters below.

HTTP Method

GET

Parameters

Parameter Description
orderbvin This is the unique ID or bvin of the order that you wish to find transactions for.

Returns

If successful, this endpoint will return a populated list of OrderTransactionDTO object in JSON format.  Otherwise, you should have one or more errors returned.  

Example Code

The following code will allow you to successfully call this endpoint, provided that you have enabled it.

Project References

  • Hotcakes.CommerceDTO

Import Namespaces

  • Hotcakes.CommerceDTO.v1
  • Hotcakes.CommerceDTO.v1.Client
  • Hotcakes.CommerceDTO.v1.Orders

 

string url = "http://example.com";
string key = "YOUR-API-KEY";

Api proxy = new Api(url, key);

// specify the order ID to find transactions for
var orderId = "c0ee144f-045e-4928-8258-7ac7c7e84030";

// call the API to find the transactions
ApiResponse<List<OrderTransactionDTO>> response = proxy.OrderTransactionsFindForOrder(orderId);
// your domain name
var url = "http://example.com"; 
// the path where the API is
var apiPath = "/DesktopModules/Hotcakes/API/rest/v1/";  
// endpoint as shown in the documentation
var endPoint = "ordertransactions";  
// get this from the store admin
var apiKey = "YOUR-API-KEY";

$(document).ready(function() {

    // specify the order ID to find transactions for
    var orderId = "c0ee144f-045e-4928-8258-7ac7c7e84030";

    // call the API to find the transactions
    $.ajax({
        dataType: "json",
        url: url + apiPath + endPoint + "?key=" + apiKey + "&orderbvin=" + orderId,
        type: 'GET',
        success: function (data) {
            // do something
        },
        error: function (jqXHR, textStatus) {
           // do something else
        }
    });

});
{
   "Errors":[

   ],
   "Content":[
      {
         "Id":"df4be34c-c56e-4269-9650-b691db930575",
         "StoreId":1,
         "OrderId":"c0ee144f-045e-4928-8258-7ac7c7e84030",
         "OrderNumber":"",
         "TimeStampUtc":"\/Date(1406777428437)\/",
         "Action":401,
         "Amount":59.8700000000,
         "CreditCard":{
            "CardNumber":"",
            "CardIsEncrypted":false,
            "ExpirationMonth":1,
            "ExpirationYear":2014,
            "CardHolderName":""
         },
         "Success":true,
         "Voided":false,
         "RefNum1":"",
         "RefNum2":"",
         "LinkedToTransaction":"",
         "Messages":"",
         "CheckNumber":"",
         "PurchaseOrderNumber":"Z1MIO2P2",
         "GiftCardNumber":"",
         "CompanyAccountNumber":""
      },
      {
         "Id":"9352c330-160e-43eb-a754-44d0ba846d04",
         "StoreId":1,
         "OrderId":"c0ee144f-045e-4928-8258-7ac7c7e84030",
         "OrderNumber":"5",
         "TimeStampUtc":"\/Date(1406777691233)\/",
         "Action":401,
         "Amount":0.0000000000,
         "CreditCard":{
            "CardNumber":"",
            "CardIsEncrypted":false,
            "ExpirationMonth":1,
            "ExpirationYear":2000,
            "CardHolderName":""
         },
         "Success":false,
         "Voided":false,
         "RefNum1":"ACB123XYZ",
         "RefNum2":"",
         "LinkedToTransaction":"DF4BE34C-C56E-4269-9650-B691DB930575",
         "Messages":"PO authorization system not available",
         "CheckNumber":"",
         "PurchaseOrderNumber":"12345",
         "GiftCardNumber":"",
         "CompanyAccountNumber":""
      },
      {
         "Id":"bfb52845-8db7-4336-9635-2574ef7a78da",
         "StoreId":1,
         "OrderId":"c0ee144f-045e-4928-8258-7ac7c7e84030",
         "OrderNumber":"5",
         "TimeStampUtc":"\/Date(1406783945887)\/",
         "Action":402,
         "Amount":59.8700000000,
         "CreditCard":{
            "CardNumber":"",
            "CardIsEncrypted":false,
            "ExpirationMonth":1,
            "ExpirationYear":2000,
            "CardHolderName":""
         },
         "Success":true,
         "Voided":false,
         "RefNum1":"ACB123XYZ",
         "RefNum2":"",
         "LinkedToTransaction":"DF4BE34C-C56E-4269-9650-B691DB930575",
         "Messages":"Successfull accepted the PO for this transaction",
         "CheckNumber":"",
         "PurchaseOrderNumber":"12345",
         "GiftCardNumber":"",
         "CompanyAccountNumber":""
      }
   ]
}
Have more questions? Submit a request

Need More Help?

Do you need more assistance with this article? Please review your support options.