XM

Checkout 2.0 (legacy)

Path:

POST https://{baseurl}/api-order/checkout

This API supports checkout using credit card or Affirm Card through the popular payment gateway Authorize.net. This legacy API will be deprecated soon. Once the checkout is complete, the Delete Cart by ID API is triggered to ensure the cart is deleted. To checkout, the following APIs must be run sequentially:

  1. Add Items to Cart

  2. Create Shipping

  3. Add Shipping to Line Items

If you want to offer split payment and/or option to your customer, the Checkout-4.0 API is recommended.

Headers

Content-Type : application/json

x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

Parameters

Type: body

Name: The checkout details such as cart ID, customer contact information, payment details, and estimated taxes.

Required: true

Sample Request

Path:

POST https://{baseurl}/api-order/checkout

Checkout Request Sample - Card

{
"cartId": "60818e01f260880008cf4dfa",
"customerEmail": "[email protected]",
"customerPhoneNumber": {
"number": "07780811973",
"kind": "Mobile"
},
"paymentDetails": [
{
"transactionDetails": {
"paymentType": "CARD",
"cardNumber": "4111111111111111",
"expDate": "1122",
"cvv": "999",
"cardHolderFullName": "tawseefahmade bhat",
"metadata": {}
},
"paymentIdentifier": {
"cardIdentifier": "1111"
},
"paymentMethod": "Visa",
"paymentKind": "Fabric User",
"amount": "11.27",
"currency": "USD",
"conversion": 1,
"billToAddress": {
"name": {
"first": "tawseef",
"last": "ahmade bhat"
},
"email": "[email protected]",
"phone": {
"number": "07780811973",
"kind": "Mobile"
},
"street1": "600 CONGRESS AVE",
"street2": "",
"city": "AUSTIN",
"state": "TX",
"country": "US",
"zipCode": "1003"
}
}
],
"estimatedTax": {
"itemsTaxes": [
{
"lineItemId": 1,
"amount": 2
}
],
"shipToTaxes": [
{
"shipToId": "{{shipToId}}",
"amount": 1.5
}
]
}
}

Checkout Request - Affirm

{
"cartId": "{{cartId}}",
"customerEmail": "[email protected]",
"customerPhoneNumber": {
"number": "+448049381593",
"kind": "Mobile"
},
"paymentDetails": [
{
"transactionDetails": {
"paymentType": "NON_CARD",
"tokenizedPaymentMethod": "1P0P5B4WFZDB2T97"
},
"paymentIdentifier": {
"cardIdentifier": "QWfXNQNFXWp07Xu2"
},
"paymentMethod": "affirm",
"paymentKind": "affirm",
"amount": "18.54",
"currency": "USD",
"conversion": 1,
"billToAddress": {
"name": {
"first": "tawseef",
"last": "ahmade bhat"
},
"email": "[email protected]",
"phone": {
"number": "+448049381593",
"kind": "Mobile"
},
"street1": "600 CONGRESS AVE",
"street2": "",
"city": "AUSTIN",
"state": "TX",
"country": "US",
"zipCode": "78701-3238"
}
}
],
"estimatedTax": {
"orderTotalTax": 1.43,
"itemsTaxes": [
{
"lineItemId": 1,
"amount": 1
}
],
"shipToTaxes": [
{
"shipToId": "{{shipToId}}",
"amount": 0.3
}
]
}
}

Response

Response Code: 200

Message: OK

Description: You will see this message when the checkout is successful.

{
"checkoutComplete": true,
"orderId": "9376-1544-24209"
}

Response Code: 404

Message: Not found

Description: You will see this error when the cart ID doesn't exist in the system.

{
"code": "CART_NOT_FOUND",
"message": "Cart not found."
}

Response Code: 400

Message: Bad Request

Description: You will see this error when the cart ID is lesser or greater than 24 characters.

{
"code": "REQUEST_VALIDATION",
"message": "Invalid data in path: /cartId should NOT be shorter than 24 characters"
}

Response Code: 400

Message: Bad Request

Description: You will see this error when the ship-to ID is lesser or greater than 24 characters.

{
"code": "REQUEST_VALIDATION",
"message": "Invalid data in body: /estimatedTax/shipToTaxes/0/shipToId should NOT be shorter than 24 characters"
}

Response Code: 400

Message: Bad Request

Description: You will see this error when the tax details aren't provided.

{
"code": "REQUEST_VALIDATION",
"message": "Invalid data in body: should have required property 'estimatedTax'"
}

Response Code: 400

Message: Bad Request

Description: You will see this error when the payment details aren't provided.

{
"code": "REQUEST_VALIDATION",
"message": "Invalid data in body: /paymentDetails should NOT have fewer than 1 items"
}

Response Code: 404

Message: Not Found

Description: You will see this error when the all the line items in the cart are not mapped with ship-to.

{
"code": "CART_SHIP_TO_ERROR",
"message": "Cart item ship to's are missing."
}

Error Code: 500

Message: Internal Server Error

Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

  • June - 2021

  • July - 2020 First updated