HoltPay REST API, v1
Create invoices from your server, send customers to the hosted checkout page, and receive a signed webhook when an invoice is paid.
Authentication
Every request needs an API key in the Authorization header. Create keys in the dashboard under API keys. A key is shown once when it is created.
Authorization: Bearer hp_...
- Keep keys on your server. Never put one in a web page or app.
- Revoke a key in the dashboard if it is exposed.
- The same key creates live and test invoices. The
networkfield decides which. See Testing.
Errors always have this shape, with a matching HTTP status:
{ "error": { "code": "invalid_amount", "message": "amount must be between ..." } }
Create an invoice
Creates an invoice payable to the wallet address saved in your settings and returns a link to the hosted checkout page. Live invoices need a wallet address and a Telegram username in your dashboard settings; customers see the username at checkout so they can contact you about a payment.
| Field | Type | Description |
|---|---|---|
| amount | string | Amount to charge, for example "149.00". From 0.01 to 1000000, at most 2 decimals. Required. |
| currency | string | USDT or USDC. Required. |
| network | string | ethereum, bsc, polygon, arbitrum, base, tron, ton, solana or test. Tron and TON support USDT only; Base supports USDC only. Required. |
| order_id | string | Your own reference for the order, up to 128 characters. |
| description | string | Text describing the purchase. Shown to the customer. |
| redirect_url | string | Where the "Return to merchant" button leads after payment. |
| expires_in_minutes | number | How long the invoice stays payable, 5 to 1440. Default 30. |
| metadata | object | Any JSON object. Returned to you unchanged. |
curl https://your-holtpay-host/v1/invoices \
-H "Authorization: Bearer hp_..." \
-H "Content-Type: application/json" \
-d '{
"amount": "149.00",
"currency": "USDT",
"network": "tron",
"order_id": "ORD-1042",
"description": "Order 1042"
}'
{
"id": "inv_3f9a1c0b7d2e4a6f8b1c2d3e",
"status": "pending",
"test": false,
"amount": "149.00",
"pay_amount": "149.0001",
"currency": "USDT",
"network": "tron",
"order_id": "ORD-1042",
"address": "TQ5vNc8kYx3LrW2dHs9BfJ7mPuA4eZg6Rt",
"checkout_url": "https://your-holtpay-host/pay/inv_3f9a...",
"expires_at": "2026-11-27T15:55:00.000Z"
}
Redirect the customer to checkout_url. The page shows the amount, address, QR code and time left.
pay_amount is slightly higher than amount. All your payments arrive at one wallet address, so each invoice asks for a unique amount (a few ten-thousandths more, never above 0.05) to tell payments apart. The customer must send exactly pay_amount, in the invoice's currency and on its network. A different amount, currency or network is not matched to any invoice.
- Limits: 120 new invoices a minute and 2,000 unpaid invoices at once per merchant. Beyond that the API answers
429. - A payment that arrives after the invoice has expired is not matched automatically. It still reaches your wallet, and is listed in the dashboard so you can settle the invoice by hand. See Wrong amounts.
- After the free trial, live invoices need an active plan. Without one the API answers
402with the codesubscription_required. Test invoices always work.
Other endpoints
Retrieve an invoice
Returns one invoice with its current status.
List invoices
Returns your invoices, newest first. Optional filters: status, order_id, limit (up to 100) and before (an ISO time).
List networks
Returns the networks and currencies available. No API key needed.
Invoice statuses
| Status | Meaning |
|---|---|
| pending | Waiting for the customer to pay. |
| confirming | A matching transfer was detected and is being confirmed by the network. |
| paid | The payment is confirmed in your wallet. |
| expired | No payment arrived before the invoice expired. |
How a paid invoice was settled
| Field | Meaning |
|---|---|
| settled_by | chain: the exact amount arrived. tolerance: a slightly different amount arrived, within the tolerance you set. merchant or admin: settled by hand in the dashboard. null while unpaid. |
| paid_amount | What actually arrived, for example "148.20". null when you marked the invoice paid without a detected transfer. |
| payment_link_id | The payment link the invoice came from, if any. |
Webhooks
Set your endpoint URL in the dashboard under Webhooks. HoltPay sends a POST request with a JSON body for invoice.confirming, invoice.paid and invoice.expired.
{
"id": "evt_5b1e...",
"event": "invoice.paid",
"created_at": "2026-11-27T15:41:13.000Z",
"data": {
"id": "inv_3f9a1c0b7d2e4a6f8b1c2d3e",
"status": "paid",
"test": false,
"order_id": "ORD-1042",
"amount": "149.00",
"pay_amount": "149.0001",
"currency": "USDT",
"network": "tron",
"tx_hash": "9f3c...a81e"
}
}
data is the full invoice, in the same shape the API returns.
Verify the signature
Each request carries an X-HoltPay-Signature: t=<unix time>,v1=<hex> header. v1 is an HMAC-SHA256 of <t>.<raw request body>, keyed with your signing secret. Compute the same value on your server and compare before trusting the payload.
const crypto = require('crypto');
function isValid(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const expected = crypto
.createHmac('sha256', secret)
.update(parts.t + '.' + rawBody)
.digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
return fresh && parts.v1.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
}
- Respond with a 2xx status within 10 seconds. Otherwise the call is retried after 30 seconds, 2 minutes, 10 minutes, 1 hour and 6 hours.
- The same event can arrive more than once. Make your handler safe to repeat by checking the invoice ID.
- Deliver goods only on
invoice.paid. - Recent deliveries and their responses are listed in the dashboard.
- If you rotate the signing secret, the old secret stops working immediately.
Wrong amounts, late and wrong-network payments
Customers sometimes send a little less (an exchange took its fee out of the amount), pay after the invoice expired, or use another network. These payments still reach your wallet. HoltPay keeps watching your wallet for a day after your last invoice closed, and lists such payments in the dashboard under Payments to check. You also get an email.
- Choose the invoice a payment was for, and the invoice becomes paid with
settled_by: "merchant". Your endpoint gets the usualinvoice.paidwebhook. A transfer can settle only one invoice. - For an invoice you can see was paid but that HoltPay did not list (for example, days later), use Mark as paid on the invoice.
- In Settings you can accept amounts up to 0.5%, 1%, 2%, 3% or 5% away from the invoice. Such a payment settles the invoice automatically with
settled_by: "tolerance", unless the amount is close to another open or recently closed invoice too. Then it is listed for you to decide.
Payment links
No server needed. In the dashboard, under Payment links, create a link with a title and an amount, and share it (for example in a Telegram chat). The customer opens it, picks a network and currency, and gets a normal invoice. Its metadata.payment_link and payment_link_id say which link it came from, and webhooks work as for any invoice.
Code libraries
Single-file clients with no dependencies. They create and fetch invoices and verify webhook signatures.
- Node.js 18+: holtpay.mjs (TypeScript types: holtpay.d.mts)
- PHP 7.4+: HoltPay.php
import { HoltPay } from './holtpay.mjs';
const holtpay = new HoltPay({ apiKey: process.env.HOLTPAY_API_KEY, baseUrl: 'https://your-holtpay-host' });
const invoice = await holtpay.createInvoice({ amount: '25.00', currency: 'USDT', network: 'tron', order_id: '1042' });
// redirect the customer to invoice.checkout_url
// In your webhook handler, with the raw request body:
const event = HoltPay.verifyWebhook(rawBody, req.headers['x-holtpay-signature'], process.env.HOLTPAY_WEBHOOK_SECRET);
if (event.event === 'invoice.paid') { /* mark the order paid */ }
Testing
The test network has no blockchain behind it, so you can try the whole integration without real money or a wallet.
- Create an invoice with
"network": "test", or switch the dashboard to Test and use Create invoice. - Its checkout page is marked "Test invoice. Do not send real funds."
- Mark it paid with the request below, or with Simulate payment in the dashboard. Your endpoint receives the same webhooks, with
"test": true.
Test and live data are separate. Test invoices never appear in live totals. In production, ignore webhooks where data.test is true.