SlimPay Developer Center

  • Web API
  • File API
  • Resources
  • Overview
  • Guides
  • Reference
  • Browser
  • Clients
 
30 Minutes Integration
  • Easy step-by-step
Getting Started
  • Choosing the right HTTP client
  • Get an access token
  • Retrieve the URLs
  • Where to go next?
Checkout
  • Setting Up Direct Debits
  • Setting Up Card Payments
  • Add a First Payment
  • Add a Document Signature
  • Update the Payment Method
Payments
  • Collect Payments by Direct Debit
  • Collect Payments by Card
  • Handle Payment Issues
  • Refund Payments
Migration
  • Import an Existing Mandate
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.

  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
    
    <?php
    // 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',
            'yourAppID',
            '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'
                ]
            ]
        ]
    ]
    ));
    $res = $hapiClient->sendFollow($follow);
    $url = $res->getLink('https://api.slimpay.net/alps#user-approval')->getHref();
    header('Location:' . $url);
    exit;
    ?>
    
    <?php
    // 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',
            'yourAppID',
            '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
                    ]
                ]
            ]
        ]
    ]
    ));
    $res = $hapiClient->sendFollow($follow);
    $url = $res->getLink('https://api.slimpay.net/alps#user-approval')->getHref();
    header('Location:' . $url);
    exit;
    ?>
  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
  • Web API
    • Overview
    • Guides
    • Reference
    • Browser
    • Clients
  • File API
    • Overview
    • Checkout
    • Payments
    • Payments Issues
    • Account Reporting
  • Resources
    • FAQ
    • IBANs
    • Payment Issues