PHP code example of rc4347 / yii2-paybox

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

    

rc4347 / yii2-paybox example snippets




class ExampleCredentials extends RC4347\Yii2Paybox\base\credentials\Credential
{
    public function getMerchantId(): string
    {
        return "XXXXXX";
    }

    public function getMerchantSecret(): string
    {
        return "XXXXXXXXXXXXXXXX";
    }

    public function getMerchantSecretPayout(): string
    {
        return "XXXXXXXXXXXXXXXX";
    }
}

use RC4347\Yii2Paybox\base\config\InitializationPageConfig;

$config = new InitializationPageConfig(1, 100, 'https://example.com/result');

use RC4347\Yii2Paybox\services\InitializationPageService;

$service = InitializationPageService($config, new ExampleCredentials());
$result = $service->run();
# get redirect url
$redirect_url = $service->getRedirectUrl($result);
return $redirect_url;