/api/v2/orders/{order}/refunds
Requires authentication
v2
Send a bearer token in the Authorization header.
Refunds all or part of a paid order. Partial refunds may be issued repeatedly up to the order total.
Full URL: https://api.acme.example/api/v2/orders/{order}/refunds
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| order | integer | yes | The order id. |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
| amount | integer | no | Minor units. Omit to refund the full remaining balance. |
| reason | string, one of requested_by_customer, duplicate, fraudulent | no |
Responses
201 The refund.
409 The order is not in a refundable state.
Example request
curl -X POST 'https://api.acme.example/api/v2/orders/1/refunds' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"amount": 4200,
"reason": "requested_by_customer"
}'
const response = await fetch('https://api.acme.example/api/v2/orders/1/refunds', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"amount": 4200,
"reason": "requested_by_customer"
})
});
const data = await response.json();
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'Authorization' => 'Bearer YOUR_TOKEN',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
])->post('https://api.acme.example/api/v2/orders/1/refunds', [
'amount' => 4200,
'reason' => 'requested_by_customer',
]);
$data = $response->json();
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('POST', 'https://api.acme.example/api/v2/orders/1/refunds', [
'headers' => [
'Authorization' => 'Bearer YOUR_TOKEN',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'amount' => 4200,
'reason' => 'requested_by_customer',
],
]);
$data = json_decode((string) $response->getBody(), true);
Example response
{
"id": "rfnd_91a",
"order_id": 8801,
"amount": 4200,
"status": "succeeded"
}