Refund or Void a Pay Request
Difference between refunds and voids
Refund is only used when a Pay Request has been captured whereas a void is used when it has not been captured. For example, a customer has already paid and wants to return the goods for a full or partial refund. A void can happen if the customer has the funds on hold waiting for a service to be performed but changed their minds before receiving the service and wants their funds released.
Refund a Pay Request
Refunds can be issued via our Pay Refunds API.
Create a Tyro Refund from your server, you must provide the ID of the Pay Request that was used to make the original payment.
// Node sample code
// find the pay request to refund
const payRequestId = findPayRequestForRefund();
const refund = await axios.post('https://api.tyro.com/connect/pay/refunds',
{
"payRequestId": payRequestId,
// total is optional
"total": {
"amount": 12345, // cannot exceed the original Pay Request Amount
"currency": "AUD"
}
},
{
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer exampleJwt'
}
});
Refunds for the partial payment total are supported, and multiple Refunds can be requested for the same Pay Request provided that the sum of the Refunds does not exceed the original Pay Request total.
There are a few limitations to refunds such as the following:
- Refunds cannot be cancelled.
- Refunds can only be sent back to the original payment method.
- If the Pay Request had a manual capture method and the payment has not yet been captured, then a refund cannot be issued, void the Pay Request instead.
Void a Pay Request
Void a payment via our Pay Requests API.
If a Pay Request has not yet been captured or submitted, it can be voided.
Send a PATCH
with a VOID
action to the Pay Request endpoint.
// Node sample code
// find the pay request to void
const payRequestId = findPayRequestToVoid();
const refund = await axios.patch(`https://api.tyro.com/connect/pay/requests/${payRequestId}`,
{
"action": "VOID",
},
{
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer exampleJwt'
}
});
Once Pay Request is voided, it can no longer be used.