PHP code example of okaruto / cryptonator

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

    

okaruto / cryptonator example snippets


$merchantApi = new Okaruto\Cryptonator\MerchantApi(
    new GuzzleHttp\Client(), // Guzzle HTTP client instance
    'merchant id',           // Cryptonator merchant id
    'merchant secret'        // Cryptonator merchant secret 
);

$merchantApi->listInvoices(
    ?string $invoiceStatus,   // Filter by invoice status, @see Okaruto\Cryptonator\Values\InvoiceStatusValue
    ?string $invoiceCurrency, // Filter by invoice currency, @see Okaruto\Cryptonator\Values\InvoiceCurrencyValue
    ?string $checkoutCurrency // Filter by cryptocurrency, @see Okaruto\Cryptonator\Values\CheckoutCurrencyValue
): InvoiceCollection

$merchantApi->getInvoice(
    string $invoiceId // Cryptonator invoice id
): Invoice

$merchantApi->createInvoice(
    string $itemName,            // Your item name
    string $checkoutCurrency,    // Checkout cryptocurrency, @see Okaruto\Cryptonator\Values\CheckoutCurrencyValue
    float $invoiceAmount,        // Invoice amount
    string $invoiceCurrency,     // Invoice currency, @see Okaruto\Cryptonator\Values\InvoiceCurrencyValue
    ?string $orderId,            // Your order id
    ?string $itemDescription,    // Item description
    ?string $successUrl,         // Success URL to redirect user
    ?string $failedUrl,          // Failure URL to redirect user
    ?string $confirmationPolicy, // Confirmation policy, @see Okaruto\Cryptonator\Values\ConfirmationPolicyValue
    ?string $language            // Checkout language, @see Okaruto\Cryptonator\Values\LanguageValue 
): Invoice

$merchantApi->startPayment(
    string $itemName,         // Your item name
    float $invoiceAmount,     // Invoice amount
    string $invoiceCurrency,  // Invoice currency, @see Okaruto\Cryptonator\Values\InvoiceCurrencyValue
    ?string $orderId,         // Your order id
    ?string $itemDescription, // Item description
    ?string $successUrl,      // Success URL to redirect user
    ?string $failedUrl,       // Failure URL to redirect user
    ?string $language         // Checkout language, @see Okaruto\Cryptonator\Values\LanguageValue 
): string

$merchantApi->httpNotificationInvoice(
    array $data // Post values of HTTP Notification
): string