Wallogit.com
2017 © Pedro Peláez
Cryptonator.com Merchant API SDK for PHP
PHP 5.3 or above, (*1)
"cryptonator/merchant-php-sdk": "dev-master" to composer.json of your application or clone repo to your project.require_once 'vendor/autoload.php'; otherwise paste the following line
php
require_once '/path/to/cloned/repo/lib/MerchantAPI.php';
Using Cryptonator MerchantAPI SDK requires the following steps, (*2)
Paste the following code.
Note: constants merchant_id and secret you will find in your account settings once you have set up a merchant account with Cryptonator., (*3)
use cryptonator\MerchantAPI; $cryptonator = new MerchantAPI(merchant_id, secret);
Now you can use Cryptonator MerchantAPI., (*4)
// start payment
$url = $cryptonator->startPayment(array(
'item_name' => 'Item Name',
//'order_id' => 'Order ID',
//'item_description' => 'Item Description',
'invoice_amount' => 'Invoice Amount',
'invoice_currency' => 'Invoice Currency',
//'success_url' => 'Success URL',
//'failed_url' => 'Failed URL',
//'language' => 'Language',
));
// create invoice
$invoice = $cryptonator->createInvoice(array(
'item_name' => 'Item Name',
//'order_id' => 'Order ID',
//'item_description' => 'Item Description',
'checkout_currency' => 'Checkout Amount',
'invoice_amount' => 'Invoice Amount',
'invoice_currency' => 'Invoice Currency',
//'success_url' => 'Success URL',
//'failed_url' => 'Failed URL',
//'language' => 'Language',
));
// get invoice
$invoice = $cryptonator->getInvoice('InvoiceID');
// list invoices
$invoices = $cryptonator->listInvoices(array(
//'invoice_status' => 'Invoice Status',
//'invoice_currency' => 'Invoice Currency',
//'checkout_currency' => 'Checkout Currency',
));
// check annswer
$check_server = $cryptonator->checkAnswer($_POST);