PHP code example of paywant / php-sdk

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

    

paywant / php-sdk example snippets






use Paywant\Config;
use Paywant\Model\Buyer;
use Paywant\Store\Create;

$config = new Config();
$config->setAPIKey('TEST'); // API KEY
$config->setSecretKey('TEST'); // API SECRET
$config->setServiceBaseUrl('https://secure.paywant.com');

// create request object with config
$request = new Create($config);

// buyer info.
$buyer = new Buyer();

$buyer->setUserAccountName('username');
$buyer->setUserEmail('[email protected]');
$buyer->setUserID('1');

// set objects to Request
$request->setBuyer($buyer);

if ($request->execute())
{ // execute request
    try
    {
        echo $request->getResponse(); // json 
    }
    catch (Exception $ex)
    {
        echo $ex->getMessage();
    }
}
else
{
    echo $request->getError(); // got a error
}

bash
composer