PHP code example of fintecture / fintecture-sdk-php

1. Go to this page and download the library: Download fintecture/fintecture-sdk-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fintecture / fintecture-sdk-php example snippets




$state = '<my-uniq-id-for-the-payment>'; // it's my transaction ID, I have to generate it myself, it will be sent back in the callback
$pisClient = new \Fintecture\PisClient([
    'appId' => 'app_id',
    'appSecret' => 'app_secret',
    'privateKey' => 'private_key', // could be a file path or the private key itself
    'environment' => 'sandbox' // or 'production'
]);

$pisToken = $pisClient->token->generate();
if (!$pisToken->error) {
    $pisClient->setAccessToken($pisToken); // set token of PIS client
} else {
    echo $pisToken->errorMsg;
}

$payload = [
    'meta' => [
        // Info of the buyer
        'psu_name' => 'M. John Doe',
        'psu_email' => '[email protected]',
        'psu_address' => [
            'street' => '5 Void Street',
            'zip' => '12345',
            'city' => 'Gotham',
            'country' => 'FR'
        ]
    ],
    'data' => [
        'type' => 'SEPA',
        'attributes' => [
            'amount' => '550.60',
            'currency' => 'EUR',
            'communication' => 'Commande N°15654'
        ]
    ]
];

$connect = $pisClient->connect->generate($payload, $state);
if (!$connect->error) {
    $pisClient->redirect($connect->meta->url);
} else {
    echo $connect->errorMsg;
}

use Fintecture\PisClient;
use Symfony\Component\HttpClient\Psr18Client;

$pisClient = new PisClient([$config], new Psr18Client());
bash
composer 
bash
composer