Skip to Content
FastracDocs
API reference

Create an order

POST
/b2b/orders

Books one or more quoted shipments and pays for them in the same call. Each shipment references a shippingRateCode from Get shipping rates; price, courier service, insurance, COD and packages are taken from that rate. The courier is booked before the response returns, so a successful response already carries each shipment's airwayBill and status PENDING_PICKUP or PENDING_DROPOFF.

Requires the CREATE_ORDER permission. Orders that use a COD rate also require USE_COD.

Payment. Non-COD orders deduct each shipment's priceDetail.totalPrice from your shippingCredit balance. COD orders deduct nothing upfront, and every shipment in one order must be either COD or non-COD.

Receivers are matched to the rate's destinations by position: send them in the same order as the rate's destinations (stopOrder). If you send fewer receivers than destinations, the last receiver is reused.

Fulfilment. shippingOptions.fulfillmentMethod defaults to PICKUP for instant services and DROPOFF otherwise. A regular-courier pickup needs sender.coordinate. A pickup schedule must be at least 15 minutes ahead (Asia/Jakarta); omitted, it is now + 15 minutes. For Lalamove and Dash instant services the pickup time is fixed by the quote: send the same scheduledAt you quoted with, or omit schedule.

If payment or courier booking fails, the response is 400 with the message Payment failed, but order '<code>' was created successfully. Reason: …. The order stays unpaid and any charge is refunded; quote again and create a new order. If a courier rejects one shipment outright, the order still succeeds and that shipment is returned as CANCELLED and refunded.

This call is not idempotent. On a timeout, check List shipments (filter by search or date) before you retry.

Authorization

bearerAuth
headerAuthorizationBearer <token>

An access token from the OAuth2 client-credentials grant. Exchange your API key (client_id + client_secret) at the token endpoint and send Authorization: Bearer <access_token>.

Request Body

application/json
  1. body
shipments*array<>

One entry per shipping rate. All shipments must be either COD or non-COD.

Items1 <= items

Response Body

The order is paid and every shipment is booked with its courier.

application/json
  1. response
statusCode*integer
message*string
data*
curl -X POST 'https://sandbox-api.fastrac.example/b2b/orders' \  -H 'Content-Type: application/json' \  -d '{  "shipments": [    {      "shippingRateCode": "SR-7KQ2M9XA",      "sender": {        "name": "Toko Sinar Tebet",        "email": "[email protected]",        "whatsappNumber": "081211112222"      },      "receivers": [        {          "name": "Rina Kartika",          "phoneNumber": "081298765432",          "addressNote": "Rumah pagar hijau, sebelah warung kopi",          "label": "Rumah",          "stopSequence": 1        }      ],      "shippingOptions": {        "fulfillmentMethod": "DROPOFF"      },      "packages": [        {          "shippingRatePackageCode": "PKG-3M8XQ1",          "packageNote": "Jangan dibanting"        }      ]    }  ]}'
Example Response
{  "statusCode": 201,  "message": "Resource created successfully.",  "data": {    "id": 9021,    "code": "FSO-261120-A1B2C3",    "userId": 512,    "status": "CONFIRMED",    "createdAt": "2026-11-20T02:05:10.000Z",    "paidAt": "2026-11-20T02:05:12.000Z",    "dateFinished": null,    "price": {      "amount": 12984,      "currency": "IDR",      "codBilled": 0,      "codDisbursement": 0    },    "activePayment": null,    "shipments": [      {        "id": 18452,        "orderId": 9021,        "shippingRateId": 66310,        "code": "SHP-261120-K9M2Q7",        "courierCode": "JNE",        "courierName": "JNE",        "etdRange": "2 - 3 Days",        "serviceName": "JNE Reguler",        "type": "REGULAR",        "status": "PENDING_DROPOFF",        "fulfillmentMethod": "DROPOFF",        "pickupSchedule": null,        "isCod": false,        "isInsured": true,        "shippingDistanceMeter": 0,        "airwayBill": "CM12345678901",        "trackingUrl": null,        "finishedAt": null,        "histories": [          {            "timestamp": "2026-11-20T02:05:13.000Z",            "status": "PENDING_DROPOFF",            "description": "Shipment booked with courier"          }        ],        "priceDetail": {          "basePrice": 10000,          "fastracPrice": 9000,          "discountBreakdown": {            "discountPercentage": 10,            "discountAmount": 1000          },          "totalPrice": 12984,          "insuranceBreakdown": {            "insurancePercent": 0.25,            "insuranceMinimum": 1500,            "insuranceAdminFee": 2000,            "insurance": 3500          },          "taxBreakdown": {            "ppnInsurance": 385,            "ppnShipment": 99,            "ppnCod": 0          },          "currency": "IDR",          "totalPriceCalculation": "fastracPrice + insurance + ppnInsurance + ppnShipment"        },        "sender": {          "name": "Toko Sinar Tebet",          "email": "[email protected]",          "whatsappNumber": "081211112222",          "location": {            "fullAddress": "Jl. Tebet Raya No. 12, Tebet Barat, Jakarta Selatan",            "subdistrictId": "3174091001"          },          "createdAt": "2026-11-20T02:05:10.000Z"        },        "receivers": [          {            "shipmentId": 18452,            "name": "Rina Kartika",            "phoneNumber": "081298765432",            "addressNote": "Rumah pagar hijau, sebelah warung kopi",            "label": "Rumah",            "fullAddress": "Jl. Braga No. 8, Braga, Sumur Bandung, Kota Bandung",            "regionMappingId": "3273011003",            "createdAt": "2026-11-20T02:05:10.000Z"          }        ]      }    ]  }}

Was this page helpful?