Start a refund operation for selected refundable order items.
Authentication and headers
| Header | Description |
|---|---|
Authorization | Bearer <secret_key>. Keep the secret on the server and never write it to client logs. |
X-Travelandz-Id | <public_key>:<profile_code>, where the persisted profile code has the form dp_<12 alphanumeric>. |
Content-Type | application/json for requests with a JSON body. |
Request
The body requires a non-empty itemIds array of non-empty strings.
Request Params Schema
gdsproviderCurrently
0orderIdOrder id returned by order creation.
Request Body Schema
itemIdsitemIds[]Success response
Returns result with operation id, state, timestamp, total refund amount and item states. State can be success, pending or error.
Response Body Schema
resultresultidresultstateresultcreatedAtresulttotalRefundAmountresulttotalRefundAmountamountresulttotalRefundAmountcurrencyresultitemsresultitems[]idresultitems[]stateresultitems[]amountresultitems[]amountamountresultitems[]amountcurrencyErrors
400for validation or unknown fields.401or403for invalid API credentials.500 internal_communication_errororunknown_errorfor provider failures.order_already_refundedwhen the order was already refunded.order_refund_items_not_foundwhen requested items are unavailable.
Usage notes
A successful HTTP response can still have a pending operation state. Poll the refund status endpoint for completion.
cURL example
bash
curl --request POST \
--url "https://api.sandbox.travelandz.com/v1/trains/order/0/order_123/refund" \
--header "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
--header "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
--header "Content-Type: application/json" \
--data '{"itemIds":["refund_item_123"]}'