Soheil.fi
Soheil Pay

API reference

Create an invoice from your server, send the buyer to its payment page, and get a signed message when it is paid. The money goes from the buyer to your own wallet; this API never moves funds.

Quick start

  1. Sign in to the dashboard and add the address you want to be paid at on each network.
  2. Under Developers, create an API key and set your webhook address.
  3. Create an invoice and redirect the buyer to its url.
  4. When your webhook receives invoice.paid (after checking the signature), deliver the order.
curl
curl -X POST https://soheil.fi/api/pay/v1/invoices \
  -H "Authorization: Bearer sp_live_…" \
  -H "Content-Type: application/json" \
  -d '{"amountUsd":"25.00","description":"VPN, 1 month","orderId":"1042","redirectUrl":"https://your-shop.example/thanks"}'

Plugins

Two shop systems need no code: install the plugin, paste an API key, and Soheil Pay appears at checkout. Both use this same API.

Shop systemDownloadHow to install
WooCommerce (WordPress)soheil-pay-woocommerce.zipPlugins → Add new → Upload plugin, then WooCommerce → Settings → Payments.
WHMCSsoheil-pay-whmcs.zipUnzip into the WHMCS folder, then Setup → Payments → Payment gateways.

Authentication

Send your key as Authorization: Bearer sp_live_… over HTTPS, from your server only. A key can create, read and cancel invoices. It cannot change your addresses, webhook or keys: those need a signed-in browser. Errors are JSON, {"message": "…"}, with a 4xx status.

Create an invoice

POST/api/pay/v1/invoicesAPI key
amountUsdstringrequired
The price in US dollars, with at most two decimals. The buyer pays this amount in a one-dollar stablecoin. Leave it out when you price in another currency.
currencystring
A three-letter currency code (EUR, GBP, TRY, …) to price the invoice in, together with amount. The currencies available now are in GET /api/pay/v1/config under currencies.
amountstring
The price in currency, with at most two decimals. It is turned into US dollars once, at that moment's rate, and the invoice keeps both: amountUsd is what the buyer pays, price is what you asked.
descriptionstring
Shown to the buyer on the payment page. Up to 300 characters.
orderIdstring
Your own order number, up to 100 characters. Asking again with the same number answers the same invoice while it can still be paid or was paid, so a retry never bills twice. After that invoice ran out or was cancelled, the same number gets a new invoice.
redirectUrlstring
Where the payment page sends the buyer back to. Must start with https://.
expiresInMinutesnumber
How long the buyer has. From 5 minutes to 72 hours; one hour when left out.

The answer is the invoice:

Invoice
{
  "id": "inv_8Qm2…",
  "url": "https://soheil.fi/invoice/?id=inv_8Qm2…",
  "status": "open",          // open, underpaid, paid, overpaid, expired, cancelled
  "late": false,             // paid after it ran out
  "test": false,
  "amountUsd": "25.00",
  "description": "VPN, 1 month",
  "orderId": "1042",
  "redirectUrl": "https://your-shop.example/thanks",
  "createdAt": "2026-11-21T12:00:00Z",
  "expiresAt": "2026-11-21T13:00:00Z",
  "paidAt": null,
  "paidFrom": null,          // paid from another network: what the buyer sent, e.g. "ETH on Base"
  "payments": [],            // one entry per network and token the buyer opened
  "refundedUsd": "0",
  "refunds": []
}

An invoice priced in another currency also carries "price": { "currency": "EUR", "amount": "19.99", "usdPerUnit": "1.08" }; for a dollar invoice price is null. Rates are the European Central Bank's daily reference rates. When a currency has no fresh rate the request is refused with a 400 that lists the currencies you can use: a price is never guessed.

402 Payment RequiredYour prepaid fee balance has been below zero for longer than the grace time. Top it up in the dashboard; invoices already open still complete.

Read, list and cancel

GET/api/pay/v1/invoices/{id}API key
GET/api/pay/v1/invoices?status=paid&before=2026-11-21T00:00:00Z&limit=50API key
POST/api/pay/v1/invoices/{id}/cancelAPI key

