Before you read
The examples are written in PHP as it is a widely used language on the web but can be reproduced for any other language. They are based on our HAPI Client which aims to reduce the code complexity.
Important: refunds for BACS direct debits are yet to be supported.
Refund a SEPA direct debit
- The recipient must have been debited in the past.
- The recipient must have an active mandate.
- The amount must be less or equal to the merchant's available funds.
- The amount must be less or equal to the total amount debited from the recipient's account in the last 6 months.
Important: refunding by credit transfer 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 via 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);
Instead of the mandate reference, you can use the subscriber reference and SlimPay will use the latest active mandate for this subscriber.
Make sure the data you provide match our API constraints.
Here are the parameters, mandatory or optional, which needs your attention:
|creditor » reference||Alphanumeric||35|
|mandate » reference
subscriber » reference
As soon as possible if
Refund a card payment
Important: this will refund the full amount. Partial card refunds will be available soon.
We first fetch the payment then refund it by following the
$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);