Skip to main content

Refund order (partial)

This request will create a credit invoice with order lines included in the request body. totalRefundAmount must be a valid sum of the order lines totalAmount. An order must have a captured array populated with order lines for a refund to be successful, that is where the ledgerId string is located. Whether the refund action is available on the order or not, can be determined by inspecting the availableActions array on the suborder chunk. This can be retrieved from the GET order response.

curl -X POST \
-H 'authorization: Bearer v4.public.eyJpc3MiOiJs...' \
-H 'content-type: application/json' \
-H 'Idempotency-Key: da7ca8f9-915b-472b-b5f0-81945bff9e4a' \
-d '{
"orderLines": [
{
"description": "SAMSUNG Galaxy S20 FE 4G 128GB (6GB RAM) 6.5 Smartphone - Cl",
"quantity": 2,
"reference": "321-321",
"totalAmount": 999000,
"totalVatAmount": 199800,
"type": "physical",
"unitPrice": 499500,
"vat": 2500
}
],
"totalRefundAmount": 999000
}'
https://api.sandbox.ledyer.com/v1/orders/:orderId/partialrefund/:ledgerId

Request Headers

Idempotency-Key

stringOptional

By providing a unique value for this header, the idempotency of the operation will be guaranteed. This means that retries of requests will be safe to apply in case of network errors, socket errors and timeouts, etc. We recommend using UUID version 4 for the key.

Path parameters

ledgerId

The ledger ID string that is included in a capture.

orderId

The order ID string that was obtained when the order session was created.

Request body

orderLines

array of orderlinesOptional

An array of order lines. Please note that order line id property must be excluded in this request.

totalRefundAmount

integer

The sum of all order lines totalAmount.

note

stringOptional

A note for the refund reason.