The list is newest first; pass the createdAt of the last one as before for the next page (at most 100 a page). Only an open invoice that nothing was paid for can be cancelled.

Statuses

StatusMeaningWhat to do
openWaiting for the buyer.Nothing.
underpaidPart of the amount arrived.The page asks the buyer for the rest. Do not deliver yet.
paidThe whole amount arrived at your address.Deliver the order.
overpaidMore than the amount arrived.Deliver; the difference is in your wallet, settle it with the buyer.
expiredTime ran out with nothing paid in full.A payment arriving within a day still turns it paid, with late: true.
cancelledYou cancelled it.Nothing.

Webhooks

Set one HTTPS address in the dashboard. We POST a JSON message to it for invoice.paid, invoice.overpaid, invoice.underpaid, invoice.expired and invoice.refunded. Answer with any 2xx within 10 seconds. Otherwise we try again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 24 hours, and you can resend a message from the dashboard.

Message
{
  "type": "invoice.paid",
  "created": "2026-11-21T12:07:31Z",
  "invoice": { "id": "inv_8Qm2…", "status": "paid", "orderId": "1042", "amountUsd": "25.00", "test": false, "payments": [ … ] }
}

Every message carries Soheil-Signature: t=<unix seconds>,v1=<hex>, where v1 is the HMAC-SHA256 of t + "." + body with your webhook secret. Check it on the raw body before you trust a message, and refuse old timestamps:

import crypto from "node:crypto";

// rawBody: the request body exactly as received (a string), before any JSON parsing
function verify(rawBody, header, secret, toleranceSeconds = 300) {
  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)) <= toleranceSeconds;
  return fresh && expected.length === parts.v1.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
Deliver onceA message can arrive more than once. Key your delivery on the invoice id (or your orderId) and its status, and treat a repeat as done.

Refunds

A buyer's money is in your wallet, so a refund is a transfer you send yourself. Write it down so the invoice, your exports and your server know about it: we send invoice.refunded to your webhook, and the invoice shows refundedUsd and its refunds. Refunds of one invoice cannot add up to more than its amount. Each transaction of a payment carries from, the address it came from; ask the buyer before sending there, since an exchange's address may not credit them.

POST/api/pay/v1/invoices/{id}/refundsAPI key
amountUsdstringrequired
What you refunded, in US dollars.
transactionstring
The hash of your transfer, for your own records. It is not checked.
notestring
Up to 300 characters, for your own records.

Test mode

A test key (sp_test_…, created in the dashboard) makes test invoices. They look like real ones and their payment page says they are tests. Nobody pays them: you mark one paid from the dashboard or with the call below, and your webhook gets the same invoice.paid message, with "test": true. Test invoices cost no fee and count toward nothing. An order number names one test invoice and one real one, so the same shop database works in both modes.

POST/api/pay/v1/invoices/{id}/simulateAPI key
curl
curl -X POST https://soheil.fi/api/pay/v1/invoices/inv_8Qm2…/simulate -H "Authorization: Bearer sp_test_…"
Check the flagIn production, ignore messages whose invoice has "test": true, or keep a separate webhook secret per environment.

Selling in Telegram

No code is needed to sell inside Telegram. Every invoice and payment link has a second address that opens it in our bot (t.me/<bot>?start=pay_<id>), shown beside it in the dashboard. Under Payment links the dashboard also gives your shop's address: it lists all your active payment links as products, and a buyer picks one and pays in the chat. A payment link can carry a message for the buyer, sent once the payment arrives (in the bot and on the payment page). The message is the same for every buyer of that link; to hand out something different per sale, such as a licence key, deliver it from your webhook.

What the buyer sees

The payment page lets the buyer choose a network and a stablecoin, then shows your address, the exact amount and a QR code. Where it is available the buyer can instead pay with another token from a browser wallet, or from another network through a one-time deposit address. In every case your address receives the invoice's stablecoin, and the invoice is settled the same way. For some coins that deposit runs through one of our own routes, which cannot promise an amount to the unit: the buyer is then asked for about 1% more, a little more than the invoice reaches you, the invoice is still reported as paid, and its fee (the same 1%, covered by that extra) comes off your fee balance.