GetOrderItem

SmithCart > Integration > REST Endpoints
Usage
Retrieve an order purchased item by ID
Basic URI
/orders/{oid}/items/{oiid}.json
Parameters
int oid                The order ID
int oiid               The order item ID
HTTP Example
https://domain.com/DesktopModules/Smith.BuyNow/Services/v1/Checkout.svc/orders/9/items/2.json
AUTH
Bearer JWT
 
C# Code
 
JavaScript Code
<script>
   (function ($) {
       var CLIENT_ID = "4SnPA6lqpY76ODEr",
           SERVICE_URI = "https://domain.com/DesktopModules/Smith.BuyNow/Services/v1/",
           ORDER_ID = "9",
           ITEM_ID = "2";

       function getOrderItem (endPoint, clientID, oID, oiID) {
           var jwt = sessionStorage.getItem("jwt");
           if (!jwt) {
               var uri = endPoint + "Authorize.ashx?"
                   + "response_type=token"
                   + "&client_id=" + clientID
                   + "&redirect_uri=" + encodeURIComponent(window.location)
                   + "&scope=" + encodeURIComponent("orders create edit delete");
               window.location = uri;
               return;
           }

           $.ajax({
               type: "GET",
               url: endPoint + "/Checkout.svc/orders/" + oID + "/items/" + oiID + ".json",
               headers: { "Authorization": "Bearer " + jwt },
               contentType: "application/json; charset=utf-8",
               dataType: "json"
           }).fail(function (jqXHR, textStatus) {
               console.log("SmithCart API: " + textStatus);
           });
       }

       $(function () {
           var params = {},
               queryString = location.hash.substring(1),
               regex = /([^&=]+)=([^&]*)/g,
               m;

           while (m = regex.exec(queryString)) {
               params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
           }
           if (params["access_token"]) {
               sessionStorage.setItem("jwt", params["access_token"]);
           }

           getOrderItem (SERVICE_URI, CLIENT_ID, ORDER_ID, ITEM_ID);
       });
   })(jQuery);
</script>
 
 
 
Response
[
    "id": 2,
    "order_id": 9,
    "sku": "SCTest1",
    "title": "Smith Test Product #1",
    "unit_price": 10.00,
    "sale_price": null,
    "tax_rate": 0,
    "qty": 2,
    "units": null,
    "total": 20.00,
    "subtotal": 20.00,
    "tax_total": 0.00,
    "fee_total": 0.00,
    "shipping_total": 0.00,
    "discount_total": 0.00,
    "status": null,
    "portal_id": 0
]