XM
Members
Add Payment to Cart
This documentation is now outdated, please find the latest docs for this endpoint here
Path:
1
POST https://{baseurl}/api-payment/payment
Copied!
Enables you to add payment to the cart.

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 (from the Add Items to Cart or Retrieve Cart by userAuthToken API) and the payment details.
Required: true

Sample Request

Path:
1
POST https://{baseurl}/api-payment/payment
Copied!
Request Body:
1
{
2
"cartId": "60b90dd7308ded0008ee3c5d",
3
"paymentDetails": {
4
"transactionDetails": {
5
"paymentType": "CARD_STRIPE",
6
"paymentToken": "pi_1IyMGc2YBvYaVyBQNkOiCE3E"
7
},
8
"amount": 999,
9
"currency": "USD"
10
},
11
"billToAddress": {
12
"name": {
13
"first": "John",
14
"middle": "Bob",
15
"last": "Demo"
16
},
17
"email": "[email protected]",
18
"phone": {
19
"number": "07780811973",
20
"kind": "mobile"
21
},
22
"street1": "600 Congress Ave",
23
"street2": "suite 219",
24
"city": "Austin",
25
"state": "Tx",
26
"country": "US",
27
"zipCode": "10033"
28
}
29
}
Copied!

Response

Success Code: 200
Message: OK
Description: You'll see this message when the stripe payment is successfully added to the cart.
1
{
2
"paymentDetails": {
3
"transactionDetails": {
4
"paymentType": "CARD_STRIPE",
5
"paymentToken": "pi_1IyMGc2YBvYaVyBQNkOiCE3E"
6
},
7
"paymentStatus": {
8
"cardHolderFullName": "First Last",
9
"paymentMethod": "visa",
10
"last4": "4242",
11
"amountCapturable": 99900,
12
"status": "succeeded"
13
},
14
"amount": 999,
15
"currency": "USD"
16
},
17
"billToAddress": {
18
"name": {
19
"first": "John",
20
"last": "Smith"
21
},
22
"phone": {
23
"number": "07780811973",
24
"kind": "mobile"
25
},
26
"email": "[email protected]",
27
"street1": "600 Congress Ave",
28
"street2": "suite 219",
29
"city": "Austin",
30
"state": "Tx",
31
"country": "US",
32
"zipCode": "10033"
33
},
34
"version": 0,
35
"isValid": true,
36
"_id": "60b92e823de01200093818cb",
37
"cartId": "60b90dd7308ded0008ee3c5d",
38
"createdAt": "2021-06-03T19:33:22.876Z",
39
"updatedAt": "2021-06-03T19:33:22.876Z"
40
}
Copied!
Error 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!
Error 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!
Error Code: 400
Message: Bad Request
Description: You will see this error when the payment is already added to the cart ID.
1
{
2
"code": "PAYMENT_CREATE_ERROR",
3
"message": "Unable to create payment. Payment Token already exists"
4
}
Copied!
Error Code: 500
Message: Internal Server Error
Description: You will see this error when the payment intent is not valid.
1
{
2
"message": "No such payment_intent: 'pi_1Ij6W0Jxr7zyIFb9LGIDj1Y1'"
3
}
Copied!
Error Code: 500
Message: Internal Server Error
Description: You will see this error when the payment intent doesn't exist.
1
{
2
"message": "payment_method does not exist"
3
}
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
Last modified 1mo ago
Copy link
Contents
Change Log