PHP code example of vload / merchant-connector

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

    

vload / merchant-connector example snippets


MerchantConnector {
    public __construct(\Vload\Common\Api\Config $config)
    public validate(string $pin)
    public charge(string $orderId, string $pin, \Vload\MerchantConnector\VO\Customer $customer [, string $description)
}

$secret = 'vload_secret_key'; //Merchant secret key provided by VLoad
$config = \Vload\Common\Api\Config::init($secret);
$connector = new MerchantConnector($config);

$pin = '3156391887289068';
$voucher = $connector->validate($pin);

$orderId = '12345678';
$pin = '3156391887289068';
$customer = new \Vload\Common\VO\Customer(...);
$description = 'Test redeem';
$charge = $connetor->charge($orderId, $pin, $customer, $description);

$chargeId = 'AWT_fCCMh9GTrU2CKeaeXw==';
$charge = $connector->retrieveCharge($chargeId);