Partial Refund
Refund part of an order.
POST
/api/paylater/merchant-portal/v2/web-checkout/refund
Sandbox
https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/refund
Production
https://connect.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/refund
Refund rules
The same window as a full refund applies (within 29 days, no sooner than 10 minutes after the transaction). See Full Refund.
Request
Headers
| Header | Value |
|---|---|
Authorization | Bearer <ACCESS_TOKEN> |
Content-Type | application/json |
Body parameters
order_idStringrequiredYour merchant Order ID.
amountStringrequiredPartial amount (less than the total order value).
Example request
curl --location 'https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/refund' \
--header 'Authorization: Bearer <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{ "order_id": "O-4756", "amount": "120.00" }'
const res = await fetch(
'https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/refund',
{
method: 'POST',
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
order_id: 'O-4756',
amount: '120.00',
}),
},
);
const data = await res.json();
import requests
resp = requests.post(
"https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/refund",
headers={
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json",
},
json={
"order_id": "O-4756",
"amount": "120.00",
},
)
data = resp.json()
$ch = curl_init('https://connect.uat.paylaterapp.com/api/paylater/merchant-portal/v2/web-checkout/refund');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $accessToken,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'order_id' => 'O-4756',
'amount' => '120.00',
]),
]);
$response = json_decode(curl_exec($ch), true);
Response
{
"message": "Partial Refund request accepted for reference Id: O-4756"
}
Errors
| Example response | Cause |
|---|---|
{ "error": "Transaction Reference is required" } | Missing order_id. |
{ "error": "Invalid API Key" } | Bad/missing token. |
{ "error": "Refund Error", "message": "Order cannot be refunded as it happened more than 29 days ago." } | Outside window. |
{ "error": "Refund Error", "message": "Transaction happened less than 10 minutes ago. Please try again later." } | Too soon. |
{ "error": "Refund Error", "message": "Invalid Transaction Reference." } | Unknown order. |
{ "error": "Refund Error", "message": "Invalid Transaction type." } | Not a refundable transaction type. |