The Payout PHP library for API client.
- Card payments
- Bank transfers
- Multi-language (english, slovak, czech)
- Multi-currency
- PHP 5.5 or later
- cUrl extension enabled
- Payout account
Download the latest release, unpack the ZIP file and upload
Payout
directory to your project library folder. Then include the init.php
file.
require_once('/path-to-your-system-library/Payout/init.php');
All the examples below assume the Bigcommerce\Api\Client class is imported into the scope with the following namespace declaration:
use Payout\Client;
Configure Payout API Client and initialize PHP object.
$config = array(
'client_id' => 'a3f30b76-5b01-4250-9718-96d933bf91c9',
'client_secret' => '4e6fiCXTzuNwUhYjecEEOa94Ne3_zRItqUNqcJr1kMaWVsRuB7rs_nscT7HDN7be',
'sandbox' => true
);
$payout = new Client($config);
You can print library version to test the installation.
echo $payout->getLibraryVersion();
Prepare array with checkout data and pass it to the createCheckout()
method. Response from
API POST Create checkout
is returned as PHP object.
$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);
Simple usage looks like:
<?php
// Load Payout API Client PHP Library
require_once('system/library/Payout/init.php');
// Namespace
use Payout\Client;
try {
// 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();
}
Output of example above looks like:
1.0.1
stdClass Object
(
[amount] => 68350
[checkout_url] => https://sandbox.payout.one/checkouts/2rZz6v4Xjogmq3xMELLbR5dBnyxwkJaW
[currency] => EUR
[customer] => stdClass Object
(
[email] => [email protected]
[first_name] => John
[last_name] => Doe
)
[external_id] => 20190001
[id] => 476661
[idempotency_key] =>
[metadata] =>
[nonce] => dmc0OUljd08yUmhycldkUQ
[object] => checkout
[payment] =>
[redirect_url] => https://payout.one/payment/redirect
[signature] => 56e5469cb716c224c765359e1178667f8c652c76973aee61f03fa691cfe60484
[status] => processing
)
Stable version: 1.0.1
See the CHANGELOG.md file for list off all changes.
- Tested with PHP 5.5
The Payout API documentation.
This open-source software is licensed under the MIT License - see the LICENSE file for details.
Copyright © 2019 Payout, s.r.o.