PHP code example of blueweb / payout_one

1. Go to this page and download the library: Download blueweb/payout_one 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/ */

    

blueweb / payout_one example snippets




use Payout\Client;

$config = array(
        'client_id' => 'a3f30b76-5b01-4250-9718-96d933bf91c9',
        'client_secret' => '4e6fiCXTzuNwUhYjecEEOa94Ne3_zRItqUNqcJr1kMaWVsRuB7rs_nscT7HDN7be',
        'sandbox' => true
    );

$payout = new Client($config);

echo $payout->getLibraryVersion();

$checkout_data = array(
        'amount' => '683.50',
        'currency' => 'EUR',
        'customer' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => '[email protected]'
        ],
        'external_id' => '20190001',
        'redirect_url' => 'https://payout.one/payment/redirect'
    );

$response = $payout->createCheckout($checkout_data);
var_dump($response);


// Load Payout API Client PHP Library
 // Config Payout API
    $config = array(
        'client_id' => 'a3f30b76-5b01-4250-9718-96d933bf91c9',
        'client_secret' => '4e6fiCXTzuNwUhYjecEEOa94Ne3_zRItqUNqcJr1kMaWVsRuB7rs_nscT7HDN7be',
        'sandbox' => true
    );

    // Initialize Payout
    $payout = new Client($config);

    // Test installation
    echo $payout->getLibraryVersion();

    // Create checkout
    $checkout_data = array(
        'amount' => '683.50',
        'currency' => 'EUR',
        'customer' => [
            'first_name' => 'John',
            'last_name' => 'Doe',
            'email' => '[email protected]'
        ],
        'external_id' => '20190001',
        'redirect_url' => 'https://payout.one/payment/redirect'
    );

    $response = $payout->createCheckout($checkout_data);
    print_r($response);

    $checkout_details_response = $payout->getCheckout($response->{'id'});
    print_r($checkout_details_response);


} catch (Exception $e) {
    echo $e->getMessage();
}