post https://api-uat.payments.paynow.afterpaytouch.dev/v1/payments//refunds
Use this API to refund a payment
Request refund of the previous transaction.
This interface could only be accessed by the merchant host. All other access will be blocked. IP whitelisting will ensure only traffic from Optus could access this endpoint.
The interface provided is an HTTP POST request and JSON response.
HTTP Request
POST https://<env>/v1/payments/{paymentReceiptId}/refunds
Request headers
Clients must send appropriate headers with all requests.:
Parameter | Mandatory | Description |
---|---|---|
Content-Type | yes | application/json |
Accept | yes | application/json |
Authorization | yes | Bearer Access-admin-oauth-token (Refer Authentication) |
User-Agent | yes | All requests must include information about the Merchant, Platform, Channel and Service. For example Merchant/ABC; Platform/Merchant-FE; MerchantId/ABC123; Channel/web; CountryCode/AU; System Information/Java/8.3; Service/Shop |
Request-Id | yes | unique identifier for refund request provided by Merchant |
Path parameters
Name | Type | Mandatory | Description | Comment |
---|---|---|---|---|
paymentReceiptId | string | yes | The unique identifier of the payment response provided by Afterpay. The receiptId of the payment to which the refund will be associated |
Request body
Name | Type | Mandatory | Description | Comment |
---|---|---|---|---|
amount | number | yes | The value of the refund | Refund amount could be less than or equal to the actual payment amount |
risk | Risk | yes | Information to enable risk assessment process | Refer Risk Object |
requestor | string | yes | Who requested the payment refund ie user or system | phone number, employee number, system name etc. |
Sample Example
curl -v -X POST https://<env>/v1/payments/3517994/refunds \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer eyjfgfgfgfgfWERgjgjhj" \
-H "User-Agent: Merchant/ABC; Platform/BE; MerchantId/ABC123; Channel/sms; CountryCode/AU System Information/Java/8.3; Service/Auto-recharge" \e\
-H "Request-Id: 84567324156665656565656565656513" \
-d '{
"amount": 100.5,
"risk": {...},
"requestor": "6140222333"
}'
Response body
A successful request returns the 200 OK
status code and a JSON response body.
Name | Type | Mandatory | Description | Comment |
---|---|---|---|---|
id | string | yes | Uniquely identifies each refund. This is generated by the Afterpay and is included in the response | |
receiptId | string | yes | identifier for refund request | |
amount | number | yes | The value of the funds to be refunded | |
requestor | string | yes | Who requested the payment refund ie user or system | echo of the request |
Status: 200 OK
{
"id": "13e753e2e4a4b2f692b573e5fbe98b7b5523586a",
"receiptId": "3517998",
"amount": 100.5,
"requestor": "6140222333",
}