Order Callback - Building The Response


The response you return from your order callback handler should include an order number, details about the order which was placed (if any) and / or error details about subscription items which failed to be ordered. The HTTP status should indicate the result.

Success Response - HTTP Status 201


Return a response similar to the following when all subscription items were handled successfully and an eCommerce order was successfully placed. See here for detailed documentation of the order details schema.

{
  "orderNumber": "ABC-091293923",
  "orderDetails": {
    "customerId": "1234",
    "customerEmail": "[email protected]",
    "platformCustomerId": "1234",
    "platformOrderId": "091293923",
    "orderNumber": "ABC-091293923",
    "salesOrderToken": "89adsfjkl129834kljsad98fuoi123uj489u23894",
    "orderStatus": "placed",
    "orderState": "open",
    "orderDateTime": "2021-04-01T17:43:00Z",
    "currency": "USD",
    "shippingTotal": "7.2000",
    "taxTotal": "4.0000",
    "total": "51.2000",
    "billingAddress": {
      "firstName": "Jane",
      "lastName": "Doe",
      ...
    },
    "shippingAddress": {
      "firstName": "Jane",
      "lastName": "Doe",
      ...
    },
    "items": [
      {
        "platformOrderItemId": "735641231234",
        "productSku": "RUBY-RED",
        "productName": "Ruby Red Black Tea",
        "shortDescription": "Ruby Red Black Tea - 2 oz.",
        "qty": "4",
        "requiresShipping": true,
        "unitPrice": "10.0000",
        "shippingTotal": "7.2000",
        "taxTotal": "4.0000",
        "lineTotal": "51.2000",
        "subscriptionId": "413245234",
      }
    ]
  },
  "errorItems": []
}

Partial Success Response - HTTP Status 201


Return a response similar to the following when some subscription items were handled successfully, some items failed and an eCommerce order was successfully placed. See here for detailed documentation of the order details schema.

{
  "orderNumber": "ABC-091293923",
  "orderDetails": {
    "customerId": "1234",
    "customerEmail": "[email protected]",
    "platformCustomerId": "1234",
    "platformOrderId": "091293923",
    "orderNumber": "ABC-091293923",
    "salesOrderToken": "89adsfjkl129834kljsad98fuoi123uj489u23894",
    "orderStatus": "placed",
    "orderState": "open",
    "orderDateTime": "2021-04-01T17:43:00Z",
    "currency": "USD",
    "shippingTotal": "7.2000",
    "taxTotal": "4.0000",
    "total": "51.2000",
    "billingAddress": {
      "firstName": "Jane",
      "lastName": "Doe",
      ...
    },
    "shippingAddress": {
      "firstName": "Jane",
      "lastName": "Doe",
      ...
    },
    "items": [
      {
        "platformOrderItemId": "735641231234",
        "productSku": "RUBY-RED",
        "productName": "Ruby Red Black Tea",
        "shortDescription": "Ruby Red Black Tea - 2 oz.",
        "qty": "4",
        "requiresShipping": true,
        "unitPrice": "10.0000",
        "shippingTotal": "7.2000",
        "taxTotal": "4.0000",
        "lineTotal": "51.2000",
        "subscriptionId": "413245234",
      }
    ]
  },
  "errorItems": [
      {
        "subscriptionId": "62343421",
        "errorMessage": "Product out of stock"
      }
  ]
}

All Items Failed Response - HTTP Status 409


Return a response similar to the following when all subscription items failed and no order was placed.

{
  "orderNumber": null,
  "orderDetails": null,
  "errorItems": [
      {
        "subscriptionId": "413245234",
        "errorMessage": "Invalid product SKU"
      },
      {
        "subscriptionId": "62343421",
        "errorMessage": "Product out of stock"
      }
  ]
}