SDK Libraries
PHP SDK
Install the official MakePay PHP SDK for payment links, settings, and webhook verification.
MakePay PHP SDK
Overview
The MakePay PHP SDK is a lightweight Composer library for server-side MakePay integrations. It wraps API-key authentication, payment-link operations, MakePay settings, and signed webhook verification.
Public source repository:
https://github.com/CHASH-HOSTING/makepay-php-sdk
Installation
Install with Composer through the public Git repository:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/CHASH-HOSTING/makepay-php-sdk"
}
],
"require": {
"makepay/makepay-php": "^0.1"
}
}
Then run:
composer update makepay/makepay-php
Authentication
Create a MakePay API key from the MakeCrypto merchant developer area and keep the secret in server-side environment variables only.
use MakePay\Client;
$makepay = new Client([
'keyId' => getenv('MAKEPAY_KEY_ID'),
'keySecret' => getenv('MAKEPAY_KEY_SECRET'),
// Optional: override only when MakePay gives you a custom checkout origin.
'checkoutBaseUrl' => 'https://makepay.io',
]);
The SDK sends X-MakeCrypto-Key-Id and X-MakeCrypto-Key-Secret headers to
the MakePay partner API.
Create Payment Link
$response = $makepay->createPaymentLink([
'title' => 'Order #1042',
'description' => 'Checkout for order #1042',
'amount' => '129.99',
'currency' => 'USDT',
'orderId' => 'order_1042',
'customerEmail' => 'buyer@example.com',
'returnUrl' => 'https://merchant.example/orders/1042',
'successUrl' => 'https://merchant.example/orders/1042/success',
'failureUrl' => 'https://merchant.example/orders/1042/pay',
'expirationTime' => '12h',
]);
header('Location: ' . $response['paymentLink']['publicUrl']);
Pass sendPaymentRequestEmail when you want MakePay to email the customer as
part of creation:
$makepay->createPaymentLink($payload, [
'sendPaymentRequestEmail' => true,
]);
Embedded Checkout
PHP backends can generate hosted links, embedded iframe URLs, and HTML snippets after creating a payment link.
$paymentUid = $response['paymentLink']['uid'];
$hostedUrl = $makepay->hostedCheckoutUrl($paymentUid);
$embedUrl = $makepay->embeddedCheckoutUrl($paymentUid, [
'parentOrigin' => 'https://merchant.example',
]);
echo $makepay->embedButtonHtml($paymentUid, [
'buttonLabel' => 'Pay with crypto',
]);
echo $makepay->iframeHtml($paymentUid, [
'iframeTitle' => 'Secure MakePay checkout',
]);
Use a hosted link fallback beside every iframe so shoppers can continue if the browser, CMS, or store theme blocks embedded payment pages.
Read And Update Links
$links = $makepay->listPaymentLinks();
$detail = $makepay->getPaymentLink('PAYMENT_LINK_UID');
$makepay->updatePaymentLink('PAYMENT_LINK_UID', [
'status' => 'paused',
]);
$makepay->sendPaymentRequestEmail(
'PAYMENT_LINK_UID',
'buyer@example.com'
);
Settings
$settings = $makepay->getSettings();
$makepay->updateSettings([
'callbackUrl' => 'https://merchant.example/webhooks/makepay',
]);
Webhook Verification
MakePay signs the exact raw request body. Read php://input before parsing
JSON.
use MakePay\Webhook;
$rawBody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_MAKEPAY_SIGNATURE'] ?? null;
$event = Webhook::parse(
$rawBody,
$signature,
getenv('MAKEPAY_WEBHOOK_SECRET')
);
if (($event['event']['type'] ?? '') === 'status_changed') {
// Update the local order.
}
http_response_code(200);
echo 'ok';
Error Handling
API errors throw MakePay\MakePayException. The exception includes the HTTP
status code and decoded response body.
use MakePay\MakePayException;
try {
$makepay->getPaymentLink('PAYMENT_LINK_UID');
} catch (MakePayException $error) {
error_log($error->getMessage());
error_log((string) $error->getStatusCode());
}
Source Layout
The canonical monorepo source lives in apps/plugins/php-sdk. The public
repository mirrors only the SDK files so developers can install or inspect it
without the full MakeCrypto workspace.