Depending on your business needs, there may be occasions when you want to return funds to your customer. For that, you need to refund the payment. SlimPay allows you to reimburse a payment via API or via Dashboard, either partially or in full.
This guide will take you through the steps needed to process a refund for your customer using our Web API.
All of the code examples in our guides are written in PHP as it is a widely used programming language. They are based on our official HAPI Client which has been developed by SlimPay to make the integration process as easy as possible.
Refund a SEPA direct debit
In order to initiate a direct debit refund:
- The recipient must have been debited in the past
- The recipient must have an active mandate
- The refund amount must be less than or equal to the merchant's available funds
- The refund amount must be less than or equal to the total amount debited from the recipient's account in the past 6 months
Please note: refunding using the following credit transfer method does not mean that the initial direct debit can't be subject to a refund request from the payer.
In other words, the payer could get the amount twice. So be very careful when using this feature.
We initiate the refund by creating a credit transfer using the create-payouts relation:
$rel = new Hal\CustomRel('https://api.slimpay.net/alps#create-payouts'); $follow = new Http\Follow($rel, 'POST', null, new Http\JsonBody( [ 'creditor' => [ 'reference' => 'yourCreditorReference' ], 'mandate' => [ 'reference' => 'theMandateReference' ], 'reference' => null, 'amount' => 29.99, 'currency' => 'EUR', 'scheme' => 'SEPA.CREDIT_TRANSFER', 'label' => 'Refund of your January fee', 'executionDate' => null ] )); $payment = $hapiClient->sendFollow($follow);
In the example above, the mandate reference was used to refund the payment. You could also provide the subscriber reference instead, and SlimPay will refund the most recently active mandate associated with this subscriber.
The table below lists all of the parameters that you need to create a refund. Be sure to include all the properties that are mandatory, as well as any optional ones you wish.
All of the data you provide must conform to the constraints outlined in our comprehensive API reference
|creditor » reference||Alphanumeric||35|
|mandate » reference
subscriber » reference
As soon as possible if
|A date, formatted to ISO 8601 standard|
Refund a card payment
To refund a card transaction, the process is slightly different. We must first fetch the payment we want to reimburse using the payment ID. It can then be refunded by using the refund-payment relation:
$rel = new Hal\CustomRel('https://api.slimpay.net/alps#search-payment-by-id'); $follow = new Http\Follow($rel, 'GET', [ 'id' => 'thePaymentId' ]); $payment = $hapiClient->sendFollow($follow); $rel = new Hal\CustomRel('https://api.slimpay.net/alps#refund-payment'); $follow = new Http\Follow($rel, 'POST'); $payment = $hapiClient->sendFollow($follow, $payment);