Crypto Payment Gateway Integration (CoinGate/NOWPayments/BitPay)

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    848
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Cryptocurrency Payment Gateway Integration (CoinGate/NOWPayments/BitPay)

CoinGate, NOWPayments, BitPay are crypto payment aggregators. Accept 50–300 cryptocurrencies, convert at current rate and pay seller in fiat or crypto on schedule. Seller doesn't need private keys, wait blockchain confirmations or track exchange — aggregator handles it.

Integration takes 1–3 working days.

Provider Comparison

NOWPayments — largest coin list (300+), has sandbox, well-documented API. Commission 0.5%. Works with individuals.

CoinGate — verified provider since 2014, good reputation, strict business verification. Commission 1%.

BitPay — oriented for large business, minimum volume for commercial plan, high KYB requirements.

NOWPayments: Creating Payment

use GuzzleHttp\Client;

class NOWPaymentsClient
{
    private Client $http;
    private string $apiKey;

    public function __construct(string $apiKey, bool $sandbox = false)
    {
        $this->apiKey = $apiKey;
        $baseUri = $sandbox
            ? 'https://api-sandbox.nowpayments.io/v1/'
            : 'https://api.nowpayments.io/v1/';

        $this->http = new Client([
            'base_uri' => $baseUri,
            'headers'  => ['x-api-key' => $apiKey],
        ]);
    }

    public function createPayment(array $params): array
    {
        $response = $this->http->post('payment', ['json' => $params]);
        return json_decode($response->getBody()->getContents(), true);
    }

    public function getMinAmount(string $currency, string $fiatCurrency = 'usd'): float
    {
        $response = $this->http->get("min-amount?currency_from={$currency}&currency_to={$fiatCurrency}");
        return json_decode($response->getBody()->getContents(), true)['min_amount'];
    }
}

// Create payment
$client  = new NOWPaymentsClient(env('NOWPAYMENTS_API_KEY'), app()->isLocal());
$payment = $client->createPayment([
    'price_amount'     => $order->total,
    'price_currency'   => 'usd',
    'pay_currency'     => 'btc', // or 'eth', 'usdttrc20', etc.
    'order_id'         => (string) $order->id,
    'order_description'=> 'Order #' . $order->id,
    'ipn_callback_url' => route('payments.nowpayments.webhook'),
    'success_url'      => route('orders.success', $order),
    'cancel_url'       => route('checkout'),
]);

Redirect customer to $payment['invoice_url']. NOWPayments shows coin selection page and QR code with payment address.

CoinGate: API

$payment = $coingate->order->create([
    'order_id'         => $order->id,
    'price_amount'     => $order->total,
    'price_currency'   => 'EUR',
    'receive_currency' => 'EUR', // receive in euro, not crypto
    'title'            => 'Order #' . $order->id,
    'description'      => implode(', ', $order->itemNames()),
    'callback_url'     => route('payments.coingate.webhook'),
    'success_url'      => route('orders.success', $order),
    'cancel_url'       => route('checkout'),
    'token'            => $order->token, // unique token for security
]);
// Redirect to $payment->payment_url

Webhook Handling — NOWPayments

NOWPayments sends IPN (Instant Payment Notification) to ipn_callback_url:

public function handleNowPaymentsWebhook(Request $request): Response
{
    $raw       = $request->getContent();
    $signature = $request->header('x-nowpayments-sig');

    // Signature verification
    $sorted = json_encode(
        collect(json_decode($raw, true))->sortKeys()->all(),
        JSON_UNESCAPED_UNICODE
    );
    $expected = hash_hmac('sha512', $sorted, config('services.nowpayments.ipn_secret'));

    if (!hash_equals($expected, $signature)) {
        return response('Forbidden', 403);
    }

    $data  = json_decode($raw, true);
    $order = Order::find($data['order_id']);

    $statusMap = [
        'waiting'          => 'pending',
        'confirming'       => 'pending',
        'confirmed'        => 'paid',
        'sending'          => 'paid',
        'partially_paid'   => 'partially_paid',
        'finished'         => 'paid',
        'failed'           => 'failed',
        'refunded'         => 'refunded',
        'expired'          => 'expired',
    ];

    $order->update(['payment_status' => $statusMap[$data['payment_status']] ?? 'unknown']);

    if ($data['payment_status'] === 'finished') {
        $order->markAsPaid($data['payment_id']);
        event(new OrderPaid($order));
    }

    return response('OK', 200);
}

Webhook — CoinGate

CoinGate sends form-encoded POST with token field for verification:

public function handleCoingateWebhook(Request $request): Response
{
    $token   = $request->input('token');
    $orderId = $request->input('order_id');
    $status  = $request->input('status');

    $order = Order::find($orderId);
    if (!$order || $order->payment_token !== $token) {
        return response('Forbidden', 403);
    }

    match ($status) {
        'paid'      => $order->markAsPaid($request->input('id')),
        'canceled'  => $order->update(['payment_status' => 'cancelled']),
        'expired'   => $order->update(['payment_status' => 'expired']),
        default     => null,
    };

    return response('OK', 200);
}

Customer Cryptocurrency Selection

Most aggregators show their own coin selection page. For custom selection on your site — create invoice for each coin or get supported coins list via API and create invoice only on selection:

// NOWPayments: get coin list
$currencies = $client->getAvailableCurrencies();
// Show dropdown to user
// On selection — create payment with chosen pay_currency

Partial Payments

NOWPayments supports partially_paid status — user paid less than required. Standard scenario: notify user and offer to pay difference or refund. Automatic refund via NOWPayments API — available via refunds endpoint, but only in crypto.