Skip to main content


Assign Shipping

To initiate a payment, it is mandatory to assign a shipping id to the line item (product) in the cart. There are two ways to do this:

  • Option 1: obtaining the shipping id from the product information and then add it as a param when adding the product to the cart.
  • Option 2: obtaining the available shipping ids from the line_items of the cart after adding the item it. You can get this information only if you have assigned assigning the shipping country to the cart.

You can get the all the shipping ids of a product from the "get product" methods or the available shipping ids from the "line_items" of a cart.

Option 1: Adding the shipping id when you add the product to the cart

When you add an item to the cart, add one of the shipping ids:

async function addToCart() => {
const sdk = getSDK();
await sdk.cart.addItem({
cart_id: string,
line_items: [
product_id: number,
quantity: number,
shipping_id: string // This is optional. If you add it, the product will have a shippingId assigned.

Option 2: Updating the shipping id in the line item of the cart

async function updateCartItem(CART_ID, CART_ITEM_ID, SHIPPING_ID, QUANTITY) => {
const sdk = getSDK();
const response = await sdk.cart.updateItem({
cart_id: CART_ID,
cart_item_id: CART_ITEM_ID,
shipping_id: SHIPPING_ID,