PHP code example of cryptonator / merchant-php-sdk

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

    

cryptonator / merchant-php-sdk example snippets


     

    use cryptonator\MerchantAPI;

    $cryptonator = new MerchantAPI(merchant_id, secret);
    

    // 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);