Void a Pre-authorised Payment
Voiding a transaction allows you to cancel the reserved amount which has been held on the customer's card as part of a purchase made using the pre-authorisation flow.
How it works
Utilising our voids feature you are able to void the full transaction amount prior to taking the reserved funds from the customer's card utilising the original payment transaction ID and reference number.
Voids can only be processed on payments made using the pre-authorisation flow if the transaction has not yet been completed.
Restricted API
This API is IP restricted to allow unauthenticated server-side calls. Your servers will need to be on an allow list to allow voids.
Voiding a Payment
Using the transactionId
and optionally the paymentTransactionRef
from a pre-authorised payment you are able to void a pre-authorised transaction which will void the full amount reserved. You can simply call this method with the transactionId
and all subtransactions will be voided for their full amounts or you can specify the sub-transactions paymentTransactionRef
you wish to void should you only wish to void part of the transaction.
// probably should use :transactionId in the below URL to indicate it as a parameter
// same for Javascript examples
// the URL used in Swift/Kotlin examples seems incorrect.
curl --location --request POST 'https://{{environment}}.wpay.com.au/wow/v1/pay/instore/merchant/transactions/f69ba188-4d09-43d2-af19-8f0eba93cde0/void' \
--header 'content-type: application/json' \
--header 'X-Api-Key: {{yourAPIKey}}' \
--data-raw '{
"data": {
"orderNumber": "UNIQUE_ORDER_NO",
"clientReference": "UNIQUE_CLIENT_REFERENCE",
"voids": [
{
"paymentTransactionRef": "1000000007818208"
},
{
"paymentTransactionRef": "1000000007818209"
}
]
},
"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": {
"orderNumber": "UNIQUE_ORDER_NO",
"clientReference": "UNIQUE_CLIENT_REFERENCE",
"voids": [
{
"paymentTransactionRef": "1000000007818208"
},
{
"paymentTransactionRef": "1000000007818209"
}
]
},
"meta": {}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch(`https://${environment}.wpay.com.au/wow/v1/pay/instore/merchant/transactions/f69ba188-4d09-43d2-af19-8f0eba93cde0/void`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Void Outcome
Following the void, an outcome of the transaction is returned with the status of the void as well as the transaction references.
{
"data": {
"transactionId": "d7af9019-056d-4920-b6c1-adff66eab0eb",
"merchantReferenceId": "f69ba188-4d09-43d2-af19-8f0eba93cde0",
"walletId": "87e47ba3-d2d0-437d-bc7d-d93581ae4e8f",
"paymentRequestId": "a3be273e-4a62-4956-b1f0-4a2f2770f76e",
"grossAmount": 0,
"clientReference": "T8VZS5KQH0N278D",
"executionTime": "2021-09-28T06:31:44.565Z",
"type": "VOID",
"status": "APPROVED",
"instruments": [
{
"paymentInstrumentId": "215353",
"instrumentType": "CREDIT_CARD",
"transactions": [
{
"type": "VOID",
"executionTime": "2021-09-28T06:31:44.565Z",
"paymentTransactionRef": "1000000007818209",
"voidTransactionRef": "1000000007818214",
"status": "APPROVED",
"amount": 0
}
]
},
{
"paymentInstrumentId": "215352",
"instrumentType": "CREDIT_CARD",
"transactions": [
{
"type": "VOID",
"executionTime": "2021-09-28T06:31:44.565Z",
"paymentTransactionRef": "1000000007818208",
"voidTransactionRef": "1000000007818213",
"status": "APPROVED",
"amount": 0
}
]
}
],
"subTransactions": []
},
"meta": {}
}
Updated over 1 year ago