Building an Order Service JSON Object

This topic provides an example JSON object that you can use as a reference while you construct yours.

When you implement Order Service using the JSON Object implementation, you will need to do the following to build the JSON Object:
  • Create a JSON Object that represents the commerce code on your site.
  • Add this object to your site so that it appears on every page you have a cart.
  • Use the settings on the commerce page to map your JSON object fields so Bronto can collect data appropriately.

The following is a code example you can use to build your object. As you construct your object, remove any fields in the example you do not want to collect and modify the example values (ORDER_COMPLETE, USD, etc.) to values on your site.

Some things to keep in mind as you construct your object:
  • The JSON Object can contain a <cartPhase> element representing current stage of checkout. Phases include:SHOPPING, BILLING, SHIPPING_INFO, SHIPPING_INFO, ORDER_REVIEW, PAYMENT, and ORDER_COMPLETE. The ORDER_COMPLETE cart phase is required to complete your order. If the cart phase is not set, it will default to SHOPPING.
  • If mapped, taxAmount should have either 2 or 4 decimals places.
  • grandTotal and orderId are required for ORDER_COMPLETE.
  • Only provide emailAddress if you providing a corresponding value or data can be incorrectly attributed to contacts.
  • Make sure you pass the full URL for imageUrl.
<script type="text/javascript">
    brontoCart ={
        "cartPhase": "ORDER_COMPLETE",
        "currency": "USD",
        "subtotal": 35.98,
        "discountAmount": 0,
        "taxAmount": 0,
        "grandTotal": 35.98,
        "orderId": "123ABC",
        "emailAddress": "",
        "cartUrl": "",
        "shippingAmount": 7.99,
        "shippingDate": "05 - 18 - 2018",
        "shippingDetails": "FedEx",
        "shippingTrackingUrl": "",
        "lineItems": [{
                "sku": "576879",
                "name": "Shirt",
                "description": "A super great description of the product",
                "category": "Shirts > T-Shirts > Blue",
                "other": "This can be any string value you like",
                "unitPrice": 11.99,
                "salePrice": 11.99,
                "quantity": 2,
                "totalPrice": 23.98,
                "imageUrl": "",
                "productUrl": ""
                 "sku": "1112296",
                 "name": "Fleece Jacket",
                 "description": "A well appointed Fleece jacket",
                 "category": "Jackets > Winter > Fleece",
                 "other": "This can be any string value you like",
                 "unitPrice": 65.99,
                 "salePrice": 55.50,
                 "quantity": 1,
                 "totalPrice": 55.50,
                 "imageUrl": "",
                 "productUrl": ""     

After you construct your object, add it to your site. The JSON Object should:
  • Be located in the Footer if presented in DOM.
  • Load first, followed by the Bronto Embed Code.
  • Appear on all pages once the first item is added to cart.