Refunds
A refund allows you to return a certain amount to your customer. The refunded amount will be deducted from your PayPro balance.
Refunds can be created in multiple ways:
- Through the PayPro Dashboard
- With the Refunds API
All payment methods support refunds and the payment method determines what type of refund will be used and where the amount will be returned to.
We will now discuss how you can create a Refund with our Refunds API.
Creating a Refund
A Refund is a resource in our API and always belongs to a Payment. So in order to create a Refund we will need to retrieve a Payment first. The payment should have the status paid
or completed
.
With this Payment we can create a Refund by calling the Payment refund API endpoint. Our API clients make this easy:
$payment = $paypro->payments->get('PPGA1HDAXPYRXG');
$refund = $payment->refund(['amount' => 500]);
payment = PayPro::Payment.get('PPGA1HDAXPYRXG')
refund = payment.refund(amount: 500)
The amount
parameter is optional, without it we will refund the total amount available.
Partial refunds
Partial refunds are supported and you can create multiple partial refunds. The total amount returned cannot exceed the Payment amount.
Additional parameters
You can supply a description
and a reason
. The description
will be used to communicate with your customer and the reason
is the reason for the refund which is not shared with the customer.
Some payment methods also require other parameters. For instance the bancontact
payment method requires you to supply an iban
and account_holder_name
.
Refund statuses
Refunds have their own status, independent of the Payment they were created for.
NOTE
The status of the Payment is not changed when creating refunds in the API. This means the Payment will keep the status paid
or completed
even when the full amount has been refunded.
These are the possible states:
open
The refund is created an will be picked up by our system soon.
pending
The refund is pending because not all requirements are met. This usually indicates there is not enough balance in your PayPro account.
processing
The refund is being processed.
refunded
The refund has been refunded and the funds are under way.
completed
The refund has been completed and the customer should have received the funds.
canceled
The refund has been canceled and will no longer be processed.
failed
The refund has failed. For example the customer closed their bank account. The funds will be returned to your PayPro balance.