import HenrySDK from '@henrylabs/sdk';
const client = new HenrySDK({
apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted
});
const response = await client.cart.checkout.details('crt_sa2aEsCz9PRM', {
buyer: {
shippingAddress: {
line1: '123 Main St',
line2: 'Apt 4B',
city: 'Anytown',
province: 'CA',
postalCode: '12345',
countryCode: 'US',
},
},
coupons: ['SUMMER21', 'FREESHIP'],
mode: 'async',
});
console.log(response.data);{
"success": true,
"status": "<string>",
"message": "<string>",
"data": {
"jobs": [
{
"refId": "<string>",
"status": "pending",
"result": {
"items": [
{
"shippingOptions": [
{
"id": "<string>",
"name": "<string>",
"cost": {
"value": 123,
"currency": "USD"
},
"timeEstimate": "<string>",
"minDate": "<string>",
"maxDate": "<string>"
}
],
"costs": {
"subtotal": {
"value": 123,
"currency": "USD"
},
"total": {
"value": 123,
"currency": "USD"
},
"tax": {
"value": 123,
"currency": "USD"
},
"shipping": {
"value": 123,
"currency": "USD"
},
"discount": {
"value": 123,
"currency": "USD"
}
},
"coupons": [
{
"code": "<string>",
"available": true,
"savedAmount": {
"value": 123,
"currency": "USD"
}
}
]
}
]
},
"error": {}
}
],
"metadata": {}
}
}Retrieve detailed information about a cart. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.
import HenrySDK from '@henrylabs/sdk';
const client = new HenrySDK({
apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted
});
const response = await client.cart.checkout.details('crt_sa2aEsCz9PRM', {
buyer: {
shippingAddress: {
line1: '123 Main St',
line2: 'Apt 4B',
city: 'Anytown',
province: 'CA',
postalCode: '12345',
countryCode: 'US',
},
},
coupons: ['SUMMER21', 'FREESHIP'],
mode: 'async',
});
console.log(response.data);{
"success": true,
"status": "<string>",
"message": "<string>",
"data": {
"jobs": [
{
"refId": "<string>",
"status": "pending",
"result": {
"items": [
{
"shippingOptions": [
{
"id": "<string>",
"name": "<string>",
"cost": {
"value": 123,
"currency": "USD"
},
"timeEstimate": "<string>",
"minDate": "<string>",
"maxDate": "<string>"
}
],
"costs": {
"subtotal": {
"value": 123,
"currency": "USD"
},
"total": {
"value": 123,
"currency": "USD"
},
"tax": {
"value": 123,
"currency": "USD"
},
"shipping": {
"value": 123,
"currency": "USD"
},
"discount": {
"value": 123,
"currency": "USD"
}
},
"coupons": [
{
"code": "<string>",
"available": true,
"savedAmount": {
"value": 123,
"currency": "USD"
}
}
]
}
]
},
"error": {}
}
],
"metadata": {}
}
}Unique identifier for the cart
"crt_sa2aEsCz9PRM"
Show child attributes
Response mode. Use sync to wait up to 30 seconds for the backing worker flow to complete.
async, sync "async"
List of coupon codes applied to the cart
["SUMMER21", "FREESHIP"]Additional metadata for the request
Show child attributes
Was this page helpful?