XM
Members
Checkout 2.0 (legacy)
This documentation is now outdated, please find the latest docs for this endpoint here
Path:
1
POST https://{baseurl}/api-order/checkout
Copied!
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. 1.
    Add Items to Cart
  2. 2.
    Create Shipping
  3. 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:
1
POST https://{baseurl}/api-order/checkout
Copied!
Checkout Request Sample - Card
1
{
2
"cartId": "60818e01f260880008cf4dfa",
3
"customerEmail": "[email protected]",
4
"customerPhoneNumber": {
5
"number": "07780811973",
6
"kind": "Mobile"
7
},
8
"paymentDetails": [
9
{
10
"transactionDetails": {
11
"paymentType": "CARD",
12
"cardNumber": "4111111111111111",
13
"expDate": "1122",
14
"cvv": "999",
15
"cardHolderFullName": "tawseefahmade bhat",
16
"metadata": {}
17
},
18
"paymentIdentifier": {
19
"cardIdentifier": "1111"
20
},
21
"paymentMethod": "Visa",
22
"paymentKind": "Fabric User",
23
"amount": "11.27",
24
"currency": "USD",
25
"conversion": 1,
26
"billToAddress": {
27
"name": {
28
"first": "tawseef",
29
"last": "ahmade bhat"
30
},
31
"email": "[email protected]",
32
"phone": {
33
"number": "07780811973",
34
"kind": "Mobile"
35
},
36
"street1": "600 CONGRESS AVE",
37
"street2": "",
38
"city": "AUSTIN",
39
"state": "TX",
40
"country": "US",
41
"zipCode": "1003"
42
}
43
}
44
],
45
"estimatedTax": {
46
"itemsTaxes": [
47
{
48
"lineItemId": 1,
49
"amount": 2
50
}
51
],
52
"shipToTaxes": [
53
{
54
"shipToId": "{{shipToId}}",
55
"amount": 1.5
56
}
57
]
58
}
59
}
Copied!
Checkout Request - Affirm
1
{
2
"cartId": "{{cartId}}",
3
"customerEmail": "[email protected]",
4
"customerPhoneNumber": {
5
"number": "+448049381593",
6
"kind": "Mobile"
7
},
8
"paymentDetails": [
9
{
10
"transactionDetails": {
11
"paymentType": "NON_CARD",
12
"tokenizedPaymentMethod": "1P0P5B4WFZDB2T97"
13
},
14
"paymentIdentifier": {
15
"cardIdentifier": "QWfXNQNFXWp07Xu2"
16
},
17
"paymentMethod": "affirm",
18
"paymentKind": "affirm",
19
"amount": "18.54",
20
"currency": "USD",
21
"conversion": 1,
22
"billToAddress": {
23
"name": {
24
"first": "tawseef",
25
"last": "ahmade bhat"
26
},
27
"email": "[email protected]",
28
"phone": {
29
"number": "+448049381593",
30
"kind": "Mobile"
31
},
32
"street1": "600 CONGRESS AVE",
33
"street2": "",
34
"city": "AUSTIN",
35
"state": "TX",
36
"country": "US",
37
"zipCode": "78701-3238"
38
}
39
}
40
],
41
"estimatedTax": {
42
"orderTotalTax": 1.43,
43
"itemsTaxes": [
44
{
45
"lineItemId": 1,
46
"amount": 1
47
}
48
],
49
"shipToTaxes": [
50
{
51
"shipToId": "{{shipToId}}",
52
"amount": 0.3
53
}
54
]
55
}
56
}
Copied!

Response

Response Code: 200
Message: OK
Description: You will see this message when the checkout is successful.
1
{
2
"checkoutComplete": true,
3
"orderId": "9376-1544-24209"
4
}
Copied!
Response Code: 404
Message: Not found
Description: You will see this error when the cart ID doesn't exist in the system.
1
{
2
"code": "CART_NOT_FOUND",
3
"message": "Cart not found."
4
}
Copied!
Response Code: 400
Message: Bad Request
Description: You will see this error when the cart ID is lesser or greater than 24 characters.
1
{
2
"code": "REQUEST_VALIDATION",
3
"message": "Invalid data in path: /cartId should NOT be shorter than 24 characters"
4
}
Copied!
Response Code: 400
Message: Bad Request
Description: You will see this error when the ship-to ID is lesser or greater than 24 characters.
1
{
2
"code": "REQUEST_VALIDATION",
3
"message": "Invalid data in body: /estimatedTax/shipToTaxes/0/shipToId should NOT be shorter than 24 characters"
4
}
Copied!
Response Code: 400
Message: Bad Request
Description: You will see this error when the tax details aren't provided.
1
{
2
"code": "REQUEST_VALIDATION",
3
"message": "Invalid data in body: should have required property 'estimatedTax'"
4
}
Copied!
Response Code: 400
Message: Bad Request
Description: You will see this error when the payment details aren't provided.
1
{
2
"code": "REQUEST_VALIDATION",
3
"message": "Invalid data in body: /paymentDetails should NOT have fewer than 1 items"
4
}
Copied!
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.
1
{
2
"code": "CART_SHIP_TO_ERROR",
3
"message": "Cart item ship to's are missing."
4
}
Copied!
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
Last modified 1mo ago
Copy link
Contents
Change Log