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.
Prepaid
Section titled “Prepaid”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});COD (Cash on Delivery)
Section titled “COD (Cash on Delivery)”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 |
Utility: calculateCollectableAmount
Section titled “Utility: calculateCollectableAmount”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.