Skip to content

paywant/php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paywant/php-sdk

Latest Stable Version Build Status

To use this library, you must have an approved Paywant merchant account and store. You can access Paywant at https://www.paywant.com.

The document for this service is at https://developer.paywant.com

Requirement

PHP 5.6 and above. Curl

Install

Composer

Execute this command to use via Composer :

composer require paywant/php-sdk

Call composer autoload file for define:

require_once('vendor/autoload.php');

Composer Olmadan

If you don't want to use Composer, you can download the latest version of sdk from latest release.

To use, it will be sufficient to include the Bootstrap.php file in the folder you downloaded to your project.

require_once('/path/to/php-sdk/Bootstrap.php');

Example

Usage for Create Store Url

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
}

To create a direct payment screen, you can check the example here.

For IPN you can check the example here.