When a shopper enters a shipping address during checkout, Oracle Commerce Cloud Service sends a request to the carrier service’s endpoint specified by the URL you entered when you configured the webhook. The request includes shopping cart and shipping address data.
{ "request": { "orderDiscount": 10, "rawOrderTotal": 50, "orderTotal": 40, "currencyCode": "USD", "items": [ { "product": { "id": "Product_15CD", "shippingSurcharge": 2.67, "height": "1m", "weight": "2Lbs", "width": "2m", "length": "3m", "taxCode": null }, "amount": 10.99, "rawTotalPrice": 12.99, "quantity": 2, "catalogRefId": "Test0", "discount": 2 }, . . . ], "address": { "lastName": "Anderson", "postalCode": "13202", "state": "New York", "address1": "21 Cedar Ave", "address2": null, "firstName": "James", "country": "US" }, "locale": { "language": "en", "displayName": "English (United States)", "country": "US" }, "priceListGroup": null }
The shipping service responds with available shipping methods and their associated costs. The following sample shows a response with two available shipping methods:
{ "shippingMethods": [ { "shippingCost": 12.95, "shippingTax": 2.00, "shippingTotal": 14.95, "internationalDutiesTaxesFees": 0, "eligibleForProductWithSurcharges": true, "deliveryDays": 2, "estimatedDeliveryDateGuaranteed": false, "estimatedDeliveryDate": "2013-04-12 14:48:45 -0400", "displayName": "canadapost-overnight", "carrierId": "ON", "taxcode": "GT987", "currency": "USD" }, { "shippingCost": 29.00, "shippingTax": 4.00, "shippingTotal": 33.00, "internationalDutiesTaxesFees": 0, "deliveryDays": 2, "estimatedDeliveryDateGuaranteed": false, "estimatedDeliveryDate": "2013-04-12 14:48:45 -0400", "displayName": "fedex-2dayground", "carrierId": "1D", "taxcode": "TD543", "currency": "USD" } ] }
If no shipping methods are available based on the shopper’s address, the response returns an error. The following sample shows an error response that might be returned for a shipping address whose country is not supported by the shipping method’s shipping regions.
{ "error": { "code":"TA457", "message":"Unsupported Country" } }