إنتقل إلى المحتوى الرئيسي

Create Exchange Order API

The Exchange API is used when a customer wants to swap items. It handles the complexity of creating a new delivery while simultaneously initiating a return for the old items.

POSThttps://api-fulfillment.bosta.co/api/v1/orders/exchange

Create an exchange order. You must specify which items are being returned and which new items are being sent.

REQUEST BODY

{
"referenceOrderId": "bi2gKAXt6v3DoXO_1UPDEysY5D",
"returnItems": [
{
"orderItemId": "AA-1",
"skuCode": "AA-1",
"quantity": 1
}
],
"items": [
{
"skuCode": "AA-2",
"quantity": 1,
"price": 200
}
],
"shipment": {
"codAmount":"100",
"note":"deliver am",
"allowToOpenPackage":false
},
"customer": {
"firstName": "karim",
"lastName": "ahmed",
"mobile": "01234567890"
},
"shippingAddress": {
"firstLine": "new cairo elmarag",
"cityName": "Cairo",
"cityId": "FceDyHXwpSYYF9zGW",
"districtId": "Zd9YG_OW46x",
"buildingNumber": "1",
"floor": "2",
"apartment": "3",
"isWorkAddress": false
}
}

Responses

201Exchange order created successfully
 {
"success": true,
"message": "Exchange order created successfully",
"data": {
"order": {
"id": "bi2gKAXt6v3DoXO_EXC_xyz123",
"type": "EXCHANGE",
"status": "PENDING",
"trackingNumber": "99887766",
"shipment": {
"trackingUrl": "https://bosta.co/...",
"shippingPartnerName": "bosta"
}
}
},
"meta": {
"timestamp": "2026-01-15T14:50:00.000Z"
}
}

Key Differences​

  • returnItems: Array of items the customer is giving back.
  • items: Array of new items the customer will receive.
  • allowToOpenPackage: A specific flag for exchanges to let the customer inspect the new item before handing over the return.
  • referenceOrderId: Links this exchange to the original purchase for history and inventory tracking.