Skip to content

COD and Prepaid

The Bigship SDK supports two payment types for shipments: COD (Cash on Delivery) and Prepaid. The payment type affects the collectableAmount field in each product.

For prepaid orders, the customer has already paid. The collectable amount must be 0.

await client.createOrder({
segment_type: 'domestic_b2c',
MasterOrderPaymentMode: 1, // Prepaid
// ...other fields
totalNumOfBoxes: 1,
boxes: [{
// ...
products: [{
// ...
collectableAmount: 0,
}],
}],
});

For COD orders, the courier collects payment from the customer at delivery. The collectable amount must be greater than 0.

await client.createOrder({
segment_type: 'domestic_b2c',
MasterOrderPaymentMode: 2, // COD
// ...other fields
totalNumOfBoxes: 1,
boxes: [{
// ...
products: [{
// ...
collectableAmount: 499,
}],
}],
});
Payment Type MasterOrderPaymentMode collectableAmount (per product)
Prepaid 1 Must be 0
COD 2 Must be > 0

The SDK provides a helper to calculate the correct collectable amount:

const amount = BigshipUtils.calculateCollectableAmount(
999, // totalAmount
500 // prepaidAmount
);
// 499
await client.createOrder({
segment_type: 'domestic_b2c',
MasterOrderPaymentMode: 2, // COD
// ...other fields
boxes: [{
// ...
products: [{
// ...
collectableAmount: amount,
}],
}],
});

This is useful when customers pay a partial amount upfront and the remaining balance is collected at delivery.