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.pollDetails({
refId: 'ckd-ref_3fa85f64-5717-4562-b3fc',
});
console.log(response.refId);{
"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": {}
}Check the status of a cart details retrieval job and get results when ready.
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.pollDetails({
refId: 'ckd-ref_3fa85f64-5717-4562-b3fc',
});
console.log(response.refId);{
"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": {}
}Reference ID used for checking status
^[a-zA-Z]{3}-ref_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}$"ckd-ref_3fa85f64-5717-4562-b3fc"
Was this page helpful?