PHP 5.3 or above
- Add
"cryptonator/merchant-php-sdk": "dev-master"
tocomposer.json
of your application or clone repo to your project. - If you are using composer use
require_once 'vendor/autoload.php';
otherwise paste the following linerequire_once '/path/to/cloned/repo/lib/MerchantAPI.php';
Using Cryptonator MerchantAPI SDK requires the following steps
-
Paste the following code. Note: constants
merchant_id
andsecret
you will find in your account settings once you have set up a merchant account with Cryptonator.use cryptonator\MerchantAPI; $cryptonator = new MerchantAPI(merchant_id, secret);
-
Now you can use Cryptonator MerchantAPI.
// 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);