Complete a Pre-authorised Payment
Completing a transaction allows you to take either the full or partial funds from a previously pre-authorised payment.
How it works
Utilising our completions feature you are able to take either the full amount reserved on the customer's payment instrument or a partial amount less than the total amount reserved utilising the original payment transaction ID and reference number.
Completions can only be processed on payments made using the pre-authorisation flow if the transaction has not been voided.
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 completions.
Completing a Payment
Using the transactionId
and optionally the paymentTransactionRef
from a pre-authorised payment you are able to complete for an amount up to the amount pre-authorised. You can simply call this method with the transactionId
and all sub-transactions will be completed for their full amounts or you can specify the sub-transactions paymentTransactionRef
and the amount you wish to complete the transaction for.
curl --location --request POST 'https://{{environment}}.wpay.com.au/wow/v1/pay/instore/merchant/transactions/:transactioId/completion' \
--header 'content-type: application/json' \
--header 'content-type: application/json' \
--header 'X-Api-Key: {{yourAPIKey}}' \
--data-raw '{
"data": {
"orderNumber": "UNIQUE_ORDER_NO",
"clientReference": "UNIQUE_CLIENT_REFERENCE",
"completions":[{
"paymentTransactionRef": "1000000007828829",
"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": {
"orderNumber": "UNIQUE_ORDER_NO",
"clientReference": "UNIQUE_CLIENT_REFERENCE",
"completions":[{
"paymentTransactionRef": "1000000007818087",
"amount": 0.02
}]
},
"meta": {}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch(`https://${environment}.wpay.com.au/wow/v1/pay/instore/merchant/transactions/343bd75f-e71c-4b73-9e9f-85b05347b2b3/completion`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Where:
transactionId
is the unique reference to pre-authorised payment outcome received from us when making a payment.clientReference
is your application-specific reference number. This number should uniquely identify the transaction in your systemorderNumber
is your order number of the transaction as generated during the order creation.paymentTransactionRef
is the specific sub transaction reference within the parenttransactionId
.amount
is the value for which you want to complete the sub transaction.
Completion Outcome
Following the completion, an outcome of the transaction is returned with the status of the completion as well as the transaction references.
{
"data": {
"transactionId": "23fe9174-fdf3-4ba0-88d0-f0678c510cab",
"merchantReferenceId": "b717215d-4afc-4760-ab08-0fac46150309",
"walletId": "08d92644-121e-47cb-a711-7e7389cb576d",
"paymentRequestId": "9074e03f-05e1-4b55-a7eb-f1a0336acccc",
"grossAmount": 50.5,
"clientReference": "ref",
"executionTime": "2021-10-06T06:00:21.035Z",
"type": "COMPLETION",
"status": "APPROVED",
"instruments": [
{
"paymentInstrumentId": "215931",
"instrumentType": "CREDIT_CARD",
"transactions": [
{
"type": "COMPLETION",
"executionTime": "2021-10-06T06:00:21.035Z",
"paymentTransactionRef": "1000000007828829",
"completionTransactionRef": "1000000007828838",
"status": "APPROVED",
"amount": 10.5
}
]
}
],
"subTransactions": [
{
"transactionReceipt": "1000000007828838",
"partialSuccess": false,
"completionResponses": [
{
"paymentTransactionRef": "1000000007828829",
"completionTransactionRef": "1000000007828838",
"amount": 10.5,
"externalServiceCode": "00",
"externalServiceMessage": "APPROVED"
}
]
}
]
},
"meta": {}
}
Updated over 1 year ago