okaruto/cryptonator

Cryptonator Merchant API

v2.0.0 2021-04-10 06:03 UTC

This package is auto-updated.

Last update: 2024-04-10 13:01:24 UTC


README

Okaruto/Cryptonator is an alternative implementation of the Cryptonator.com Merchant API SDK. All API methods needed to use the Payment API are implemented.

Minimum PHP Version Build Status Coverage Status

Installation

Just require it with composer:

composer require okaruto/cryptonator

Usage

To get the MerchantApi instance:

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

Following methods are available:

Get a list of your invoices

$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

Get a single invoice (only partial details)

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

Create a new invoice (all details)

$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

Create an URL to redirect the customer for payment over cryptonator checkout page

$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

Create an invoice out of a HTTP notification

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

License

Okaruto/Cryptonator is licensed under the MIT license.