Add a First Payment During Checkout
SlimPay’s powerful Checkout solution allows you to enroll your customers and collect a first payment simultaneously. While setting up a customer for direct debit or SlimCollect payments, you can also collect a first payment in the same transaction!
You can also create a payment in the notification or return URL at the end of a Checkout transaction. You can find step-by-step guides on this in our server to server payments section.
Please note
This guide does not cover the basics of API authentication or the format of requests and responses. Please review these sections if you are unfamiliar with these concepts.
All of the code examples in our guides are written in PHP and are based on our HAPI Client, developed by SlimPay to reduce the code complexity of interfacing with our API. Please refer to our HTTP client page for more details on using these libraries.
To add a first payment during Checkout, we simply need to add an additional payment order item when creating the order.
'items' => [
[
// Your already existing order item of type
// signMandate
],
[
'type' => 'payment',
'action' => 'create',
'payin' => [
'amount' => 29.99,
'scheme' => null,
'reference' => null,
'label' => 'First payment for your subscription to Hooli Magazine',
'executionDate' => null
]
]
]
The table below lists all of the parameters that you need to collect a customer’s first payment. 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.
Parameter | Mandatory | Format | Max length |
---|---|---|---|
payment reference If null , SlimPay will generate a unique reference for this payment. |
Alphanumeric without special characters | 35 | |
amount | Decimal | 19 | |
currency
|
ISO 4217 | 3 | |
scheme
|
Alphanumeric | 35 | |
label Label to appear in the bank statement. |
Alphanumeric | 140 | |
executionDate As soon as possible if null . |
A date, formatted to ISO 8601 standard E.g. 2016-11-03T00:00:00.000+0100 | 28 |
You can retrieve the payment once the order is closed.completed
using the get-payment relation:
// The order
$order = $hapiClient->sendFollow($follow);
$orderReference = $order->getState()['reference'];
// The payment created
$rel = new Hal\CustomRel('https://api.slimpay.net/alps#get-payment');
$follow = new Http\Follow($rel);
$payment = $hapiClient->sendFollow($follow, $order);
And that’s it, you’ve added a first payment to the Checkout! To complete the process, just follow steps 2 and 3 from the direct debit or SlimCollect guides!