Refund a Payment
Refunds allow you to refund a previous transaction to the original instrument from where the purchase was made.
How it works
Utilising our refunds feature you are able to refund an amount up to the value of the full transaction amount utilising the original payment transaction ID and reference number.
Multiple refunds are able to be processed on the transaction up to the original transaction amount.
Refunds can only be processed on payments made using the purchase flow or after a transaction using the pre-authorisation flow has been completed.
Restricted API
This API is IP restricted to allow unauthenticated server-side calls. Your servers will need to be on our allow list to allow refunds.
Refund a Payment
Using the transactionId
and optionally the paymentTransactionRef
from a payment you are able to refund a transaction up to the amount of the original transaction. You can simply call this method with the transactionId
and all subtransactions will be refunded for their full amounts or you can specify the sub-transactions paymentTransactionRef
and the amount you wish to refund the transaction for.
curl --location --request POST 'https://{{environment}}.wpay.com.au/wow/v1/pay/instore/merchant/transactions/c691fdb2-c072-426a-b2ec-324c53366747/refund' \
--header 'content-type: application/json' \
--header 'X-Api-Key: {{yourAPIKey}}' \
--data-raw '{
"data" : {
"reason": "Customer returned item",
"clientReference": "UNIQUE_CLIENT_REFERENCE",
"subTransactions": [
{
"subTransactionRef": "1000000007818223",
"amount": 20.5
},
{
"subTransactionRef": "1000000007818224",
"amount": 10.5
}
]
},
"meta": {}
}'
var myHeaders = new Headers();
var environment = "substitute environment-value here"
var yourAPIkey = "YOUR-API-KEY";
myHeaders.append("Content-Type", "application/json");
myHeaders.append("X-Api-Key", yourAPIkey);
var raw = JSON.stringify({
"data" : {
"reason": "Customer returned item",
"clientReference": "UNIQUE_CLIENT_REFERENCE",
"subTransactions": [
{
"subTransactionRef": "1000000007818223",
"amount": 20.5
},
{
"subTransactionRef": "1000000007818224",
"amount": 10.5
}
]
},
"meta": {}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch(`https://${environment}.wpay.com.au/wow/v1/pay/instore/merchant/transactions/c691fdb2-c072-426a-b2ec-324c53366747/refund`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Refund Outcome
Following the refund, an outcome of the transaction is returned with the status of the refund as well as the transaction references.
{
"data": {
"transactionId": "c1de8321-64dc-48a8-ae00-5f8ab341cf05",
"merchantReferenceId": "c691fdb2-c072-426a-b2ec-324c53366747",
"walletId": "7aa8634e-3c4e-41f7-9f15-0963515de94a",
"paymentRequestId": "1ed7bd1a-1068-4f7a-9655-8874aaa6685c",
"refundReason": "Customer returned item",
"grossAmount": 31,
"clientReference": "UNIQUE_CLIENT_REFERENCE",
"executionTime": "2021-09-28T06:45:54.138Z",
"type": "REFUND",
"status": "APPROVED",
"instruments": [
{
"paymentInstrumentId": "215355",
"instrumentType": "CREDIT_CARD",
"transactions": [
{
"type": "REFUND",
"executionTime": "2021-09-28T06:45:54.138Z",
"paymentTransactionRef": "1000000007818223",
"refundTransactionRef": "1000000007818227",
"status": "APPROVED",
"amount": 20.5
}
]
},
{
"paymentInstrumentId": "215354",
"instrumentType": "CREDIT_CARD",
"transactions": [
{
"type": "REFUND",
"executionTime": "2021-09-28T06:45:54.138Z",
"paymentTransactionRef": "1000000007818224",
"refundTransactionRef": "1000000007818226",
"status": "APPROVED",
"amount": 10.5
}
]
}
],
"subTransactions": [
{
"transactionReceipt": "1000000007818225",
"refunds": [
{
"paymentTransactionRef": "1000000007818223",
"refundTransactionRef": "1000000007818227",
"amount": 20.5,
"externalServiceCode": "00",
"externalServiceMessage": "APPROVED"
},
{
"paymentTransactionRef": "1000000007818224",
"refundTransactionRef": "1000000007818226",
"amount": 10.5,
"externalServiceCode": "00",
"externalServiceMessage": "APPROVED"
}
],
"dpResponse": {
"transactionReceipt": "1000000007818225",
"partialSuccess": false,
"refundResponses": [
{
"paymentTransactionRef": "1000000007818223",
"refundTransactionRef": "1000000007818227",
"amount": 20.5,
"externalServiceCode": "00",
"externalServiceMessage": "APPROVED"
},
{
"paymentTransactionRef": "1000000007818224",
"refundTransactionRef": "1000000007818226",
"amount": 10.5,
"externalServiceCode": "00",
"externalServiceMessage": "APPROVED"
}
]
}
}
]
},
"meta": {}
}
Updated over 1 year ago