XM

Create Billing

Path:

POST https://{baseurl}/api-cart/bill-to/cart/{cartID}

This endpoint enables your customers to add the billing details such as preferred payment method, billing address, contact details, etc. to the cart . The billToId received in the response is required to retrieve or update the billing details in the future.

Headers

Content-Type : application/json

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

Parameters

Type : path

Name : The 24 character system-generated cart ID (from the Add Items to Cart or Retrieve Cart by userAuthToken API).

Required: true

Type: requestBody

Name: The billing adddress along with the contact information and the payment details.

Required: true

Sample Request

Path:

https://{baseurl}/api-cart/bill-to/cart/5f8f0da2d4cc8e00084b9e8e

Body:

{
"paymentMethod": "VISA",
"cardIdentifier": "4242",
"amount": 24,
"address": {
"street1": "10400 NE 4th St",
"city": "Bellevue",
"state": "WA",
"country": "United States",
"zipCode": "98004",
"kind": "shipping",
"name": {
"first": "John",
"middle": "M",
"last": "demo"
},
"email": "[email protected]",
"phone": {
"number": "123-992-9404",
"kind": "Mobile"
},
"attention": "Leave at the back door"
}
}

Response

Response Code: 200

Message: OK

Description: You will see this message when the billing details are successfully added to the cart.

Sample

{
"_id": "60803ab6880a2e0009bc5250",
"address": {
"street1": "10400 NE 4th St",
"city": "Bellevue",
"state": "WA",
"country": "United States",
"zipCode": "98004",
"kind": "shipping",
"name": {
"first": "John",
"middle": "M",
"last": "Demo"
},
"email": "[email protected]",
"phone": {
"number": "123-992-9404",
"kind": "Mobile"
},
"attention": "Leave at the back door"
},
"paymentMethod": "VISA",
"cardIdentifier": "4242",
"amount": 24,
"billToId": 35,
"cart": "5f8f0da2d4cc8e00084b9e8e",
"createdAt": "2021-07-14T03:27:29.198Z",
"updatedAt": "2021-07-14T03:29:29.198Z"
}

Response Code: 404

Message: Not found

Description: You will see this error when the specified 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 specified 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"
}

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