Checkout Service
The Checkout API is responsible for validating the data necessary for charging the shopper for their shopping trip and gathering receipt data. The checkout step occurs right after Amazon calls into your Ordering Connector to pass you all of the cart information for a shopping trip.
After Amazon calls your Ordering Connector API and provides you with all the cart information for a shopping trip, you will need to provide Amazon with the following information:
- The Total Cost for the shopping trip
- The Total of All Promotions in the shopping cart
- The Total of All Sales Tax in the shopping cart
- The shelf price of all line items before you have calculated any taxes, fees, or promotions
Note: All decimal values must be rounded to 2 places otherwise an error will be returned for invalid API payload
Amazon will validate this data and send it to the payment processor to charge the shopper’s account. We will charge the credit card the shopper used to enter your JWO-enabled store. Amazon also uses this information to generate the shopper’s receipt.
Note: In the future, new attributes might be added. We recommend that you structure your code so that it can handle new attributes gracefully
CheckoutCart
POST /v1/checkout/carts
You will use Amazon’s /v1/checkout/carts endpoint to tell Amazon you’re ready to charge the shopper and generate their receipt for the corresponding shopping trip.
Body parameter
{
"idempotentShoppingTripId": "string",
"storeId": "string",
"lineItems": [
{
"productId": "string",
"type": "SKU",
"quantity": {
"value": "string",
"unit": "string"
},
"unitPrice": {
"totalPrice": {
"amount": "string",
"currencyCode": "USD"
},
"price": {
"amount": "string",
"currencyCode": "USDUSD"
},
"depositsAndFees": [
{
"depositAndFeeAmount": {
"amount": "string",
"currencyCode": "USD"
},
"depositAndFeeDescription": "string",
"salesTax": {
"amount": "string",
"currencyCode": "USD"
}
}
],
"salesTax": {
"amount": "string",
"currencyCode": "USD"
},
"promotions": [
{
"promotionAmount": {
"amount": "string",
"currencyCode": "USD"
},
"promotionDescription": "string"
}
]
}
}
],
"orderTotals": {
"priceTotal": {
"amount": "string",
"currencyCode": "USD"
},
"subTotal": {
"amount": "string",
"currencyCode": "USD"
},
"promotionsTotal": {
"amount": "string",
"currencyCode": "USD"
},
"salesTaxTotal": {
"amount": "string",
"currencyCode": "USD"
}
}
}
Note: Below is a description of the API schema values:
lineItems
- lineItems.unitPrice.totalPrice.price : Value from the POS for the item
- lineItems.unitPrice.totalPrice.SalesTax: tax amount for the item per 1 unit
- lineItems.promotions.promotionAmount: promotion amount for the item per 1 unit
- lineItems.promotions.promotionDescription: description for the promo applied
- lineItems.unitPrice.totalPrice: Is the price calculated as:
- lineItems.unitPrice.totalPrice.price minus lineItems.promotions.promotionAmount + lineItems.unitPrice.totalPrice.SalesTax
Example is an item with price 2.30 would and a 10% discount and 6% tax would result in a JSON like this
[
{
"productId": "jwo-sample product",
"type": "SKU",
"quantity": {
"value": "3.0",
"unit": "unit"
},
"unitPrice": {
"totalPrice": {
"amount": "2.23",
"currencyCode": "USD"
},
"price": {
"amount": "2.30",
"currencyCode": "USD"
},
"depositsAndFees": [],
"salesTax": {
"amount": "0.13",
"currencyCode": "USD"
},
"promotions": [
{
"promotionAmount": {
"amount": "0.2",
"currencyCode": "USD"
},
"promotionDescription": "Sample Discount"
}
]
}
}
]
priceTotal
- priceTotal.subTotal: is the price of the item from POS multiplied by the quantity for the items in the cart. If you have multiple items in the cart then this will for all items in the cart
- priceTotal.promotionsTotal: total promotional amount in the cart
- priceTotal.salesTaxTotal: total sales amount in the cart
- orderTotals.priceTotal : Is priceTotal.subTotal minus priceTotal.promotionsTotal + priceTotal.salesTaxTotal
For the sample above the payload for the total will be like this
"orderTotals": {
"priceTotal": {
"amount": "6.69",
"currencyCode": "USD"
},
"subTotal": {
"amount": "6.90",
"currencyCode": "USD"
},
"promotionsTotal": {
"amount": "0.6",
"currencyCode": "USD"
},
"salesTaxTotal": {
"amount": "0.39",
"currencyCode": "USD"
}
}
}
Data Field | Required | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
idempotentShoppingTripId | Required | string, The idempotentShoppingTripId field contains a UUID string that Amazon generates to identify each shopping trip uniquely. The API uses this UUID to ensure that the service correctly handles multiple calls to the API using the same information with no unintended side effects | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
storeId | Required | string <= 255 characters, The storeId field contains the store identifier that Amazon assigned to you during your onboarding process. If you have multiple stores, each store will have a unique identifier. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lineItems | Required | Array of objects (LineItem) non-empty. The lineItems field contains a list of JSON objects that define each item in the shopper’s cart. This JSON object includes the following top-level fields:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
orderTotals | Required | object (OrderTotal). The orderTotals field contains a JSON object that holds the following fields:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Success example responses
> 201 Response{
"orderId": "string"
}
Value | Description |
---|---|
orderId | string <= 255 characters. If your request to Amazon’s Checkout API is successful, you will receive a 201 HTTP Status Code and a JSON object containing the orderId. For your request to be successful, your request to Amazon’s Checkout API will need to pass the following validations:
|
Failure example responses
{
"errorMsg": "string"
}
Status | Meaning | Description |
---|---|---|
400 | UnknownShoppingTripException | You will receive a 400 UnknownShoppingTrip if you attempt to checkout using an invalid shoppingTrip |
400 | InvalidRequestException | The API Gateway will return a 4xx level error when requests to the Checkout API contain invalid data |
400 | CartContentValidationFailedException | You will receive a 4xx CartContentValidationFailedException if you attempt to submit an empty cart to Amazon’s Checkout API. You will also get this error if the contents of the cart you submit do not match the contents of the cart Amazon sent to you when the shopper checked out |
400 | CartOrderTotalInvalidException | Amazon will return a 400 CartOrderTotalInvalidException if any of the items do not have a price. |
400 | ShoppingTripExpiredException | A ShoppingTripExpiredException will be triggered when attempting to process a cart that has surpassed its maximum return window. While this timeframe can differ depending on your payment processor, it typically expires 46 hours after the shopping trip's initial start time. After this period, the payment can no longer be processed. |
403 | AuthenticationException | Amazon will return a 403 AuthenticationException if the API call fails due to authorization. For example the IAM role used to call the API has not been authorized by the Amazon service |
500 | InternalServerException | Amazon expects a 500 InternalServerException when the checkout call fails due to a server issue.For example an un-handled exception or error occurs when processing the Amazon API call |