Collect Payments by Card
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.
Once you set up your card payment method, it's very easy to create a payment. More importantly, you don't need any redirect or iframe anymore! A simple server to server call will do:
$rel = new Hal\CustomRel('https://api.slimpay.net/alps#create-payins'); $follow = new Http\Follow($rel, 'POST', null, new Http\JsonBody( [ 'creditor' => [ 'reference' => 'yourCreditorReference' ], 'cardAlias' => [ 'reference' => 'theCardAliasReference' ], 'reference' => null, 'amount' => 29.99, 'currency' => 'EUR', 'scheme' => 'CARD', 'label' => 'January fee for Hooli Magazine', 'executionDate' => null ] )); $payment = $hapiClient->sendFollow($follow);
Instead of the card alias reference, you can use the subscriber reference and SlimPay will use the latest active card 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|
|cardAlias » reference
subscriber » reference
As soon as possible if
When trying to create the payment, it can be synchronously rejected by our API if a parameter is missing or not formatted correctly.
Otherwise, the server responds with a
201 Created HTTP status. The payment is created and returned in the response.
In this response, you may want to focus on these three properties:
id: the payment unique ID generated by SlimPay. Store it if you need to retrieve your payment later.
executionDate: the date on which the amount is expected to be settled by the network, set by you or generated by SlimPay.
executionStatus: the payment starts as
toprocessmarking the beginning of its life cycle described below.
Payment Life Cycle
||The payment seems valid and should be sent to the network.|
||A few days before the execution date, our system tries to process it.|
||A few days before the execution date, our system is not able to process it as it is not valid anymore (e.g. the card alias has been deleted between the payment creation and the time we try to process it).|
||The processing of the payment was not a success and another attempt will be done after our operations team figure out what's wrong with the payment. Depending on their analysis, it may move to
||The processing of the payment was a success and it's on his way through the network. At this point, you can expect the settlement to happen on execution date unless the payment moves to
||The payment was never settled or it was settled and then the money was sent back to the debtor. See our guide on how to handle payment issues for more details.|