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 card 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.
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 or cardAlias ], [ '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.
|Alphanumeric without special characters||35|
Label to appear in the bank statement.
As soon as possible if
|A date, formatted to ISO 8601 standard|
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);