SlimPay Developer Center

  • REST API
  • File Transfer
  • Resources
  • Overview
  • Use Case Guides
  • Reference
  • Browser
  • HTTP Clients
 
30 Minutes Integration
  • Enroll a customer in minutes!
Getting Started
  • Choosing the right HTTP client
  • Get an access token
  • Retrieving URLs
  • Where to next?
Enroll your customers
  • Checkout Integration Types
  • SlimPay Checkout
  • Checkout Api
  • Setting Up SlimCollect
  • Import an Existing Mandate
  • Add a Document Signature
Collect payments
  • Add a First Payment
  • Collect Payments by Direct Debit
Webhook
  • Configuration
  • Notification
  • Security
Monitor activity
  • Handle Payment Issues
  • Refund Payments
  • Update the Payment Method
switch langauge to english switch language to french switch language to spanish switch language to italian

Easy step-by-step

PREREQUISITE: Obtain your API credentials (5 mins to 10 mins)

  • Already a client? You should have received an email "API Credentials - Start integrating your solution now!"
  • Not yet a client? You can test SlimPay integration into your system by generating random API credentials here.

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.

  1. Download our official PHP client here and unzip the file (without any extra folder on top) (5 mins)
  2. Place the client folder onto your website HTTP server (5 mins)
  3. Create a new PHP page that will appear when you request the payment (5 mins)
  4. Example: Your page has a button "Sign" or "Pay". It redirects to a new page "slimpay.php"
  5. Insert the following code snippet in this new page (10 mins)
    Do not forget to update the credentials with your values in the below code
    // Instructions: https://github.com/SlimPay/hapiclient-php
    require_once 'vendor/autoload.php';
    
    use \HapiClient\Http;
    use \HapiClient\Hal;
    
    // The HAPI Client
    $hapiClient = new Http\HapiClient(
        'https://api.preprod.slimpay.com',
        '/',
        'https://api.slimpay.net/alps/v1',
        new Http\Auth\Oauth2BasicAuthentication(
            '/oauth/token',
            'yourAppName',
            'yourAppSecret'
        )
    );
    
    // The Relations Namespace
    $relNs = 'https://api.slimpay.net/alps#';
    
    // Follow create-orders
    $rel = new Hal\CustomRel($relNs . 'create-orders');
    $follow = new Http\Follow($rel, 'POST', null, new Http\JsonBody(
    [
        'started' => true,
        'creditor' => [
            'reference' => 'yourCreditorReference'
        ],
        'subscriber' => [
            'reference' => 'theSubscriberReference'
        ],
        'items' => [
            [
                'type' => 'signMandate',
                'autoGenReference' => true,
                'mandate' => [
                    'signatory' => [
                        'billingAddress' => [
                            'street1' => '27 rue des fleurs',
                            'street2' => 'Bat 2',
                            'city' => 'Paris',
                            'postalCode' => '75008',
                            'country' => 'FR'
                        ],
                        'honorificPrefix' => 'Mr',
                        'familyName' => 'Doe',
                        'givenName' => 'John',
                        'email' => 'change.me@slimpay.com',
                        'telephone' => '+33612345678'
                    ],
                    'standard' => 'SEPA'
                ]
            ]
        ]
    ]
    ));
    
    try {
        $res = $hapiClient->sendFollow($follow);
        $url = $res->getLink('https://api.slimpay.net/alps#user-approval')->getHref();
        header('Location:' . $url);
        exit;
    } catch (\HapiClient\Exception\HttpException $e) {
        $log = 'Error - ' . $e->getStatusCode() . ' ' . $e->getReasonPhrase() .
                ' - ' . $e->getResponseBody();
        echo $log;
    }
    // Instructions: https://github.com/SlimPay/hapiclient-php
    require_once 'vendor/autoload.php';
    
    use \HapiClient\Http;
    use \HapiClient\Hal;
    
    // The HAPI Client
    $hapiClient = new Http\HapiClient(
        'https://api.preprod.slimpay.com',
        '/',
        'https://api.slimpay.net/alps/v1',
        new Http\Auth\Oauth2BasicAuthentication(
            '/oauth/token',
            'yourAppName',
            'yourAppSecret'
        )
    );
    
    // The Relations Namespace
    $relNs = 'https://api.slimpay.net/alps#';
    
    // Follow create-orders
    $rel = new Hal\CustomRel($relNs . 'create-orders');
    $follow = new Http\Follow($rel, 'POST', null, new Http\JsonBody(
    [
        'started' => true,
        'creditor' => [
            'reference' => 'yourCreditorReference'
        ],
        'subscriber' => [
            'reference' => 'testphpclient01'
        ],
        'items' => [
            [
                'type' => 'signMandate',
                'autoGenReference' => true,
                'mandate' => [
                    'signatory' => [
                        'billingAddress' => [
                            'street1' => '27 rue des fleurs',
                            'street2' => 'Bat 2',
                            'city' => 'Paris',
                            'postalCode' => '75008',
                            'country' => 'FR'
                        ],
                        'honorificPrefix' => 'Mr',
                        'familyName' => 'Doe',
                        'givenName' => 'John',
                        'email' => 'change.me@slimpay.com',
                        'telephone' => '+33612345678'
                    ],
                    'standard' => 'SEPA'
                ],
                [
                    'type' => 'payment',
                    'action' => 'create',
                    'payin' =>[
                        'amount' => '29.99',
                        'scheme' => null,
                        'reference' => null,
                        'label' => 'First payment for your subscription',
                        'executionDate' => null
                    ]
                ]
            ]
        ]
    ]
    ));
    
    try {
        $res = $hapiClient->sendFollow($follow);
        $url = $res->getLink('https://api.slimpay.net/alps#user-approval')->getHref();
        header('Location:' . $url);
        exit;
    } catch (\HapiClient\Exception\HttpException $e) {
        $log = 'Error - ' . $e->getStatusCode() . ' ' . $e->getReasonPhrase() .
                ' - ' . $e->getResponseBody();
        echo $log;
    }
  6. Test the flow by accessing your website (5 mins)

Next Step

Now that SlimPay is integrated, you need to replace default values with your own values (example: firstName, givenName, address...).

Here is a sample:

'honorificPrefix' => $title,
     'familyName' => $family_name,
      'givenName' => $given_name,
          'email' => $client_email,

Ensure that the following attributes are always filled so that SlimPay can sign a mandate (and debit your client):

'Creditor {reference}'
'Subscriber {reference}'
'Street1'
'City'
'PostalCode'
'Country'
'HonoricPrefix'
'FamilyName'
'GivenName'
 
SlimPay
  • Developer Center
  • Help Center
  • Website
  • REST API
    • Overview
    • Guides
    • Reference
    • Browser
    • Clients
  • File Transfer
    • Overview
    • Checkout
    • Payments
    • Payments Issues
    • Account Reporting
  • Resources
    • FAQ
    • IBANs