MercanPay Integrations
PHP

PHP SDK

The official PHP 8+ library: invoices, payouts and webhook signature checks in one class.

AvailableSDKPHP 8ComposerLaravelWebhook

Installation

With Composer (recommended):

composer require mercanpay/mercanpay-php

Without Composer, download the zip, copy the src/ folder into your project and require the two files. Only ext-curl and ext-json are needed.

Creating an invoice

use MercanPay\MercanPay;

$zp = new MercanPay('https://mercanpay.com', getenv('MERCANPAY_API_KEY'));

// USD-priced invoice: the customer picks the coin on the payment page
$invoice = $zp->createUsdInvoice('25', [
    'order_id'     => 'order-1001',
    'callback_url' => 'https://shop.example/mercanpay-webhook.php',
]);
header('Location: ' . $invoice['payment_url']);

Verifying webhooks

$body = file_get_contents('php://input');
if (!MercanPay::verifyWebhook(getenv('MERCANPAY_WEBHOOK_SECRET'), $body, $_SERVER['HTTP_X_MERCANPAY_SIGNATURE'] ?? '')) {
    http_response_code(401);
    exit;
}
$event = json_decode($body, true);
if ($event['type'] === 'invoice.paid') {
    // mark the order as paid (the same event can arrive more than once)
}

Payouts

$w = $zp->createWithdrawal('USDT', '10', 'T...', 'payout-2026-001');
echo $w['status']; // queued -> processing -> completed

The API key needs the withdrawals scope and the address must be saved for code-free payouts in the panel. See the documentation for every endpoint.

You may also like

SDKPy

Python SDK Available

The official Python library: add crypto payments to Django, Flask or FastAPI in a few lines.

Python 3pipDjangoFlask
Detailsv1.0.0
PluginWoo

WooCommerce plugin Available

Add USDT and TRX as a payment method to your WooCommerce store; orders update automatically when the payment is confirmed.

WordPressWooCommerceHPOSBlocks
Detailsv1.0.0Download
PluginW

WordPress payment & donation buttons Available

Put a payment or donation button, card or QR code on any WordPress page, no WooCommerce needed.

WordPressBağışGutenbergShortcode
Detailsv1.0.0Download

Start accepting crypto payments in minutes

Accept USDT and TRX (TRC20). Fees from 0.4%, a hosted payment page, API and webhooks.