PHP code example of popcornphp / fondy

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

    

popcornphp / fondy example snippets




opcornPHP\Fondy\Client;

define('HOST', $_SERVER['HTTP_HOST']);
define('MERCHANT_ID', 1396424);
define('MERCHANT_PASSWORD', 'test');
define('GATEWAY', 'api.fondy.eu');
define('ORDER_ID', 'test_order_' . rand(0, 10000));

$client = new Client(MERCHANT_ID, MERCHANT_PASSWORD, GATEWAY);



use PopcornPHP\Fondy\Api;

$api = new Api($client);

$data = $api->call('checkout', array(
    'order_id' => ORDER_ID,
    'order_desc' => 'Short Order Description',
    'currency' => $api::UAH,
    'amount' => 20 * 100, // 20 UAH
    'response_url' => sprintf('http://%s/response.php?order_id=%s', HOST, ORDER_ID),
    'server_callback_url' => sprintf('http://%s/callback.php', HOST),
))->getResponse();

$data = $api->call('checkout',array());

$data = $api->call('pcidss',array());

$data = $api->call('recurring',array());

$data = $api->call('reports',array());

$data = $api->call('reverse',array());

$data = $api->call('status',array());

$data = $api->call('verification',array());

$data = $api->call('capture',array());

$data = $api->call('p2pcredit',array());