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 total_collectable_amount field.

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

await client.addSingleOrder({
payment_type: 'Prepaid',
total_collectable_amount: 0,
// ...other fields
});

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

await client.addSingleOrder({
payment_type: 'COD',
total_collectable_amount: 499,
// ...other fields
});
Payment Type payment_type total_collectable_amount
Prepaid 'Prepaid' Must be 0
COD 'COD' Must be > 0

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

const amount = BigshipUtils.calculateCollectableAmount({
totalAmount: 999,
prepaidAmount: 500,
});
// 499
await client.addSingleOrder({
payment_type: 'COD',
total_collectable_amount: amount,
// ...other fields
});

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