XM

Checkout 4.0 (New)

Path:

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

This API supports checkout using multiple payment methods through popular payment gateways such as Stripe or Authorize.net. In addition, you may allow your customers the option to use split payments between the different payment methods such as Gift Cart, Loyalty Points, Credit/Debit Cards, Apple Pay, Google Pay, and PayPal (based on the selected payment gateway).

To checkout using Stripe, the following APIs must be run sequentially.

  1. Add Items to Cart

  2. Create Shipping

  3. Add Shipping to Line Items

  4. Create Payment Method

  5. Create Payment Intent

  6. Confirm Payment intent

  7. Checkout

Although, the paymentDetails are optional in the requestBody, the 'Add Payment to Cart' API determines whether the amount matches with the cart amount

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 cart ID, customer contact, estimated taxes, and optionally the payment details.

Required: true

Sample Request

Path:

POST https://{baseurl}/api-order/checkout-v4
{
"cartId": "{{cartId}}",
"customerEmail": "[email protected]",
"paymentDetails": [{
"transactionDetails": {
"paymentType": "CARD",
"cardNumber": "4111111111111111",
"expDate": "1122",
"cvv": "999",
"cardHolderFullName": "tawseefahmade bhat",
"metadata": {}
},
"paymentIdentifier": {
"cardIdentifier": "1111"
},
"paymentMethod": "Visa",
"paymentKind": "Fabric User",
"amount": "100",
"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": 1
}
],
"shipToTaxes": [
{
"shipToId": "{{shipToId}}",
"amount": 0
}
]
}
}

Response

Response Code: 200

Message: OK

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

{
"checkoutComplete": true,
"orderId": "4679-1016-66250"
}

When the payment initiated doesn't match with the amout payable for the cart, the success response will show checkoutComplete as false, along with the payment discrepancy.

{
"checkoutComplete": false,
"pointOfFailure": "payment",
"paymentResp": {
"totalAmountCapturable": "0.00",
"orderTotal": "1001.00"
}
}

‚Äč

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