# Cryptonly documentation [Cryptonly](https://cryptonly.net/) is a crypto payment gateway for online businesses. We handle the settlements, conversions, and all the crypto complexity, so you can accept payments without the headaches. This documentation explains how Cryptonly works, how to integrate it into your product, and how to operate payments reliably in production. Get started Create account ## Who this documentation is for * **Merchants** who want to understand how the product works * **Developers** integrating Cryptonly via API * **Operations and finance teams** managing balances, settlements, and withdrawals ## Jump right in - [Quickstart](https://docs.cryptonly.net/quickstart.md): Create a sandbox invoice and receive its webhook - [Choosing a payment method](https://docs.cryptonly.net/guides/choosing-a-payment-method.md): Invoices, deposits, and withdrawals compared - [Invoices](https://docs.cryptonly.net/guides/invoices.md): Fixed-price checkout payments - [Deposits](https://docs.cryptonly.net/guides/deposits.md): Open-ended crypto top-ups - [Withdrawals](https://docs.cryptonly.net/guides/withdrawals.md): Payouts from your balance - [Plugins](https://docs.cryptonly.net/integration/plugins.md): Checkout plugins for WooCommerce, WHMCS, and others - [AI coding assistants](https://docs.cryptonly.net/integration/ai-assistants.md): A ready-made prompt for Claude Code, Cursor, and Codex - [x402 payments](https://docs.cryptonly.net/guides/x402.md): Pay-per-request APIs that AI agents pay in stablecoins - [API reference](https://docs.cryptonly.net/api-reference.md): Base URLs, API keys, errors, and the OpenAPI schema - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Payloads, signature verification, and retries Questions? Write to **support@cryptonly.net**. # Quickstart > Create your first invoice in the sandbox, simulate a payment, and receive the signed webhook. This guide takes you from zero to a paid test invoice in the [sandbox](https://docs.cryptonly.net/guides/sandbox-environment.md). You will create an invoice through the API, pay it without sending any crypto, and receive the `invoice.statusChanged` webhook on your server. You need a sandbox Cryptonly Merchant Dashboard account and an HTTPS endpoint that can receive webhooks. For local development, expose your server with a tunnel such as ngrok or Cloudflare Tunnel. ## 1. Get your credentials 1. Log in to the [sandbox Cryptonly Merchant Dashboard](https://sandbox-merchant.cryptonly.net). No account yet? [Create one](https://sandbox-merchant.cryptonly.net/sign-up). 2. Go to **Accounts**, select the account, and open its **Settings → Security** tab. 3. Create an API key with the **invoices** scope. The key is bound to this account, so you never pass an account ID in requests. The secret is shown only once. See [Authorization](https://docs.cryptonly.net/api-reference/authorization.md). 4. On the same page, rotate the **Webhook signing key** and copy it. You will use it to verify webhooks. Store both secrets in your server environment: ```bash CRYPTONLY_API_KEY=your_sandbox_api_key CRYPTONLY_WEBHOOK_SECRET=your_webhook_signing_key ``` ## 2. Create an invoice Send `POST /invoice` to the sandbox API at `https://sandbox-api-merchant.cryptonly.net`. `orderId` is your own reference and the [idempotency key](https://docs.cryptonly.net/api-reference/idempotency.md), so use a new value for each invoice. ```bash curl -X POST https://sandbox-api-merchant.cryptonly.net/invoice \ -H "x-tenant-api-key: $CRYPTONLY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": 25, "fiatCurrencyCode": "USD", "orderId": "order_1001", "description": "Order #1001", "webhookUrl": "https://your-server.example.com/webhooks/cryptonly" }' ``` ```ts const client = new Cryptonly({ apiKey: process.env.CRYPTONLY_API_KEY!, sandbox: true, // the SDK calls production by default }); const invoice = await client.invoice.create({ amount: 25, fiatCurrencyCode: 'USD', orderId: 'order_1001', description: 'Order #1001', webhookUrl: 'https://your-server.example.com/webhooks/cryptonly', }); console.log(invoice.paymentPageUrl); ``` The invoice is created on the account the API key belongs to. The response is `201 Created` with the invoice in `created` status. The field you need next is `paymentPageUrl`, the hosted checkout you send to your customer. See the [OpenAPI reference](/api-reference/openapi/) for every request and response field. You can leave out `webhookUrl` if you set a default invoice webhook URL under **Settings → Integration**. ## 3. Pay the invoice Open `paymentPageUrl` to see the checkout your customer will see. To complete the payment without testnet funds: 1. In the sandbox dashboard, go to **Accounts → History**. 2. Search for `order_1001` and open the invoice. 3. Click **Simulate payment**. The invoice moves through `processing` to `paid` through the real settlement pipeline, and your balance is credited. To pay with real testnet coins instead, see [Sandbox environment](https://docs.cryptonly.net/guides/sandbox-environment.md). ## 4. Receive the webhook Cryptonly sends `invoice.statusChanged` to your `webhookUrl` on every status change: first `created`, then `processing`, then `paid`. Verify the `x-webhook-signature` header against the **raw** request body before trusting it: ```ts const app = express(); app.post( '/webhooks/cryptonly', express.raw({ type: 'application/json' }), (req, res) => { const signature = req.header('x-webhook-signature'); const result = verifyInvoiceWebhook(req.body, signature, process.env.CRYPTONLY_WEBHOOK_SECRET!); if (!result.ok) { return res.status(401).end(); } const { data } = result.envelope; if (data.status === 'paid') { // Mark data.orderId as paid in your system. } res.status(200).end(); }, ); ``` Respond with any `2xx` status quickly. Failed deliveries are retried for several days. See [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md) for payloads and examples in Python, Go, PHP, and Java. ## Go live When everything works in the sandbox, switch to production: * Use the production dashboard at [merchant.cryptonly.net](https://merchant.cryptonly.net/) and create a new API key and signing key there. Sandbox credentials don't work in production. * Change the API base URL to `https://api-merchant.cryptonly.net`. With the SDK, remove `sandbox: true`. * Run through the webhook [security checklist](https://docs.cryptonly.net/api-reference/webhooks.md#security-checklist). ## Next steps - [Invoices](https://docs.cryptonly.net/guides/invoices.md): Amounts, line items, and the invoice lifecycle - [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md): Which statuses to fulfil on, and late payments - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Payloads, signatures, and retries - [Plugins](https://docs.cryptonly.net/integration/plugins.md): Skip the code with a ready-made plugin # Choosing a payment method > A quick comparison of Invoices, Deposits, and Withdrawals to help you pick the right building block. Cryptonly has three payment primitives. Every invoice payment and deposit gets its own dedicated on-chain address, and all of them share the same confirmation infrastructure, but they fit different use cases. | Primitive | Use it when | Amount | Address reuse | Webhook event | | --- | --- | --- | --- | --- | | [Invoice](https://docs.cryptonly.net/guides/invoices.md) | Checkout — customer pays a fixed price for an order | Fixed, priced in fiat; the network fee is added on top | New address per payment attempt | `invoice.statusChanged` | | [Deposit](https://docs.cryptonly.net/guides/deposits.md) | A crypto top-up to your balance, outside of checkout | Flexible, at or above a currency minimum; the network fee is withheld | New address per deposit | `deposit.statusChanged` | | [Withdrawal](https://docs.cryptonly.net/guides/withdrawals.md) | Paying funds out of your balance to an external wallet | Merchant-specified | N/A — sends out, not in | `withdrawal.statusChanged` | ## Still not sure? * Selling a product or service with a known price? Use an **Invoice**. * Accepting an open-ended top-up (for example, funding a customer's in-app balance)? Use a **Deposit**. If the same customer tops up again, create a new deposit for each payment. * Sending funds out to a customer, supplier, or your own external wallet? Use a **Withdrawal**. Every primitive is backed by the same on-chain monitoring pipeline — see [On-chain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md) for confirmation requirements, [Supported currencies](https://docs.cryptonly.net/guides/supported-currencies.md) for available assets and minimums, and [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md) for the network fee. ## Related pages - [Invoices](https://docs.cryptonly.net/guides/invoices.md): Fixed-price checkout payments - [Deposits](https://docs.cryptonly.net/guides/deposits.md): Open-ended crypto top-ups - [Withdrawals](https://docs.cryptonly.net/guides/withdrawals.md): Payouts from the merchant balance - [On-chain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md): Shared confirmation rules for incoming payments # Invoices An invoice is a fiat-priced payment request. You create it through the **API** or the **Cryptonly Merchant Dashboard**; Cryptonly returns a hosted **payment page URL** (`paymentPageUrl`) that you send to the customer. The customer opens the payment page, picks a cryptocurrency, and pays to a **unique deposit address** assigned for that attempt only. Cryptonly monitors the blockchain, runs compliance checks, and settles the payment into your merchant balance. Invoice amounts are always expressed in **fiat** (for example USD or EUR). The crypto amount is calculated at checkout from live rates when the customer selects a currency. Each invoice also has an `x402Url`, which AI agents pay with a stock x402 client: no browser, and no network fee for the agent. See [Invoices for AI agents](https://docs.cryptonly.net/guides/invoices/ai-agents.md). ## Amount and line items Provide at least one of `amount` or `items` when creating an invoice. You can send both. * If a **positive `amount`** is sent, it is always the charged total — even when `items` are also sent. * If `amount` is omitted, the total is computed as the sum of `cost × quantity` across `items`. * Line items are stored and shown on the hosted payment page regardless of how the total was set. They do not change the charged amount when `amount` is present. ## How status and webhooks work Cryptonly sends a signed `invoice.statusChanged` webhook on every status change, starting with `created`: * The invoice stays `created` while the customer picks or switches currency. You get one `created` webhook, not one per currency. * Once the payment reaches the required [confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md), the invoice moves to `processing`, then to `paid`, `partially_paid`, `overpaid`, `suspended`, or `failed`. * An `expired` invoice can still be paid within **4 hours** — see [Late payments](https://docs.cryptonly.net/guides/invoices/statuses.md#late-payments). The deposit behind an invoice payment does **not** send `deposit.statusChanged`. Listen for `invoice.statusChanged` only. See [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md) for what each status means and which ones to fulfil on. ## Related pages - [Processing lifecycle](https://docs.cryptonly.net/guides/invoices/processing-lifecycle.md): Full step-by-step flow - [Statuses](https://docs.cryptonly.net/guides/invoices/statuses.md): Status table and integration notes - [AI agents (x402)](https://docs.cryptonly.net/guides/invoices/ai-agents.md): Let agents pay an invoice over its x402Url - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): invoice.statusChanged verification and payloads - [Deposits](https://docs.cryptonly.net/guides/deposits.md): Standalone top-ups, which use a different webhook # Invoice processing lifecycle > Invoice flow from creation through confirmation, AML screening, and balance credit. ## In short 1. Create a payment request through the API 2. Redirect the customer to the payment link 3. Listen for `invoice.statusChanged` webhook events 4. Fulfil the order only after the invoice reaches `paid`, `partially_paid`, or `overpaid` See [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md) for the full status table. ## Invoice lifecycle 1. **Merchant creates an invoice request** An invoice can be created either: * through the **Cryptonly Merchant Dashboard** * via the **API** (`POST /invoice`) The create response includes `paymentPageUrl` for the hosted checkout. Default invoice expiry is **24 hours** unless you pass `expiresInMinutes` on create. In the dashboard, go to **Accounts** and click **New Invoice**. 1. **Customer opens the link and selects a cryptocurrency** The customer visits the hosted payment page and chooses which supported cryptocurrency to pay with. Cryptonly assigns a unique deposit address, used for this payment attempt only, and locks the crypto amount: the invoice amount plus the network fee. The deposit payment link is valid for **30 minutes** by default. A payment that arrives at this address within **4 hours** after it expires — or after the customer switched to another currency — is still processed normally. See [Late payments](https://docs.cryptonly.net/guides/invoices/statuses.md#late-payments). The customer then sends that amount to the deposit address. 1. **Cryptonly waits for the required on-chain confirmation(s)** Once the transfer is detected on-chain, Cryptonly waits for the required number of blockchain confirmations. See [On-chain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md) for the number required per network. The invoice stays `created` until then, and moves to `processing` once the confirmations are reached. 1. **Cryptonly performs an AML check** Cryptonly screens the transaction. If it passes, processing continues. If it needs review, the invoice moves to `suspended` until the compliance team resolves it. 1. **If the AML check passes, the invoice is settled and the balance is credited** Cryptonly settles the invoice with a payment-received status (`paid`, `partially_paid`, or `overpaid`) and credits the merchant's internal balance (the received amount minus the network fee and commission). 1. **Cryptonly sends webhooks on status changes** Cryptonly sends an `invoice.statusChanged` webhook on each invoice status transition. ## Related pages - [Statuses](https://docs.cryptonly.net/guides/invoices/statuses.md): Status table and late payments - [On-chain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md): How many confirmations each network requires - [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md): Network fee added on the payment page - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verify invoice.statusChanged # Invoice statuses > Invoice statuses describe where an invoice is in the payment flow, from creation to final settlement. | Status | Meaning | Can move to | | --- | --- | --- | | `created` | The invoice exists and is waiting for payment. It stays `created` while the customer picks a currency, and if they switch to another one. | `processing`, `expired`, `cancelled` | | `processing` | An on-chain payment reached the required confirmations and is being checked: amount validation and compliance screening. | `paid`, `partially_paid`, `overpaid`, `suspended`, `failed` | | `suspended` | The payment is held for compliance review. Not final. | `paid`, `partially_paid`, `overpaid`, `failed` | | `paid` | The received amount is within the accepted tolerance of the expected crypto amount. | Final | | `partially_paid` | The received amount is above the minimum deposit amount but below the expected amount minus tolerance. | Final | | `overpaid` | The received amount is higher than the expected amount. | Final | | `expired` | The invoice expired before a payment arrived. | `processing` for a [late payment](#late-payments); otherwise final | | `cancelled` | The invoice was cancelled by the organization or the customer before payment. | Final | | `failed` | The payment could not be completed, for example because of a network issue or a failed compliance check. | Final | An invoice expires **24 hours** after creation by default. Pass `expiresInMinutes` on `POST /invoice` to change it. ## Integration notes * **Fulfil on `paid`, `partially_paid`, or `overpaid`.** All three mean a payment was received. Your business logic decides whether a partial or excess payment is acceptable. * **Treat `cancelled` and `failed` as unsuccessful final statuses.** * **Treat `expired` as unsuccessful, but not yet final.** A late payment can still move it to `processing` within the late-payment window. * **Use `invoice.statusChanged` webhooks as the source of truth.** Poll `GET /invoice` only as a fallback. You receive exactly one `created` webhook, even if the customer switches currency. ## Late payments Each payment attempt on an invoice gets its own deposit address, so a payment that arrives late can still be matched to the invoice: * **After expiry.** If a payment reaches the invoice's deposit address within **4 hours** after that deposit expired, the invoice moves `expired` → `processing` and then continues through the normal flow. An `invoice.statusChanged` webhook is sent for each transition, as usual. * **After a currency switch.** If the customer switched to another currency on the payment page but still paid the address shown for the first currency within **4 hours**, that payment settles the invoice. The amount is evaluated against the amount locked for that first currency. If the deposit for the newer currency hasn't been paid yet, it is cancelled. * **Not credited automatically:** payments after the 4-hour window, payments to an invoice that is already `processing` or settled by another payment, and payments to a `cancelled` invoice. Contact **support@cryptonly.net** with the invoice ID and transaction hash. If your system closes orders on `expired`, make sure it can still fulfil them when a later `paid`, `partially_paid`, or `overpaid` webhook arrives for the same invoice. ## If an invoice is `suspended` `suspended` means the payment is held for compliance review. It is not a final outcome: * While the review is open, the funds stay on the invoice's deposit address. * Cryptonly's compliance team resolves the review. There is no merchant-facing action to speed it up or check its progress. * Afterwards, the invoice moves to `paid`, `partially_paid`, `overpaid`, or `failed`, with the usual `invoice.statusChanged` webhook. Review time varies with case complexity, so don't assume a fixed SLA. Contact **support@cryptonly.net** if a review appears stuck. ## Merchant return URLs Optional `returnUrl`, `successUrl`, and `failedUrl` on invoice creation add a **Return to merchant** button to the hosted payment page. They are not webhooks and do not redirect automatically. | Field | Shown when the invoice is | | --- | --- | | `successUrl` | `paid`, `overpaid` | | `failedUrl` | `failed`, `suspended`, `partially_paid` | | `returnUrl` | `cancelled`, `expired` | No button is shown while the invoice is `created` or `processing`. The button follows the current status: if an `expired` invoice receives a late payment, the `returnUrl` button is replaced by the one for the new status. `partially_paid` uses `failedUrl` so you can send the payer to a recovery or contact flow, even though it still counts as a received payment for fulfilment. ## Related pages - [Processing lifecycle](https://docs.cryptonly.net/guides/invoices/processing-lifecycle.md): How an invoice moves through these statuses - [Invoices](https://docs.cryptonly.net/guides/invoices.md): Creating a fiat-priced payment - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): invoice.statusChanged is the source of truth - [Deposit statuses](https://docs.cryptonly.net/guides/deposits/statuses.md): Invoice-linked deposits follow the invoice instead # Invoices for AI agents (x402) > Every invoice has an x402Url that an AI agent pays with a stock x402 client: the price in USDC or EURC on Base, no browser, no network fee for the agent. Every invoice comes with two links: - `paymentPageUrl`: the hosted payment page, for people. - `x402Url`: the same invoice for **AI agents** and any other [x402](https://www.x402.org/) client. An agent pays it with one HTTP request and a signature. It needs no browser, no wallet pop-up and no ETH for gas. An x402 payment is an ordinary invoice payment. The invoice moves through the same [statuses](https://docs.cryptonly.net/guides/invoices/statuses.md), you get the same `invoice.statusChanged` webhooks, and the same commission applies. The invoice says how it was paid in `paymentChannel` (`x402` or `address`). ## How an agent pays 1. The agent sends `POST` (or `GET`) to `x402Url` without payment. 2. Cryptonly answers `402 Payment Required`. The `PAYMENT-REQUIRED` header (base64 JSON, x402 v2) lists the price in each accepted stablecoin, each paid to the invoice's own address. 3. The agent signs a transfer for one of them and repeats the request with a `PAYMENT-SIGNATURE` header. 4. Cryptonly checks the signature against the price it quoted, opens the invoice's deposit, broadcasts the transfer, and pays the network fee. 5. Cryptonly answers `200` once the transfer is on chain (`202` if it was sent but is not mined yet), with a `PAYMENT-RESPONSE` header holding the transaction. The invoice then turns `processing` and `paid` like any other payment, after the [confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md) of its network. ## Accepted assets | Network | Assets | | --- | --- | | Base (`eip155:8453`) | USDC, EURC | The sandbox uses Base Sepolia with the [test assets of x402](https://docs.cryptonly.net/guides/x402.md#networks-and-assets). Invoice x402 links are Base only; customers who pay in USDT or on Solana use the payment page. The 402 lists one entry per asset, with the stablecoin that matches the invoice currency first: EURC for a EUR invoice, USDC for a USD one. Stock clients pay the first entry they accept. The price includes the network fee of the invoice's deposit, as on the hosted page. Each quote holds for 10 minutes; a request after that gets a fresh one. ## Example agent Any x402 v2 client works. With [`@x402/fetch`](https://www.npmjs.com/package/@x402/fetch): ```ts const pay = wrapFetchWithPaymentFromConfig(fetch, { schemes: [{ network: 'eip155:8453', client: new ExactEvmScheme(toClientEvmSigner(account, publicClient)) }], // Stock clients refuse more than $1 and pay only USDC unless told otherwise. spendControls: { allowedAssets: true, maxAmountPerPayment: '$100' }, }); const response = await pay(invoice.x402Url, { method: 'POST' }); ``` To make retries safe, the agent can send the x402 `payment-identifier` extension with its own id. A repeated id, or a repeated signature, returns the first payment's outcome and never pays twice. ## Responses | Status | Meaning | | --- | --- | | `402` | Payment required. After a refused payment, `error` and `PAYMENT-RESPONSE` say why; nothing was paid. | | `200` | The transfer is on chain, or the invoice was already paid (a receipt, nothing charged). | | `202` | The transfer was sent and is not mined yet, or a payment is being confirmed. Do not pay again. | | `302` | A browser opened the link: it is redirected to the payment page. | | `409` | The customer is paying on the payment page in a currency x402 cannot pay. `Retry-After` says when that attempt expires. | | `410` | The invoice can no longer be paid: expired, cancelled, partially paid, failed or suspended. | | `404` | Unknown invoice, or x402 is off for it. | If the customer already picked USDC or EURC on Base on the payment page, the agent is offered exactly that deposit. Once an agent has paid, the customer cannot switch currency or cancel, and you cannot cancel the invoice until the payment settles. ## Turning it off Create the invoice with `"x402Enabled": false`, or untick **Let AI agents pay over x402** under **Advanced options** in the dashboard. The invoice then has no `x402Url`, and the link answers `404`. ## Related pages - [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md): Which statuses to fulfil on - [x402 payments](https://docs.cryptonly.net/guides/x402.md): Charge for your own API with x402 - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): invoice.statusChanged verification and payloads # Deposits A deposit is a standalone crypto top-up to a merchant balance. You create it through the **API** (`POST /deposit`) or the **Cryptonly Merchant Dashboard**; Cryptonly returns a unique deposit address, a QR code, a payment link, and `expiresAt`. The customer sends crypto to that **unique deposit address**, used for this deposit only. Cryptonly monitors the blockchain, runs compliance checks, and settles the payment into your merchant balance. Deposit amounts are expressed in **crypto**. The customer can send any amount at or above the currency minimum. There is no fixed total. ## Amount * The minimum for a currency is `minDepositAmount` on [`GET /currencies`](https://docs.cryptonly.net/guides/supported-currencies.md). * The [network fee](https://docs.cryptonly.net/guides/fees-and-commissions.md#deposit-network-fee) is fixed when the deposit is created and withheld from the received amount. Commission is taken on what remains. * Pass `orderId` on `POST /deposit`. It is the idempotency key. * The payment link is valid for **20 minutes** by default. A payment that arrives within **4 hours** after `expiresAt` is still processed — see [Late payments](https://docs.cryptonly.net/guides/deposits/statuses.md#late-payments). * Each top-up needs its own deposit. Create a new one when the same customer pays again. ## How status and webhooks work Cryptonly sends a signed `deposit.statusChanged` webhook on every status transition of a standalone deposit. No webhook is sent on create: * The deposit starts in `created`, with the address already assigned. * Once the payment reaches the required [confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md), the deposit moves to `processing`, then to `completed` (balance credited) or `suspended` (not credited, final). * An `expired` deposit can still be paid within **4 hours** — see [Late payments](https://docs.cryptonly.net/guides/deposits/statuses.md#late-payments). Deposits created by an invoice payment do **not** send `deposit.statusChanged`; listen for `invoice.statusChanged` instead. See [Deposit statuses](https://docs.cryptonly.net/guides/deposits/statuses.md) for what each status means. ## Related pages - [Processing lifecycle](https://docs.cryptonly.net/guides/deposits/processing-lifecycle.md): Full step-by-step flow - [Statuses](https://docs.cryptonly.net/guides/deposits/statuses.md): Status table and integration notes - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): deposit.statusChanged verification and payloads - [Invoices](https://docs.cryptonly.net/guides/invoices.md): Checkout payments use invoice webhooks instead # Deposit processing lifecycle > Standalone deposit flow from address assignment through confirmation to balance credit. ## In short 1. Create a deposit through the API (`POST /deposit`) with `cryptoCurrencyCode` and `orderId` 2. Show the customer the deposit address, QR code, or payment link 3. Listen for `deposit.statusChanged` webhook events 4. Credit your customer when the deposit reaches `completed` See [Deposit statuses](https://docs.cryptonly.net/guides/deposits/statuses.md) for the full status table. ## Deposit lifecycle 1. **Merchant creates a deposit request** A deposit can be created either: * through the **Cryptonly Merchant Dashboard**: **Accounts → Top up** * via the **API** 1. **Cryptonly assigns a unique deposit address** Cryptonly assigns a deposit address that is used for this deposit only and returns a payment link, QR code, and `expiresAt` timestamp (default **20 minutes**). The customer can send any amount at or above the currency minimum. The [network fee](https://docs.cryptonly.net/guides/fees-and-commissions.md#deposit-network-fee) for moving the funds off this address is fixed at this point and withheld from the received amount. If the payment arrives after `expiresAt` but within **4 hours** after expiry, it is still processed through the steps below (the deposit moves from `expired` to `processing`). See [Late payments](https://docs.cryptonly.net/guides/deposits/statuses.md#late-payments). 1. **Customer sends crypto to the deposit address** Unlike invoice payments, the amount is flexible as long as it meets the minimum deposit requirement for the selected currency. 1. **Cryptonly waits for the required on-chain confirmation(s)** Once the transfer is detected on-chain, Cryptonly waits for the required number of blockchain confirmations. See [On-chain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md) for the number required per network. The deposit stays `created` until then, and moves to `processing` once the confirmations are reached. 1. **Cryptonly performs an AML check** Cryptonly screens the transaction. If it does not pass, the deposit moves to `suspended` and is not credited. 1. **If the AML check passes, the deposit is completed and the balance is credited** Cryptonly marks the deposit as `completed` and credits the merchant's internal balance with the received amount minus the network fee and commission. 1. **Cryptonly sends webhooks on status changes** Cryptonly sends a `deposit.statusChanged` webhook on each status transition, starting with `created` → `processing`. No webhook is sent when the deposit is created. The webhook goes to the `webhookUrl` passed on `POST /deposit`, or to the default deposit webhook URL under **Settings → Integration**. ## Related pages - [Statuses](https://docs.cryptonly.net/guides/deposits/statuses.md): Status table and late payments - [On-chain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md): How many confirmations each network requires - [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md): Network fee withheld from the received amount - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verify deposit.statusChanged # Deposit statuses > Deposit statuses describe where a standalone top-up is in the payment flow, from creation to final settlement. | Status | Meaning | Can move to | | --- | --- | --- | | `created` | A unique deposit address is assigned and Cryptonly is waiting for an on-chain payment. | `processing`, `expired`, `cancelled` | | `processing` | A payment reached the required confirmations and is being checked: amount validation and compliance screening. | `completed`, `suspended` | | `completed` | Compliance screening passed and the merchant balance was credited. | Final | | `suspended` | Compliance screening did not pass. The funds were not credited. | Final | | `expired` | The payment link expired before a payment arrived. | `processing` for a [late payment](#late-payments); otherwise final | | `cancelled` | The deposit was cancelled while still `created`. | `processing` for an invoice-linked deposit cancelled by a currency switch (see [Late payments](#late-payments)); otherwise final | | `failed` | Reserved in the public enum. Current deposit flows do not produce it. | Final | ## Integration notes * **Credit your customer on `completed`.** It is the only successful final status. * **Treat `suspended` and `failed` as unsuccessful final statuses.** * **Treat `expired` and `cancelled` as unsuccessful, but not yet final.** A late payment can still move them to `processing` within the late-payment window. * **Use `deposit.statusChanged` webhooks as the source of truth.** They are sent on every transition of a standalone deposit, but not on create. Use `GET /deposit` and `GET /deposit/list` only as a fallback. * **Deposits linked to an invoice (`invoiceId` is set) send no `deposit.statusChanged` webhooks.** Follow `invoice.statusChanged` instead — see [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md). ## Late payments Every deposit gets its own address, so a payment that arrives after the deposit has closed can still be matched to it: * If a payment reaches the address of an `expired` deposit within **4 hours** after expiry, the deposit moves `expired` → `processing` and continues through the normal flow to `completed` or `suspended`. A `deposit.statusChanged` webhook is sent for each transition, as usual. * The same applies to an invoice-linked deposit that was `cancelled` because the customer switched currency on the payment page and then still paid the address shown first. * Payments that arrive after the 4-hour window, to deposits cancelled for any other reason, or in addition to a deposit that is already `completed` are not credited automatically. Contact **support@cryptonly.net** with the deposit ID and transaction hash. If your system closes top-ups on `expired`, make sure it can reopen them when a later `processing` or `completed` webhook arrives for the same deposit. ## If a deposit is `suspended` Unlike invoices, a standalone deposit that lands in `suspended` stays there. It's a final status, and no further `deposit.statusChanged` webhook follows. Compliance review did not clear the transaction for automatic crediting, and the funds are held on the deposit address. Contact **support@cryptonly.net** with the deposit ID if you believe this needs manual follow-up. ## Related pages - [Processing lifecycle](https://docs.cryptonly.net/guides/deposits/processing-lifecycle.md): How a deposit moves through these statuses - [Deposits](https://docs.cryptonly.net/guides/deposits.md): Creating a standalone top-up - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): deposit.statusChanged is the source of truth - [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md): Invoice-linked deposits follow the invoice webhook # Withdrawals A withdrawal pays funds out of a merchant balance to an external wallet. You create it through the **API** or the **Cryptonly Merchant Dashboard**. Through the API, request a **quote** (`POST /withdrawal/quote`), then **commit** it (`POST /withdrawal/commit`). Commit debits your balance and Cryptonly sends the transfer on-chain. Withdrawal amounts are set by you in **crypto**, along with the destination wallet address. The network fee from the quote is debited together with the amount. In the dashboard, go to **Accounts** and click **Withdraw**. ## Quote and commit * **Quote** returns a fee estimate and a short-lived `quoteId`. Set `allowAutoConvert: true` to cover a shortfall from other balances — see [Auto-converting](https://docs.cryptonly.net/guides/withdrawals/auto-converting.md). * **Commit** creates the withdrawal in `created` and debits the amount plus the network fee. * `orderId` on the quote is the idempotency key. Reuse it when retrying the quote, then commit once you have a `quoteId`. ## How status and webhooks work Cryptonly sends a signed `withdrawal.statusChanged` webhook on every status change after commit: * The commit response returns `created`, with the balance already debited. The first webhook usually arrives when the withdrawal moves to `processing`. * From `processing`, the withdrawal finishes as `completed` or `failed`. On `failed`, the debited balance is returned. See [Withdrawal statuses](https://docs.cryptonly.net/guides/withdrawals/statuses.md) for the full status table. ## Related pages - [Processing lifecycle](https://docs.cryptonly.net/guides/withdrawals/withdrawals-lifecycle.md): Full step-by-step flow - [Statuses](https://docs.cryptonly.net/guides/withdrawals/statuses.md): Status table and integration notes - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): withdrawal.statusChanged verification and payloads - [Auto-converting](https://docs.cryptonly.net/guides/withdrawals/auto-converting.md): Cover a shortfall from other balances # Withdrawals lifecycle > Withdrawal flow from quote and commit through the on-chain send and status webhooks. ## In short 1. Request a withdrawal quote through the API (`POST /withdrawal/quote`) 2. Commit the quote (`POST /withdrawal/commit`) 3. Listen for `withdrawal.statusChanged` webhook events 4. Update your internal withdrawal status when it reaches `completed` or `failed` See [Withdrawal statuses](https://docs.cryptonly.net/guides/withdrawals/statuses.md) for the full status table. ## Withdrawal lifecycle 1. **Merchant requests a withdrawal quote and commits it** A withdrawal can be initiated either: * through the **Cryptonly Merchant Dashboard** * via the **API** The merchant provides: * the destination wallet address * the cryptocurrency and amount * whether [auto-converting](https://docs.cryptonly.net/guides/withdrawals/auto-converting.md) may cover a shortfall In the dashboard, **Get Quote** shows the quote before you confirm: Through the API, the flow is two steps: 1. **Quote** — returns a fee estimate and a short-lived `quoteId` 2. **Commit** — creates the withdrawal in `created` status and debits the required balance, including the network fee Once the quote is committed, Cryptonly begins processing the withdrawal. 1. **Cryptonly sends the on-chain transaction** Cryptonly creates and broadcasts an on-chain transaction based on the withdrawal request details. The withdrawal moves to `processing` while the underlying network transfer is prepared, broadcast, and monitored. 1. **Withdrawal completion and webhooks** Cryptonly sends a `withdrawal.statusChanged` webhook on each status transition after commit. Your integration should handle at least: * `created` → `processing` — on-chain send has started * `processing` → `completed` — withdrawal confirmed on-chain * `processing` → `failed` — withdrawal could not be completed; debited balance is returned The webhook goes to the `webhookUrl` passed on commit, or to the default withdrawal webhook URL under **Settings → Integration**. ## Related pages - [Statuses](https://docs.cryptonly.net/guides/withdrawals/statuses.md): created, processing, completed, and failed - [Auto-converting](https://docs.cryptonly.net/guides/withdrawals/auto-converting.md): Cover a shortfall before the quote is committed - [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md): Network fee returned on the quote - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verify withdrawal.statusChanged # Auto-converting > Cover a withdrawal shortfall by converting other balances into the requested currency. If the available balance for a withdrawal currency is insufficient, Cryptonly may still complete the withdrawal by converting other balances into that currency. ## How to enable it Set `allowAutoConvert: true` on `POST /withdrawal/quote`. If the balance is short of `amount` plus the on-chain fee, the quote adds a conversion step first. The response includes an `autoConvert` breakdown (`fromAssetCode`, `toAssetCode`, `fromAmount`, `toAmount`, `commissionAmount`) when this applies; `POST /withdrawal/commit` reuses the locked conversion from the quote. If `allowAutoConvert` is omitted or `false` (the default) and the balance is insufficient, the quote fails. USDT ↔ USDC converts at 1:1 with no commission. Every other pair has a 0.2% commission. `commissionAmount` is in `fromAssetCode` and is already included in `fromAmount` — see [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md). ## Related pages - [Withdrawals lifecycle](https://docs.cryptonly.net/guides/withdrawals/withdrawals-lifecycle.md): Quote and commit, where auto-convert is chosen - [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md): Conversion commission: none for USDT ↔ USDC, 0.2% otherwise - [Balances, transfers, and conversions](https://docs.cryptonly.net/guides/balances-transfers-and-conversions.md): Other conversions that move a balance - [Supported currencies](https://docs.cryptonly.net/guides/supported-currencies.md): Assets that can cover a shortfall # Withdrawal statuses > Withdrawal statuses describe where a payout is in the process, from commit to final settlement. | Status | Meaning | Can move to | | --- | --- | --- | | `created` | The quote was committed and the amount plus the network fee was debited. The on-chain transfer has not been sent yet. | `processing` | | `processing` | The on-chain transfer is being prepared, broadcast, and monitored. | `completed`, `failed` | | `completed` | The withdrawal was confirmed on-chain. The response may include the final transaction hash. | Final | | `failed` | The transfer failed, was dropped, or expired. The debited balance is returned once the failure is finalized. | Final | | `cancelled` | Reserved in the public enum for compatibility. Current withdrawal flows do not produce it. | Final | ## Integration notes * **The commit response returns `created`.** The first `withdrawal.statusChanged` webhook usually arrives when the withdrawal moves to `processing`. * **Treat `completed` as success and `failed` as the unsuccessful outcome.** These are the two statuses to act on. * **Use `withdrawal.statusChanged` webhooks as the source of truth.** They are sent on every transition after commit. Poll `GET /withdrawal` only as a fallback. ## Related pages - [Withdrawals lifecycle](https://docs.cryptonly.net/guides/withdrawals/withdrawals-lifecycle.md): Quote, commit, and these status changes - [Withdrawals](https://docs.cryptonly.net/guides/withdrawals.md): Paying funds out of the merchant balance - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): withdrawal.statusChanged is the source of truth - [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md): The network fee debited when a withdrawal is created # x402 payments > Charge per API call in stablecoins with the x402 protocol. Cryptonly verifies and settles each payment, pays the network fee, and tracks every payment in the dashboard. [x402](https://www.x402.org/) lets you charge for an API call over plain HTTP. Your API answers an unpaid request with `402 Payment Required` and a price. The buyer, often an AI agent, signs a stablecoin payment and retries. Cryptonly settles it on-chain, and your API returns the response. Read the quickstart Open dashboard ## How it works ```mermaid sequenceDiagram participant Buyer participant API as Your API participant Cryptonly participant Chain as Base or Solana Buyer->>API: GET /weather/paris API-->>Buyer: 402 Payment Required (price) Buyer->>API: GET /weather/paris + signed payment API->>Cryptonly: verify and settle Cryptonly->>Chain: transfer Cryptonly-->>API: settled API-->>Buyer: 200 OK + response ``` Cryptonly is the **facilitator**: it checks the signed payment, sends it to the network and pays the network fee. Buyers hold only stablecoins. Cryptonly pays the ETH or SOL for the transfer. Payments go straight to your own wallet, or on Base to your Cryptonly balance. Set prices in the dashboard and change them at any time. Or keep them in code. Payment history, CSV export and webhooks for each call. ## Networks and assets Choose which assets you accept under **Settings → General → Accepted assets**. An endpoint priced in the dashboard can have a price in each of them; its 402 offers them all. The [sandbox](https://docs.cryptonly.net/guides/sandbox-environment.md) uses Base Sepolia (`eip155:84532`) and Solana Devnet (`solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1`). ## Pricing The first 100 payments each month are free. After that, each payment costs $0.0025. See [how fees are paid](https://docs.cryptonly.net/guides/x402/payouts-and-fees.md#fees). ## Get started - [Prices in the dashboard](https://docs.cryptonly.net/guides/x402/quickstart.md): Recommended. Quickstart for Express, Fastify or NestJS, from wallet to first payment. - [Prices in your code](https://docs.cryptonly.net/guides/x402/prices-in-code.md): NestJS, or stock x402 middleware for Express, Fastify, Hono, Next.js, FastAPI, Flask or Go. ## Related pages - [Invoices for AI agents](https://docs.cryptonly.net/guides/invoices/ai-agents.md): Let agents pay your invoices with x402 - [x402 API reference](https://docs.cryptonly.net/api-reference/openapi/operations/x402supported/): supported, config, verify, settle and settlements # x402 quickstart > Charge for an API endpoint with x402: add a payout wallet, create a key, set a price, add the middleware for Express, Fastify or NestJS and make your first paid call. In this guide you'll charge 0.01 USDC on Base for `GET /v1/weather/:city`, then make the first payment yourself. The payment lands in your own wallet. You need: - A Cryptonly account with business verification approved. Until it's approved, payments fail with `settlement_disabled`. - Node.js 18 or later. - A wallet on Base to receive payments, such as MetaMask or a Safe. - A second wallet with a little USDC on Base, to act as the buyer. It needs no ETH. Prices from the dashboard need one of the Node.js packages below. For a seller in Python or Go, see [Prices in your code](https://docs.cryptonly.net/guides/x402/prices-in-code.md). Open dashboard Create account Under **x402 payments**, the **Overview** tab tracks the steps below: 1. **Add a payout wallet** Go to **Settings → Payouts → Add wallet**, paste your address and sign the message. Payments will go to this wallet. 2. **Create an API key** Go to **Settings → Integration → Create x402 key**. Save it as `CRYPTONLY_API_KEY`. You'll only see it once. 3. **Set a price** On the **Endpoints** tab, click **Add endpoint**: - **URL**: your API's URL with the path `/v1/weather/:city`. `:city` matches any value. - **Price**: `0.01` USDC on Base. To accept another currency too, such as USDC on Solana, click **Add currency**. The 402 offers every price and the buyer pays with any of them. Leave **List publicly** off for now. It adds the endpoint to the [discovery feed](https://docs.cryptonly.net/guides/x402/discovery.md). 4. **Add the middleware** ```bash npm install @cryptonly/x402-express @x402/core @x402/express @x402/evm express ``` ```ts const app = express(); app.get('/health', (_req, res) => res.send('ok')); // free routes go first const payments = cryptonlyPaymentMiddleware({ apiKey: process.env.CRYPTONLY_API_KEY!, }); app.use(payments); app.get('/v1/weather/:city', (req, res) => { res.json({ city: req.params.city, temperatureC: 21 }); }); await payments.ready(); // fails at startup if the prices can't load app.listen(4021); ``` ```bash npm install @cryptonly/x402-fastify @x402/core @x402/fastify @x402/evm fastify ``` ```ts const app = Fastify(); await app.register(cryptonlyPayments, { apiKey: process.env.CRYPTONLY_API_KEY!, }); app.get('/v1/weather/:city', async (request) => { const { city } = request.params as { city: string }; return { city, temperatureC: 21 }; }); await app.cryptonlyX402.ready(); // fails at startup if the prices can't load await app.listen({ port: 4021 }); ``` ```bash npm install @cryptonly/x402-nestjs @x402/core @x402/evm ``` ```ts @Controller('v1/weather') class WeatherController { @X402() // the price comes from the dashboard @Get(':city') get(@Param('city') city: string) { return { city, temperatureC: 21 }; } } @Module({ imports: [ X402Module.forRoot({ apiKey: process.env.CRYPTONLY_API_KEY!, isGlobal: true }), ], controllers: [WeatherController], }) export class AppModule {} ``` Listen on port 4021 in `main.ts` (`await app.listen(4021)`). Only handlers with `@X402()` ask for payment. It works on the Express and the Fastify platform. The middleware loads your prices from the dashboard and refreshes them every minute, so price changes need no deploy. It matches endpoints by path, so it works on `localhost` too. 5. **Check that the endpoint asks for payment** ```bash curl -i http://localhost:4021/v1/weather/paris # HTTP/1.1 402 Payment Required ``` 6. **Pay for it** Run this as the buyer, with the buyer wallet's key in `BUYER_PRIVATE_KEY`: ```bash npm install @x402/fetch @x402/evm viem ``` ```ts const account = privateKeyToAccount(process.env.BUYER_PRIVATE_KEY as `0x${string}`); const publicClient = createPublicClient({ chain: base, transport: http() }); const pay = wrapFetchWithPaymentFromConfig(fetch, { schemes: [ { network: 'eip155:8453', client: new ExactEvmScheme(toClientEvmSigner(account, publicClient)) }, ], }); const response = await pay('http://localhost:4021/v1/weather/paris'); console.log(response.status, await response.json()); // 200 { city: 'paris', temperatureC: 21 } ``` The payment shows up on the **Payments** tab within seconds. For a buyer in Python or Go, see [buyer clients](https://docs.cryptonly.net/guides/x402/reference.md#buyer-clients). ## Next steps - [Webhooks](https://docs.cryptonly.net/guides/x402/payments-and-webhooks.md#webhooks): Get notified when a payment confirms - [Payouts and fees](https://docs.cryptonly.net/guides/x402/payouts-and-fees.md): Add Solana, or get paid to your Cryptonly balance - [Discovery](https://docs.cryptonly.net/guides/x402/discovery.md): List your endpoint so agents can find it - [Prices in your code](https://docs.cryptonly.net/guides/x402/prices-in-code.md): Use stock x402 middleware instead of the dashboard ## Test in the sandbox To try x402 without real money, or before your business verification is approved, use the free [sandbox](https://docs.cryptonly.net/guides/sandbox-environment.md). Follow the same steps with these changes: - Use a sandbox account. Its keys and wallets are separate from production. - Pass `sandbox: true` to `cryptonlyPaymentMiddleware`, `cryptonlyPayments` or `X402Module.forRoot()`. - In the buyer code, use `baseSepolia` and `eip155:84532`. Get test USDC from the [Circle faucet](https://faucet.circle.com/). Create sandbox account # Prices in your code > Use Cryptonly as the facilitator with prices and payTo kept in your code: stock x402 middleware in Express, FastAPI or Go, or @X402() in NestJS. Keep prices in your code if you already use x402 middleware or want them under version control. Cryptonly then only settles the payments, and you don't use the **Endpoints** tab. Each route sets its own price and `payTo`, the address that gets paid. First, follow steps 1 and 2 of the [quickstart](https://docs.cryptonly.net/guides/x402/quickstart.md) to add a payout wallet and create an API key. Set `PAY_TO` to that wallet's address. ```bash npm install @cryptonly/x402 @x402/core @x402/express @x402/evm express ``` ```ts const facilitator = new CryptonlyFacilitatorClient({ apiKey: process.env.CRYPTONLY_API_KEY!, }); const server = new x402ResourceServer(facilitator).register( 'eip155:8453', new ExactEvmScheme(), ); const app = express(); app.use( paymentMiddleware( { 'GET /v1/weather/:city': { accepts: [ { scheme: 'exact', price: '$0.01', network: 'eip155:8453', payTo: process.env.PAY_TO! }, ], description: 'Current weather for a city', }, }, server, ), ); app.get('/v1/weather/:city', (req, res) => { res.json({ city: req.params.city, temperatureC: 21 }); }); app.listen(4021); ``` `CryptonlyFacilitatorClient` works the same way with `@x402/fastify`, `@x402/hono` and `@x402/next`. ```bash npm install @cryptonly/x402-nestjs @x402/core @x402/evm ``` ```ts @Controller('v1/weather') class WeatherController { @X402({ accepts: { scheme: 'exact', price: '$0.01', network: 'eip155:8453', payTo: process.env.PAY_TO! }, description: 'Current weather for a city', }) @Get(':city') get(@Param('city') city: string) { return { city, temperatureC: 21 }; } } @Module({ imports: [ X402Module.forRoot({ apiKey: process.env.CRYPTONLY_API_KEY!, isGlobal: true }), ], controllers: [WeatherController], }) export class AppModule {} ``` Listen on port 4021 in `main.ts`. `@X402()` without arguments takes the price from the **Endpoints** tab instead; you can mix both in one app. It works on the Express and the Fastify platform. ```bash pip install cryptonly-x402 "x402[fastapi,evm]" fastapi uvicorn ``` ```python from cryptonly_x402 import CryptonlyFacilitatorClient from fastapi import FastAPI from x402.http import PaymentOption, RouteConfig from x402.http.middleware.fastapi import PaymentMiddlewareASGI from x402.mechanisms.evm.exact import ExactEvmServerScheme from x402.server import x402ResourceServer facilitator = CryptonlyFacilitatorClient(os.environ["CRYPTONLY_API_KEY"]) server = x402ResourceServer(facilitator) server.register("eip155:8453", ExactEvmServerScheme()) routes = { "GET /v1/weather/:city": RouteConfig( accepts=PaymentOption(scheme="exact", price="$0.01", network="eip155:8453", pay_to=os.environ["PAY_TO"]), description="Current weather for a city", ), } app = FastAPI() app.add_middleware(PaymentMiddlewareASGI, routes=routes, server=server) @app.get("/v1/weather/{city}") async def weather(city: str): return {"city": city, "temperatureC": 21} ``` Run it with `uvicorn main:app --port 4021`. For Flask, use `CryptonlyFacilitatorClientSync` with `x402ResourceServerSync`. There is no Cryptonly package for Go. Use the stock HTTP facilitator client and send your key in the `x-tenant-api-key` header. ```bash go get github.com/x402-foundation/x402/go github.com/gin-gonic/gin ``` ```go package main "context" "os" "github.com/gin-gonic/gin" x402http "github.com/x402-foundation/x402/go/http" ginmw "github.com/x402-foundation/x402/go/http/gin" evm "github.com/x402-foundation/x402/go/mechanisms/evm/exact/server" ) // apiKey sends your Cryptonly API key with every facilitator call. type apiKey string func (k apiKey) GetAuthHeaders(context.Context) (x402http.AuthHeaders, error) { h := map[string]string{"x-tenant-api-key": string(k)} return x402http.AuthHeaders{Verify: h, Settle: h, Supported: h}, nil } func main() { facilitator := x402http.NewHTTPFacilitatorClient(&x402http.FacilitatorConfig{ URL: "https://api-merchant.cryptonly.net/x402", AuthProvider: apiKey(os.Getenv("CRYPTONLY_API_KEY")), }) routes := x402http.RoutesConfig{ "GET /v1/weather/:city": { Accepts: x402http.PaymentOptions{ {Scheme: "exact", Price: "$0.01", Network: "eip155:8453", PayTo: os.Getenv("PAY_TO")}, }, Description: "Current weather for a city", }, } r := gin.Default() r.Use(ginmw.X402Payment(ginmw.Config{ Routes: routes, Facilitator: facilitator, Schemes: []ginmw.SchemeConfig{{Network: "eip155:8453", Server: evm.NewExactEvmScheme()}}, })) r.GET("/v1/weather/:city", func(c *gin.Context) { c.JSON(200, gin.H{"city": c.Param("city"), "temperatureC": 21}) }) r.Run(":4021") } ``` Test it with steps 5 and 6 of the [quickstart](https://docs.cryptonly.net/guides/x402/quickstart.md). After its first payment, the route shows up on the **Endpoints** tab as **Priced in code**. ## Accept Solana Register `ExactSvmScheme` from `@x402/svm/exact/server` for the [Solana network ID](https://docs.cryptonly.net/guides/x402.md#networks-and-assets) and use your Solana wallet as `payTo`. The scheme gets Cryptonly's fee payer from the facilitator, so there's nothing else to configure. In NestJS, install `@x402/svm` instead: `@X402()` registers it for a Solana `network`. ## Test in the sandbox Pass `sandbox: true` (Python: `sandbox=True`; Go: use `https://sandbox-api-merchant.cryptonly.net/x402`), change the network to `eip155:84532` (Base Sepolia), and use a key and wallet from your [sandbox account](https://docs.cryptonly.net/guides/sandbox-environment.md). ## Related pages - [Discovery](https://docs.cryptonly.net/guides/x402/discovery.md#list-an-endpoint-priced-in-code): List a route priced in code for agents to find - [x402 reference](https://docs.cryptonly.net/guides/x402/reference.md): Packages, key scopes and reason codes # x402 payouts and fees > Choose where x402 payments land, your own wallet or on Base your Cryptonly balance, and how the $0.0025 settlement fee is paid from x402 credits or from the payment. Payments go to one of two places. You choose for each network under **Settings → Payouts**. Base and Solana. Payments go straight to you, and Cryptonly never holds the money. Fees come from prepaid [x402 credits](#x402-credits). Base only. Payments are added to your balance, where you can convert or withdraw them. The fee is taken from each payment. Open payout settings ## Your own wallet Click **Verified wallets → Add wallet** and sign a message to prove the wallet is yours. Browser wallets and Safe multisigs both work. With several wallets, click **Use as payTo** on the one that should get paid. Cryptonly only pays wallets you added. A payment to any other address fails with `pay_to_rejected`. ### Solana wallets Any wallet that signs messages works, such as Phantom or Solflare. On Solana, a wallet needs a token account for each token before it can receive it. A wallet that has ever held USDC or USDT already has one. Otherwise, send it a small amount of the token once. **Token accounts** shows which tokens are ready, and payments in any other token are refused. ## Cryptonly balance (Base) Select **Cryptonly balance** and save. Your account gets a settlement address on Base for buyers to pay. With prices in the dashboard, the middleware uses it automatically. With [prices in code](https://docs.cryptonly.net/guides/x402/prices-in-code.md), set it as `payTo` in your routes. Each payment is added to your balance, minus the fee, after 10 Base blocks (about 20 seconds). Direct transfers to this address are added too, a few minutes after they confirm. ## Fees | | Fee | | --- | --- | | First 100 payments each month, across all your accounts | Free | | After that, own wallet | $0.0025 per payment, from x402 credits | | After that, Cryptonly balance | $0.0025 per payment, taken from the payment in the paid token | | Failed and refused payments | Free | | Sandbox | Free | ## x402 credits Credits are a prepaid USDC balance that pays the fees for own-wallet payments. One balance covers Base and Solana. - **Top up** moves USDC from your account balance into credits. **Move to balance** moves it back. - **Auto top-up** adds credits when they run low, for example "add 5 USDC when below 1 USDC". It needs enough USDC on your balance. - **History** lists every top-up and fee. When credits run out, payments fail with `fee_balance_insufficient`. The dashboard warns you before that happens. Top up credits ## Related pages - [Payments and webhooks](https://docs.cryptonly.net/guides/x402/payments-and-webhooks.md): Payment history, statuses and webhooks - [Balances and conversions](https://docs.cryptonly.net/guides/balances-transfers-and-conversions.md): Convert or withdraw what lands on your balance # x402 payments and webhooks > Find every x402 payment in the dashboard or through the API, follow its status, receive signed webhooks, and download monthly statements. ## Payments The **Payments** tab lists every payment. You can search by transaction hash, filter by endpoint, date, payer or recipient, and export the list as CSV. Click a payment to see its amount, fee, status history and on-chain transaction. The API returns the same data from `GET /x402/settlements` and `GET /x402/settlements/{id}`, with the x402 key from the quickstart. ## Statuses | Status | Meaning | | --- | --- | | `submitted` | Sent to the network, waiting for confirmation. | | `confirmed` | Final on-chain: after 10 blocks on Base, or about 13 seconds on Solana. The fee is charged at this point. | | `credited` | Cryptonly balance only: added to your balance, minus the fee. | | `failed` | The payment didn't go through. No fee is charged. | ## Webhooks Add an `https` URL under **Settings → Webhooks** to get notified about payments. Open webhook settings | Event | When | | --- | --- | | `x402.payment.settled` | The payment is confirmed on-chain. | | `x402.payment.failed` | The payment didn't go through. | | `x402.payment.credited` | Cryptonly balance only: the payment, minus the fee, is on your balance. Direct transfers to your settlement address send only this event. | Webhooks are signed and retried like every Cryptonly webhook. Check the `x-webhook-signature` header as shown in [Verify a webhook](/api-reference/webhooks/#verify-a-webhook). The body contains the payment, in the same shape as `GET /x402/settlements/{id}`: ```json { "event": "x402.payment.settled", "data": { "id": "0b6e4d8a-3c1f-4a2e-9d7b-5f8c2e1a6b30", "status": "confirmed", "accountId": "4f1c9a2e-7b3d-4e8f-a6c5-2d9b8e7f1a03", "payoutMode": "wallet", "origin": "facilitator", "network": "eip155:8453", "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "amount": "10000", "payer": "0x93f3a1c5e7b9d2f4a6c8e0b2d4f6a8c0e2b42e2e", "payTo": "0x7a3B5e9C1d2F4a6b8C0e2D4f6A8b0C2d4E6f8A1b", "transaction": "0x27ca1b5b9ccb3e8d006a5230de9bda23ff91edc794d4f56410560830b4c7a1e3", "errorReason": null, "fee": "2500", "feeCurrency": "USDC_BASE", "resourceUrl": "https://api.acme.com/v1/weather/:city", "resourceId": "9d2c4b6a-1e3f-4a5b-8c7d-0e9f1a2b3c4d", "createdAt": "2026-10-22T17:07:12.000Z", "confirmedAt": "2026-10-22T17:07:34.000Z", "creditedAt": null }, "timestamp": "2026-10-22T17:07:35.000Z" } ``` `amount` and `fee` are in the token's smallest unit. USDC has 6 decimals, so `10000` is 0.01 USDC. ## Related pages - [Verify a webhook](https://docs.cryptonly.net/api-reference/webhooks.md#verify-a-webhook): Signature check in Node.js, Python, Go, PHP and Java - [List settlements](https://docs.cryptonly.net/api-reference/openapi/operations/listx402settlements/): API reference for x402 payments # x402 discovery > List your paid endpoints in Cryptonly's public x402 discovery (Bazaar) feed, from the dashboard or from your code, so AI agents and x402 directories can find them. The discovery feed is Cryptonly's public list of paid endpoints. AI agents and x402 directories read it to find APIs they can pay for. Listing is optional and free. ## Set up your listing Each account is listed as one service, under its listing name and icon. Set them before you list endpoints: - **Listing name**: set it in x402 **Settings › Discovery**. Use up to 32 Latin letters, digits, spaces or punctuation. It goes into every `402` as `resource.serviceName`. **An account without a listing name is not listed.** - **Icon**: the logo from the account's checkout branding (light version first), sent as `resource.iconUrl`. Use a square PNG, JPEG or WebP; marketplaces show it at favicon size and don't support SVG. Open discovery settings ## List an endpoint priced in the dashboard Turn on **List publicly** when you add or edit an endpoint. The **Status** column of the **Endpoints** tab shows which endpoints are listed. Open endpoints Agents choose endpoints by what they read about them: | Field | What it tells agents | | --- | --- | | Description | What the endpoint returns and when to call it, in plain language, up to 500 characters. Sent as `resource.description`. | | Tags | Up to 5 topics, such as `weather` or `finance`, that marketplaces search by. Sent as `resource.tags`. | Install `@x402/extensions` next to your `@cryptonly/x402-*` package too. It then adds the route template and path parameters to the endpoint's `402` response. The **Advanced** fields describe the endpoint for agents: | Field | What it tells agents | | --- | --- | | Payment timeout | How long a signed payment stays valid. Sent as `maxTimeoutSeconds`. | | Response type | The content type of the response, such as `application/json`. | | Input JSON Schema | How to call the endpoint: query parameters for GET, HEAD and DELETE, the body for POST, PUT and PATCH. | | Output JSON Schema | What the endpoint returns. | ## List an endpoint priced in code Add the Bazaar extension to the route, on top of the setup from [Prices in your code](https://docs.cryptonly.net/guides/x402/prices-in-code.md): ```ts server.registerExtension(bazaarResourceServerExtension); app.use( paymentMiddleware( { 'GET /v1/quote/:symbol': { accepts: [ { scheme: 'exact', price: '$0.005', network: 'eip155:8453', payTo: process.env.PAY_TO! }, ], description: 'Token price quote', tags: ['finance', 'prices'], extensions: declareDiscoveryExtension({ output: { example: { symbol: 'SOL', usd: 150.25 } }, }), }, }, server, ), ); ``` ```ts @X402({ accepts: { scheme: 'exact', price: '$0.005', network: 'eip155:8453', payTo: process.env.PAY_TO! }, description: 'Token price quote', tags: ['finance', 'prices'], extensions: declareDiscoveryExtension({ output: { example: { symbol: 'SOL', usd: 150.25 } }, }), }) @Get('quote/:symbol') quote(@Param('symbol') symbol: string) { return { symbol, usd: 150.25 }; } ``` `@X402()` registers the Bazaar extension itself when `@x402/extensions` is installed. ```python # pip install "x402[extensions]" from x402.extensions.bazaar import OutputConfig, bazaar_resource_server_extension, declare_discovery_extension server.register_extension(bazaar_resource_server_extension) routes = { "GET /v1/quote/:symbol": RouteConfig( accepts=PaymentOption(scheme="exact", price="$0.005", network="eip155:8453", pay_to=os.environ["PAY_TO"]), description="Token price quote", tags=["finance", "prices"], extensions=declare_discovery_extension(output=OutputConfig(example={"symbol": "SOL", "usd": 150.25})), ), } ``` The route is listed after its first payment. A route with path parameters is listed once, as `/v1/quote/:symbol`. The feed takes the description and tags from your `402`, and the name and icon from your listing. ## Staying listed - Every 10 minutes, Cryptonly makes an unpaid request to each listed endpoint. It must answer `402` and ask to be paid to one of your addresses. - An endpoint that fails 3 checks in a row, or passes none for 24 hours, is removed from the feed. It comes back once it passes again. - To remove an endpoint yourself, turn off **List publicly**, or stop declaring discovery in code. - Your account needs a [listing name](#set-up-your-listing). - You can list up to 50 endpoints per account. - Endpoints of verified businesses are marked with `extensions.cryptonly.verifiedMerchant: true`. ## Read the feed The feed is public JSON in the x402 Bazaar format, at `GET https://api.cryptonly.net/x402/discovery/resources`: ```bash curl "https://api.cryptonly.net/x402/discovery/resources?limit=20" ``` Open the feed The sandbox feed is at `https://sandbox-api.cryptonly.net/x402/discovery/resources`. The feed needs no API key. Each item carries `serviceName`, `iconUrl` and `tags` next to `description` and `accepts`. Filter with `payTo`, `network`, `scheme` and `extensions` (for example `extensions=bazaar`), and page with `limit` and `offset`. Or use a client: ```ts const { items } = await fetchDiscoveryResources({ network: 'eip155:8453', limit: 50 }); ``` ```ts const client = withBazaar( new HTTPFacilitatorClient({ url: 'https://api.cryptonly.net/x402' }), ); const { items } = await client.extensions.bazaar.listResources(); ``` ```python # pip install "x402[extensions]" from x402.extensions.bazaar import with_bazaar from x402.http import FacilitatorConfig, HTTPFacilitatorClientSync client = with_bazaar(HTTPFacilitatorClientSync(FacilitatorConfig(url="https://api.cryptonly.net/x402"))) items = client.extensions.bazaar.list_resources().items ``` # x402 reference > Limits, packages, facilitator URLs, API key scopes, buyer clients, /settle responses and every reason code of the Cryptonly x402 facilitator. ## Limits | Limit | Value | | --- | --- | | Smallest payment | 0.005 of any token | | `maxTimeoutSeconds` | 1 to 3600 | | `/verify` | 600 requests per minute per account | | `/settle` | 300 requests per minute per account | Requests over the rate limits get HTTP `429`. ## Packages The official packages send your API key and pick the facilitator URL for you. Source code: [cryptonly-net/x402](https://github.com/cryptonly-net/x402) on GitHub. ### Other x402 clients Any x402 facilitator client works. Point it at the facilitator URL and send your API key in the `x-tenant-api-key` header. ``` https://api-merchant.cryptonly.net/x402 ``` In the sandbox: `https://sandbox-api-merchant.cryptonly.net/x402`. To see what the facilitator supports without a key, open [`https://api.cryptonly.net/x402/supported`](https://api.cryptonly.net/x402/supported). In the sandbox: `https://sandbox-api.cryptonly.net/x402/supported`. It lists every network, scheme and fee payer. With your key, `/supported` on the facilitator URL lists only what your account accepts. ## API key scopes An x402 key can only call x402 endpoints. It can't create invoices or withdrawals, so it's safe to keep on the server that sells your API. | Scope | Allows | | --- | --- | | `x402.verify` | `POST /x402/verify`, `GET /x402/supported` and `GET /x402/config` | | `x402.settle` | `POST /x402/settle` | | `x402.list` | `GET /x402/settlements` and `GET /x402/settlements/{id}` | ## Buyer clients The [quickstart](https://docs.cryptonly.net/guides/x402/quickstart.md) pays with TypeScript. The same call in Python and Go: ```bash pip install "x402[httpx,evm]" ``` ```python from eth_account import Account from x402 import x402Client from x402.http.clients import wrapHttpxWithPayment from x402.mechanisms.evm.exact import register_exact_evm_client from x402.mechanisms.evm.signers import EthAccountSigner client = x402Client() register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["BUYER_PRIVATE_KEY"]))) async def main(): async with wrapHttpxWithPayment(client) as http: response = await http.get("http://localhost:4021/v1/weather/paris") print(response.status_code, response.json()) asyncio.run(main()) ``` ```bash go get github.com/x402-foundation/x402/go ``` ```go package main "fmt" "io" "net/http" "os" x402 "github.com/x402-foundation/x402/go" x402http "github.com/x402-foundation/x402/go/http" evm "github.com/x402-foundation/x402/go/mechanisms/evm/exact/client" evmsigners "github.com/x402-foundation/x402/go/signers/evm" ) func main() { signer, err := evmsigners.NewClientSignerFromPrivateKey(os.Getenv("BUYER_PRIVATE_KEY")) if err != nil { panic(err) } client := x402.Newx402Client().Register("eip155:*", evm.NewExactEvmScheme(signer, nil)) pay := x402http.WrapHTTPClientWithPayment(http.DefaultClient, x402http.Newx402HTTPClient(client)) resp, err := pay.Get("http://localhost:4021/v1/weather/paris") if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(resp.StatusCode, string(body)) } ``` ## Settle responses `/settle` sends the payment to the network and waits a few seconds for it to land in a block. | Result | Response | | --- | --- | | Landed | `success: true` and the transaction hash. The buyer gets the response. | | Not landed yet | `success: false`, `errorReason: settlement_pending` and the transaction hash. See [below](#pending-payments). | | Refused | `success: false` and a [reason code](#reason-codes). Nothing is sent and no fee is charged. | A successful response includes the expected fee in `extra.feeAtomic`, in the smallest unit of the token at `extra.feeAsset`. It's `0` within the free tier. The fee actually charged is on the payment and in its webhook. Retries are safe. Sending the same signed payment again returns the original transaction and sends nothing new. After the response, the payment becomes `confirmed`, `credited` or `failed`. See [Statuses](https://docs.cryptonly.net/guides/x402/payments-and-webhooks.md#statuses). ### Pending payments `settlement_pending` means the payment was sent but hadn't landed when `/settle` answered. It usually lands a moment later. Stock x402 middleware still treats it as a failure and doesn't return your response to the buyer. Its final status shows up on the **Payments** tab and in [webhooks](https://docs.cryptonly.net/guides/x402/payments-and-webhooks.md#webhooks). ## Reason codes `/verify` and `/settle` return failures as HTTP `200` with a reason, as the x402 specification requires. On top of the standard x402 reasons, Cryptonly uses these: | Reason | What happened | What to do | | --- | --- | --- | | `settlement_disabled` | Your account is waiting for business verification, is suspended, or settlement is paused. | Finish business verification. Otherwise contact support. | | `pay_to_rejected` | `payTo` isn't one of your wallets or your settlement address. | Use an address from **Settings → Payouts**. | | `fee_balance_insufficient` | Your x402 credits don't cover the fee. | [Top up credits](https://docs.cryptonly.net/guides/x402/payouts-and-fees.md#x402-credits) or turn on auto top-up. | | `compliance_rejected` | The buyer or `payTo` failed sanctions screening, or screening was unavailable. | Contact support if you think this is a mistake. | | `authorization_already_used` | This signed payment was already settled. | Nothing. The buyer needs to sign a new payment. | | `permit2_allowance_required` | The buyer paid through Permit2 without approving it for the token. | The buyer approves Permit2 for the token. | | `settlement_pending` | Sent, but not in a block yet. | See [Pending payments](#pending-payments). | | `invalid_exact_svm_recipient_token_account_missing` | Solana: your wallet has no token account for this token. | Send the token to your wallet once. See [Solana wallets](https://docs.cryptonly.net/guides/x402/payouts-and-fees.md#solana-wallets). | | `invalid_exact_svm_recipient_token_account_frozen` | Solana: the token issuer froze your token account. | Use another wallet. | | `invalid_exact_svm_recipient_token_account_invalid` | Solana: your token account's address holds something else. | Use another wallet. | | `gas_ceiling_exceeded`, `gas_budget_exhausted`, `tenant_gas_budget_exhausted`, `fee_payer_reserve_low`, `fee_payer_busy` | Cryptonly hit a limit on the network fees it pays, or is busy. | Try again later. Daily limits reset at 00:00 UTC. | Something not covered here? Write to **support@cryptonly.net**. # Supported currencies > Supported cryptocurrencies, networks, and fiat settlement currencies, and how to fetch them via the API. Cryptonly currently supports these cryptocurrencies. The code in the first column is the `cryptoCurrencyCode` you send and receive in the API. | Network | Currency codes | | --- | --- | | Bitcoin | `BTC` | | Ethereum | `ETH`, `USDT_ERC20`, `USDC_ERC20`, `LINK_ERC20` | | BNB Smart Chain | `BNB`, `USDT_BEP20`, `USDC_BEP20`, `LINK_BEP20` | | Base | `ETH_BASE`, `USDC_BASE`, `EURC_BASE` | | Tron | `TRX`, `USDT_TRC20` | | Solana | `SOL`, `USDC_SOL`, `USDT_SOL` (production only) | On Solana, `USDC_SOL` and `USDT_SOL` are SPL tokens. Each payment address is a fresh wallet, so the payer's wallet also creates the token account for it and pays its one-time rent, about 0.002 SOL. Wallets do this automatically. Fiat settlement currencies (used as `fiatCurrencyCode` on `POST /invoice`) include USD, EUR, and other common currencies — see `GET /currencies/fiat` for the exact list available to your account. ## Fetching currencies via the API `GET /currencies` lists supported cryptocurrencies. Filter by network with `?network=`, for example `?network=Tron`. Each entry includes: | Field | Meaning | | --- | --- | | `decimalPlaces` | Precision of amounts in this currency | | `minDepositAmount` | Smallest accepted deposit, already raised to cover the network fee | | `depositNetworkFee` | Current [deposit network fee](https://docs.cryptonly.net/guides/fees-and-commissions.md#deposit-network-fee). `null` while deposits in this currency are temporarily refused | | `depositCommission` | Your organization's effective deposit commission rate | | `minWithdrawalAmount` | Smallest accepted withdrawal | | `contractAddress` | Token contract (the mint on Solana), for tokens only | | `addressMask` | Optional regex for client-side address validation | `GET /currencies/fiat` lists the fiat currencies you can price invoices in, with `decimalPlaces` and `minInvoiceAmount`. Use these endpoints rather than hardcoding currency lists or minimums — available assets and thresholds can change per organization and over time. ## Related pages - [Choosing a payment method](https://docs.cryptonly.net/guides/choosing-a-payment-method.md): Invoices, deposits, and withdrawals - [On-chain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md): Confirmation requirements per network - [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md): Network fees and commissions - [Invoices](https://docs.cryptonly.net/guides/invoices.md): Fiat currencies used to price an invoice # On-chain confirmations > How many on-chain confirmations an incoming payment needs on each network before it is processed. An incoming transaction will not be processed until it reaches the required number of on-chain confirmations for that network. Requirements are **fixed per network** and do not depend on the transaction amount. Until the count is reached, the invoice or deposit stays in `created`; it moves to `processing` once the confirmations are in. | Network | Assets | Required confirmations | | --- | --- | --- | | Bitcoin | BTC | 4 | | Ethereum | ETH and ERC-20 tokens | 6 | | Tron | TRX and TRC-20 tokens | 10 | | BNB Smart Chain | BNB and BEP-20 tokens | 15 | | Base | ETH, USDC, EURC | 10 | | Solana | SOL and SPL tokens (USDC, USDT) | Finalized | Solana has no confirmation count. A payment is processed once its block is finalized, usually about 13 seconds after the transfer. ## Related pages - [Supported currencies](https://docs.cryptonly.net/guides/supported-currencies.md): Assets on each of these networks - [Invoice processing lifecycle](https://docs.cryptonly.net/guides/invoices/processing-lifecycle.md): Invoice payments wait for these confirmations - [Deposit processing lifecycle](https://docs.cryptonly.net/guides/deposits/processing-lifecycle.md): Deposits wait for these confirmations - [Choosing a payment method](https://docs.cryptonly.net/guides/choosing-a-payment-method.md): Invoices and deposits share this pipeline # Fees and commissions > Where network fees and commissions apply across deposits, invoices, withdrawals, and auto-converting. Cryptonly applies fees at a few distinct points in the payment flow. Rates can be organization-specific — always read the actual rate from the API response rather than hardcoding it. ## Deposit network fee Every deposit gets its own on-chain address. Once the deposit completes, Cryptonly moves the funds from that address to its own wallet, and that transfer costs a network fee. The payer covers it: * **Invoices:** the fee is added on top of the invoice amount when the customer picks a currency. The payment page shows it in the invoice's fiat currency (for example, "Fee \~0.42 $ · Approx. 2 min"). The crypto amount to send already includes it. * **Deposits:** the fee is withheld from the received amount. The deposit page shows a "You pay network fee" badge. The fee is fixed when the deposit is created, so later gas price changes don't affect it. It is taken before the commission is calculated, so you don't pay commission on it. The current fee per currency is returned as `depositNetworkFee` on [`GET /currencies`](https://docs.cryptonly.net/guides/supported-currencies.md) and refreshes every few minutes. While it is `null`, new deposits and invoice payments in that currency are temporarily refused (`503`, code `exceptions.depositFee.quoteUnavailable`), and the currency is hidden from the payment page. ## Deposit commission Every completed deposit — standalone or invoice-linked — has a commission deducted before the remainder is credited to your balance. The commission is calculated on the received amount minus the deposit network fee. The effective rate for your organization is returned as `depositCommission` on [`GET /currencies`](https://docs.cryptonly.net/guides/supported-currencies.md). ## Withdrawal network fee `POST /withdrawal/quote` returns a `fee` breakdown with the real on-chain network fee, in both the network's base currency (`feeNative`/`feeCurrency`) and the withdrawal currency. This fee, plus the withdrawal amount, is debited from your balance when the quote is committed — see [Withdrawals lifecycle](https://docs.cryptonly.net/guides/withdrawals/withdrawals-lifecycle.md). ## Conversions Conversions between USDT and USDC are free and convert at 1:1. Every other pair has a **0.2%** commission. The commission is in the source asset and is included in the amount debited. For example, converting 1 BTC to USDT debits 1 BTC: 0.002 BTC is the commission, and the remaining 0.998 BTC converts at the current rate. The same rule applies to conversions in the Cryptonly Merchant Dashboard, deposit auto-conversion, and [auto-converting](https://docs.cryptonly.net/guides/withdrawals/auto-converting.md) on a withdrawal. See [Balances, transfers, and conversions](https://docs.cryptonly.net/guides/balances-transfers-and-conversions.md). ## Where to check exact amounts * `GET /currencies` — `depositNetworkFee`, `depositCommission`, `minDepositAmount`, `minWithdrawalAmount` per crypto currency * `settlement` on a completed deposit or paid invoice (API and webhooks) — `amountPaid`, `commissionAmount`, and `netAmount`, all in the crypto currency of the payment (`netAmount` is `amountPaid` minus the withheld deposit network fee and `commissionAmount`). `networkFeeAmount` there is the fee of the payer's own inbound transaction, paid by their wallet, and is informational * `POST /withdrawal/quote` response — `fee` breakdown and `totalDeduction` for a specific withdrawal, and `autoConvert.commissionAmount` when a conversion covers a shortfall * Conversion quote in the Cryptonly Merchant Dashboard — the commission before you confirm * Transaction History detail drawer (**Accounts → History**) — commission and net credited amount for any past deposit, and the commission on a conversion ## Related pages - [Supported currencies](https://docs.cryptonly.net/guides/supported-currencies.md): Where deposit fees and commissions are listed - [Withdrawals lifecycle](https://docs.cryptonly.net/guides/withdrawals/withdrawals-lifecycle.md): Quote fee and the amount debited on commit - [Auto-converting](https://docs.cryptonly.net/guides/withdrawals/auto-converting.md): Cross-currency payouts and their conversion commission - [Balances, transfers, and conversions](https://docs.cryptonly.net/guides/balances-transfers-and-conversions.md): Cryptonly Merchant Dashboard conversions and deposit auto-conversion # Balances, transfers, and conversions > How merchant balances work across accounts, and the Transfer and Conversion entries you'll see in Transaction History. Your organization can have multiple **accounts**, each holding a separate balance per **asset** (e.g. `USDT`, `USDC`, `BTC`). Two Cryptonly Merchant Dashboard actions move funds between assets or accounts without an on-chain deposit or withdrawal. ## Transfers Members with the Owner, Admin or Finance role can move balance from one of your accounts to another (**Accounts → Overview → Transfer**). Transfers are same-asset: 1. Choose the accounts, asset, network and amount, then click **Review** to check the account names and available balance. 2. Click **Confirm transfer** to move the funds. Most transfers are **internal** — between two of your own accounts. Transfers can also be marked **external**, moving funds to an account outside your organization. ## Conversions A conversion exchanges one asset for another at the current rate (e.g. USDC → USDT). Conversions are available only in the **Cryptonly Merchant Dashboard**. You'll also see them as a side effect of [auto-converting withdrawals](https://docs.cryptonly.net/guides/withdrawals/auto-converting.md). USDT ↔ USDC converts at 1:1 with no commission. Every other pair has a 0.2% commission, taken in the source asset and included in the amount you send — see [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md). To convert, open **Accounts → Overview**, open the asset's actions menu and choose **Convert**. **Review quote** locks the rate and shows the commission, and **Confirm conversion** completes it. A member with the Owner, Admin or Finance role can turn on deposit auto-conversion under **Accounts → Settings → Auto-conversion**: **Global** converts every deposit into one asset, and **Advanced** sets a target per deposit asset. When a deposit is credited, only the net amount (after the network fee and deposit commission) is converted, with the same conversion commission, and that conversion shows up in history like any other. Transfers, and conversions started from the Cryptonly Merchant Dashboard or to fund a withdrawal, are not converted again. A deposit that is already in the target asset stays as it is. ## Where to see this Go to **Accounts → History** and filter by type (`transfer` or `conversion`), or open **Accounts → Overview** for current per-asset balances. See [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md) for more on the History drawer. ## Related pages - [Deposits](https://docs.cryptonly.net/guides/deposits.md): Deposit auto-conversion credits the net amount - [Auto-converting withdrawals](https://docs.cryptonly.net/guides/withdrawals/auto-converting.md): Conversions that fund a payout - [Withdrawals](https://docs.cryptonly.net/guides/withdrawals.md): Payouts from an account balance - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): Transaction History for transfers and conversions # Managing access & roles > Invite your team to the Cryptonly Merchant Dashboard, choose what each person can do, and keep accounts secure. Everyone in your organisation has one role. All roles can see the whole dashboard; the role decides what a person can change. ## Roles | | Owner | Admin | Developer | Finance | Viewer | | --- | :-: | :-: | :-: | :-: | :-: | | View the dashboard | ✓ | ✓ | ✓ | ✓ | ✓ | | Create invoices, deposits and accounts | ✓ | ✓ | ✓ | ✓ | | | Withdraw, transfer and convert | ✓ | ✓ | | ✓ | | | API keys and webhook signing keys | ✓ | ✓ | ✓ | | | | Simulate payments, test and resend webhooks | ✓ | ✓ | ✓ | | | | Organisation settings | ✓ | ✓ | | | | | Verification documents | ✓ | ✓ | | | | | Invite and manage members | ✓ | ✓ | | | | | Single sign-on and SCIM | ✓ | ✓ | | | | | Transfer ownership | ✓ | | | | | * There is one **Owner**: the person who created the organisation. The role can't be assigned, only [transferred](#transferring-ownership). * **Admins** manage Developers, Finance members and Viewers, but not other Admins. * Nobody can change their own role. ## Inviting a member 1. Go to **Members** and click **Invite member**. 2. Enter the email address and pick a role. 3. Choose when the link expires (1, 7, 14 or 30 days) and click **Send invitation**. The invitee gets an email with an **Accept invitation** button. They set a password, or continue with Google or GitHub using the invited address. Open invitations are listed under **Invitations**. **Resend** emails a new link valid for 7 days and disables the old one; **Revoke** disables the link immediately. You can send up to 10 invitations an hour, and one address can only have one open invitation. :::note An account belongs to one organisation. Someone already working in another Cryptonly organisation can't accept your invitation with the same email address. ::: ## Changing roles and removing members Use **Change role** or **Remove** on a member's row. A removed member loses access immediately and is signed out on all devices. You can invite them again later. To leave an organisation yourself, click **Leave organisation** on your own row. The owner has to transfer ownership first. ## Transferring ownership Ownership can only go to an Admin. Click **Transfer ownership**, choose the new owner, then confirm with a code sent to your email and with [two-factor authentication](#securing-your-account). You become an Admin, and both of you get an email. Two-factor authentication must be on to transfer ownership. ## Securing your account Each person manages their own sign-in in **Settings → Privacy & security**: * **Two-factor authentication.** Add a passkey (Touch ID, Face ID, Windows Hello or a security key), an authenticator app such as Google Authenticator or 1Password, or both. Once one is on, every sign-in asks for it after your password or Google/GitHub. Without it, password sign-in asks for a code sent by email. [SSO](https://docs.cryptonly.net/guides/setting-up-sso.md) sign-ins leave this step to your identity provider. * **Sign-in methods.** Google and GitHub link to your account the first time you use them with the same email address. * **Password.** **Send reset link** emails a link that is valid for 15 minutes. * **Active sessions.** See where you are signed in and sign out other devices. Adding or removing a passkey or the authenticator app signs out your other devices and emails you. Add more than one passkey, or a passkey and the app, so losing one device doesn't lock you out. ### Requiring two-factor authentication The Owner and Admins can make two-factor authentication mandatory for everyone in the organisation. In **Settings → General**, turn on **Require two-factor authentication** and confirm with your own two-factor authentication. You need it on your account before you can turn the requirement on. * Members without a passkey or an authenticator app see a setup screen instead of the dashboard, both at their next sign-in and in sessions that are already open. Once they add one, they continue as usual. * Members who sign in with [SSO](https://docs.cryptonly.net/guides/setting-up-sso.md) are exempt; your identity provider handles their second factor. * While the requirement is on, nobody can remove their only passkey or authenticator app. Add another one first. * To see who hasn't set it up, turn on the **2FA** column on the **Members** page under **Customization**. ### Security verification Sensitive actions, such as removing a passkey or [transferring ownership](#transferring-ownership), ask you to confirm it's you before they go through. Depending on the action, a **Security verification** window asks for a code sent to your email, two-factor authentication, or both. * **Email code.** Click **Get code** and enter the 6-digit code from the email. It is valid for 10 minutes, and you can ask for a new one after 60 seconds. * **Two-factor authentication.** Your passkey is offered first. To use a code instead, click **Use authenticator app instead**. * Some actions don't ask again for a few minutes after you confirm. * After five wrong codes, close the window and start the action again. :::caution[Lost your passkey and authenticator app?] Write to [support@cryptonly.net](mailto:support@cryptonly.net) from your account's email address. Support checks it's you, then removes your second factors so you can sign in with an email code and set them up again. ::: To have your team sign in through your company's identity provider instead, see [Setting up SSO](https://docs.cryptonly.net/guides/setting-up-sso.md). ## Related pages - [Setting up SSO](https://docs.cryptonly.net/guides/setting-up-sso.md): Okta, Microsoft Entra ID, Google Workspace and SCIM - [Authorization](https://docs.cryptonly.net/api-reference/authorization.md): Create and manage API keys - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Signing keys, retries and test events - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): Simulate payments and send test webhooks # Notifications and the Cryptonly bot > Get an email or a Telegram message from the official Cryptonly bot when an invoice is paid, a withdrawal goes out, or your team and security settings change. Cryptonly can tell you when something happens in your organisation: by email, in a private chat with the official Cryptonly bot on Telegram, or in a Telegram group the whole team shares. Every notification is off until you turn it on. ## What you can be notified about | Event | When it's sent | Who can turn it on | | --- | --- | --- | | Invoice paid | A customer paid an invoice in full, or paid more | Everyone | | Invoice underpaid | A customer sent less than the invoice amount | Everyone | | Late payment | A payment arrived after the invoice expired | Everyone | | Invoice expired | An invoice expired without a payment | Everyone | | Payment received | A payment without an invoice was confirmed, for example a top-up | Everyone | | x402 payment | An x402 payment was settled. Can be frequent | Everyone | | Withdrawal sent | A withdrawal was confirmed on chain | Everyone | | Withdrawal failed | A withdrawal could not be completed | Everyone | | Verification decision | Your business verification was approved or rejected | Owner, Admin | | New team member | Someone joined the organisation | Owner, Admin | | New API key | An API key was created for one of your accounts | Owner, Admin, Developer | | Two-factor changes | Your authenticator app or a passkey was added or removed (Telegram only; you always get an email for this) | Everyone, for themselves | Each message names the organisation and has a link that opens the payment or setting in the dashboard. Messages are in the language you use the dashboard in, English or Russian. ## Choosing your notifications 1. In the dashboard, go to **Settings → Personal → Notifications**. 2. Tick **Email**, **Telegram** or both next to each event. **Turn on recommended** ticks paid and underpaid invoices, late payments, received payments and withdrawals. 3. Click **Save**. Emails go to the address you sign in with. Each email has a link back to these settings. ## Connecting the Cryptonly bot The [official Cryptonly Telegram bot](https://t.me/CryptonlyBot) is **@CryptonlyBot**. Connect it from the dashboard, not by searching Telegram, so that you know you have the right bot. 1. Go to **Settings → Personal → Notifications** and click **Connect Telegram**. 2. Telegram opens a chat with @CryptonlyBot. Press **Start**. 3. The bot confirms the connection and the dashboard shows your Telegram username. Click **Send test message** to check it. The connection link works once and expires after 10 minutes. To stop messages, click **Disconnect** in the dashboard or send `/stop` to the bot. If you block the bot, the dashboard shows the chat as **Not reachable** until you reconnect it. Your choices stay saved either way. :::caution The Cryptonly bot never asks for your password, seed phrases, API keys or payments. Treat any bot or account that does as fake, and report it to [connect@cryptonly.net](mailto:connect@cryptonly.net). ::: ## A team chat Owners and Admins can connect one Telegram group for the whole organisation. It gets its own set of events, separate from everyone's personal choices. 1. Go to **Settings → Organisation → Notifications** and click **Add bot to a group**. 2. Telegram asks which group to add @CryptonlyBot to. Pick the group your team uses. 3. Back in the dashboard, tick the events the group should get and click **Save**. Removing the bot from the group stops the messages. Disconnecting in the dashboard stops them too, but the bot stays in the group until someone removes it in Telegram. ## Sandbox The [sandbox](/guides/sandbox-environment/) uses its own bot, **@CryptonlySandboxBot**, so test payments never look like real ones. Connect it the same way from the sandbox dashboard. # Setting up SSO > Let your team sign in to the Cryptonly Merchant Dashboard through Okta, Microsoft Entra ID, Google Workspace or any OpenID Connect or SAML 2.0 identity provider. With single sign-on (SSO), people with your company email addresses sign in to the Merchant Dashboard through your identity provider. You can also create their accounts on first sign-in, make SSO mandatory, and sync members with SCIM. The Owner and Admins set it up in **Settings → Single sign-on**. You also need admin access to your identity provider and to your domain's DNS. ## Supported identity providers - Okta - Microsoft Entra ID - Google Workspace - Any other OpenID Connect or SAML 2.0 provider The Google and GitHub buttons on the sign-in page are for individual accounts and work without any setup. SSO is configured for your whole organisation. ## Setting up SSO 1. **Verify your domain** Enter your email domain, for example `acme.com`, and click **Add domain**. Add the TXT record shown to your DNS, then click **Check DNS**. Leave the record in place. It is checked every week, and if it is missing for 14 days, SSO turns off for that domain. Public email domains such as gmail.com can't be verified. 2. **Create an app in your identity provider** Under **Identity provider**, pick the protocol and your provider. The values your identity provider needs are shown right away: the **Redirect URI** for OpenID Connect, or the **ACS URL** and **Entity ID** for SAML 2.0. Use them to create the app, as described in [Provider notes](#provider-notes), and assign it to the people who should have access. 3. **Connect it** Give the connection a name and paste the details from your identity provider: **Issuer URL**, **Client ID** and **Client secret** for OpenID Connect, or **Single sign-on URL** and **Signing certificate (PEM)** for SAML 2.0. Click **Connect**. 4. **Test and activate** Click **Test sign-in** and sign in with an account on a verified domain. Once the test succeeds, click **Activate**. Editing an active connection turns it off until a new test sign-in succeeds. ## Provider notes SAML apps must send the user's email address as the Name ID and sign their assertions. Sign-in starts from Cryptonly; signing in from the identity provider's app dashboard isn't supported. * **OpenID Connect:** create an **OIDC – OpenID Connect** app of type **Web Application** and add the Redirect URI as a sign-in redirect URI. The Issuer URL is your Okta domain, such as `https://acme.okta.com`. * **SAML 2.0:** use the ACS URL as **Single sign-on URL**, the Entity ID as **Audience URI**, and set **Name ID format** to `EmailAddress`. * **OpenID Connect:** add an **App registration** with the Redirect URI as a **Web** redirect URI, then create a client secret. The Issuer URL is `https://login.microsoftonline.com//v2.0`; shared endpoints such as `/common` are rejected. * **SAML 2.0:** add an **Enterprise application**, use the Entity ID as **Identifier** and the ACS URL as **Reply URL**. If user principal names differ from email addresses, set **Unique User Identifier** to `user.mail`. * **SAML 2.0** (recommended): in the Google Admin console, open **Apps → Web and mobile apps → Add custom SAML app**. Enter the ACS URL and Entity ID, set **Name ID** to **Primary email**, then turn the app on for your users. * **OpenID Connect:** create an OAuth client of type **Web application** in Google Cloud with the Redirect URI. The issuer is filled in for you. Only Workspace accounts on your verified domains can sign in; personal Google accounts are refused. * **OpenID Connect:** the Issuer URL must serve `/.well-known/openid-configuration`. * **SAML 2.0:** if your provider imports metadata, give it the **Metadata URL**. ## Sign-in policy Once a connection exists, **Sign-in policy** controls who joins and how: * **Create accounts on first sign-in.** People on your verified domains join the organisation the first time they sign in, with the **Role for new members** you choose: Viewer, Developer or Finance. A pending invitation's role takes priority. When this is off, only invited people can join. * **Require single sign-on.** Members on your verified domains must sign in through SSO, and their password and Google or GitHub sessions end. This option is available once the connection is active. * **Allowed to use a password.** Members who can still use a password while SSO is required. The owner always can. :::caution Before you require SSO, add at least one Admin with two-factor authentication to **Allowed to use a password**. That way someone can still sign in if your identity provider is down. ::: ## User provisioning (SCIM) SCIM lets your identity provider add, update and deactivate members automatically. It doesn't change how people sign in. Click **Create token** and copy it; it is shown only once. In your identity provider's provisioning settings, enter the **SCIM base URL** from the card, and paste the token as the bearer token. * Only users are synced, not groups. New members get their invitation's role, or the **Role for new members**. * Only addresses on verified domains are synced. * Deactivating a user in your identity provider signs them out of Cryptonly. The owner can't be deactivated through SCIM. * Up to 5 tokens can be active. To rotate, create a new token, update your identity provider, then revoke the old one. ## How your team signs in On the sign-in page, members click **Sign in with SSO** and enter their work email, which takes them to your identity provider. Your identity provider handles multi-factor authentication. When SSO is required, someone who tries a password is sent to SSO instead. ## Troubleshooting | Message | What to check | | --- | --- | | Single sign-on is not set up for this email domain. | The domain is not verified, or the connection is not active. | | Your email domain is not verified for this organization's single sign-on. | Your identity provider returned an email on another domain. Check the user's email there, or verify that domain. With Google Workspace, this is also shown for personal Google accounts. | | You do not have access to this organization yet. | Invite the person, or turn on **Create accounts on first sign-in**. | | This account belongs to another organization. | The email is already used in another Cryptonly organisation. Contact support. | | Single sign-on is not available right now. | The member's account is deactivated, or already linked to a different account in your identity provider. | ## Turning SSO off * **Turn off** stops SSO sign-in and also turns off **Require single sign-on**. * **Delete connection** removes it. Members who signed in through SSO then use a password or Google or GitHub. To switch between OpenID Connect and SAML, delete the connection and connect again. * Removing a domain stops SSO for addresses on it. ## Related pages - [Managing access & roles](https://docs.cryptonly.net/guides/managing-access-and-roles.md): Roles, invitations and two-factor authentication - [Authorization](https://docs.cryptonly.net/api-reference/authorization.md): API keys for server-to-server requests # Sandbox environment > Sandbox Cryptonly Merchant Dashboard and API on testnets, with no mainnet funds. Use the sandbox to test invoices, hosted checkout pages, deposits, withdrawals, API integrations, and webhook handling without real funds. | | Sandbox | Production | | --- | --- | --- | | Cryptonly Merchant Dashboard | [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net) | [merchant.cryptonly.net](https://merchant.cryptonly.net) | | API base URL | `https://sandbox-api-merchant.cryptonly.net` | `https://api-merchant.cryptonly.net` | | Networks | Testnets only | Mainnets | | Funds | Testnet funds | Real funds | Sandbox and production are separate: accounts, API keys, and webhook signing keys from one don't work in the other. Create sandbox account Open sandbox dashboard ## Testnets The sandbox does **not** use mainnet networks. Do not send mainnet assets to sandbox addresses. Funds sent by mistake may not be recoverable. | Network | Sandbox network | | --------------- | --------------- | | Ethereum | ETH Sepolia | | BNB Smart Chain | BSC Testnet | | Base | Base Sepolia | | Tron | Tron Shasta | | Bitcoin | BTC Testnet | | Solana | Solana Devnet | ### Solana Devnet tokens - **SOL**: the [Solana faucet](https://faucet.solana.com). - **USDC** (`USDC_SOL`): Circle's [USDC faucet](https://faucet.circle.com), with Solana Devnet selected. Mint `4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU`. - **USDT**: Tether has no Solana devnet token, so the sandbox has no `USDT_SOL`. It is available in production. ## Testing flow 1. Log in to the sandbox Cryptonly Merchant Dashboard. 2. Create a test invoice in the dashboard or through the API. 3. Open its payment page and select a currency on one of the testnet networks. 4. Send testnet funds to the generated payment address. 5. Wait for the payment status to update. 6. Verify the payment in the Cryptonly Merchant Dashboard. 7. Confirm that your webhook endpoint receives the expected events. 8. Test balance and withdrawal behavior where applicable. To skip the testnet transfer entirely, use **Simulate payment** — see [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). ## Related pages - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): History and test webhooks without a transfer - [Invoices](https://docs.cryptonly.net/guides/invoices.md): Create the checkout payment the sandbox flow starts with - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Events the sandbox sends to your endpoint - [Withdrawals](https://docs.cryptonly.net/guides/withdrawals.md): Payout behavior to try before going live # Testing your integration > Two Cryptonly Merchant Dashboard tools for verifying your integration: Transaction History and Test webhooks. Beyond sending real (or testnet) payments, the Cryptonly Merchant Dashboard gives you two tools to verify an integration without writing extra code: * **Transaction History** — inspect real invoices, deposits, and withdrawals and their full status history, optionally driven by a sandbox payment simulator. * **Test webhooks** — send a synthetic, signed webhook to your endpoint on demand, independent of any real object. ## Transaction History Go to **Accounts → History**. The table lists invoices, deposits, withdrawals, conversions, and transfers for the selected account. You can filter by type and status, or search by ID, order ID, or transaction hash. Click a row to open the detail drawer. Its **Status history** section shows every status transition with a timestamp and source (`API`, `Admin`, `Payment page`, or `System`) — the quickest way to confirm your object moved through the statuses you expect. For invoices in the sandbox environment, the drawer also offers **Simulate payment** (Owner, Admin or Developer role). Pick a **Payment outcome** (paid in full, partially paid, overpaid or failed) and Cryptonly runs the invoice through the real settlement pipeline and sends real `invoice.statusChanged` webhooks, without a testnet transfer. **Expire invoice** tests the expiry path. See [Sandbox environment](https://docs.cryptonly.net/guides/sandbox-environment.md) for the testnet-based flow, and the status pages for what each status means: [invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md), [deposit statuses](https://docs.cryptonly.net/guides/deposits/statuses.md), [withdrawal statuses](https://docs.cryptonly.net/guides/withdrawals/statuses.md). ## Testing a plugin or integration without sending crypto Plugins create a **real** Cryptonly invoice for each order, tagged with an `orderId` you can recognize: | Plugin | `orderId` example | | --- | --- | | [WooCommerce](https://docs.cryptonly.net/integration/plugins/woocommerce.md) | `WC-123` | | [WHMCS](https://docs.cryptonly.net/integration/plugins/whmcs.md) | `WHMCS-45` | | [Blesta](https://docs.cryptonly.net/integration/plugins/blesta.md) | `BLESTA-12` | | [FOSSBilling](https://docs.cryptonly.net/integration/plugins/fossbilling.md) | `FOSS-12` | | [Medusa](https://docs.cryptonly.net/integration/plugins/medusa.md) | Starts with the Medusa payment session ID | To confirm the whole round trip — plugin creates invoice, customer pays, your store/CRM gets notified — without moving testnet funds: 1. Place a test order through the plugin or integration as usual, so it creates a Cryptonly invoice. 2. In the Cryptonly Merchant Dashboard, go to **Accounts → History** and search for that order's `orderId` to find the matching invoice. 3. Open the invoice and click **Simulate payment**. 4. Cryptonly settles the invoice for real and sends the resulting `invoice.statusChanged` webhook exactly as it would for a genuine payment — to the invoice's `webhookUrl`, which is how every plugin receives it. 5. Confirm the plugin reacted as expected (order marked paid, and so on). This only works while the invoice is still simulatable (typically `created`, before a real payment settles it) and requires the Owner, Admin or Developer role in the sandbox. ## Test webhooks Go to **Settings → Integration → Test webhooks** (Owner, Admin or Developer role). Choose the **Signing account** whose key signs the test, a **Webhook type** — Invoice, Deposit (merchant API) or Withdrawal, which send `invoice.statusChanged`, `deposit.statusChanged` or `withdrawal.statusChanged` — and a status. Enter your webhook URL and an `orderId`, then click **Send test webhook**. The payload is synthetic (sample amounts, random IDs), but it is **signed with your real webhook signing key**, so this is a valid way to test signature verification and handler logic in isolation. It does not create or update any invoice, deposit, or withdrawal. See [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md) for signature verification and payload structure. ## Which one to use | Goal | Use | | ---- | --- | | Verify a real object moves through the expected statuses | Transaction History (with the payment simulator in sandbox) | | Verify your endpoint is reachable, signature verification works, and your handler behaves correctly | Test webhooks | ## Related pages - [Sandbox environment](https://docs.cryptonly.net/guides/sandbox-environment.md): Testnet payments and the invoice simulator - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Signature verification and payload shape # SDK > Official JavaScript / TypeScript SDK for the Cryptonly merchant API. Cryptonly provides an official JavaScript / TypeScript SDK for server-side integrations. The SDK helps you work with the merchant API faster by giving you a typed client for common operations such as invoice creation, withdrawals, and account access, without having to build raw HTTP requests manually. It is designed for trusted backend environments only and authorizes requests with your account's [API key](https://docs.cryptonly.net/api-reference/authorization.md). The SDK also includes helpers to [verify webhooks](https://docs.cryptonly.net/api-reference/webhooks.md#verify-a-webhook). Install the package from npm: ```bash npm install @cryptonly/sdk ``` ## Quick start ```ts const client = new Cryptonly({ apiKey: process.env.CRYPTONLY_API_KEY!, sandbox: true, // omit to call production }); const invoice = await client.invoice.create({ amount: 100, fiatCurrencyCode: 'USD', description: 'Order #123', orderId: 'order_123', }); ``` ## Related pages - [API reference](https://docs.cryptonly.net/api-reference.md): The merchant API this client calls - [Authorization](https://docs.cryptonly.net/api-reference/authorization.md): The API key the client sends - [Invoices](https://docs.cryptonly.net/guides/invoices.md): Create a checkout payment - [Withdrawals](https://docs.cryptonly.net/guides/withdrawals.md): Quote and commit a payout - [x402 packages](https://docs.cryptonly.net/guides/x402/reference.md#packages): Facilitator clients for Node.js and Python # AI coding assistants > Integrate Cryptonly with Claude Code, Cursor, Codex, or Copilot: a ready-made prompt and the Markdown docs, llms.txt, and OpenAPI schema assistants read. You can hand the integration to an AI coding assistant such as Claude Code, Cursor, Codex, or GitHub Copilot. The documentation is published in plain Markdown for them, so the assistant reads the same guides you do. ## Prompt to start with Paste this into your assistant from the root of your project: ```text Integrate Cryptonly crypto payments into this project. Start with https://docs.cryptonly.net/llms.txt and open the pages you need; every link there is a Markdown page. The API schema is https://api.cryptonly.net/tenant-api-docs-yaml. - If the shop runs on a platform with a Cryptonly plugin (WooCommerce, WHMCS, Blesta, FOSSBilling, Paymenter, Medusa, Vendure, FluentCart), set up the plugin instead of writing custom code. - On a Node.js / TypeScript backend use @cryptonly/sdk; otherwise call the REST API. - Work against the sandbox: https://sandbox-api-merchant.cryptonly.net, or sandbox: true in the SDK. - Read the API key and the webhook signing key from CRYPTONLY_API_KEY and CRYPTONLY_WEBHOOK_SECRET. Never hard-code them. - Create one invoice per order with my order ID as orderId, and send the customer to paymentPageUrl. - Handle the invoice.statusChanged webhook: verify x-webhook-signature against the raw request body, and fulfil orders by the rules in https://docs.cryptonly.net/guides/invoices/statuses.md. - Tell me how to test the whole flow with Simulate payment in the sandbox dashboard. ``` Adjust the list to your case. For pay-per-request APIs and AI agents that pay you, point the assistant at [x402 payments](https://docs.cryptonly.net/guides/x402.md) instead. ## What assistants can read | Source | URL | Use it for | | --- | --- | --- | | Index | [docs.cryptonly.net/llms.txt](https://docs.cryptonly.net/llms.txt) | A list of every page with a one-line summary. The best starting point. | | Full text | [docs.cryptonly.net/llms-full.txt](https://docs.cryptonly.net/llms-full.txt) | All guides in one file, for assistants that take a large context. | | Single page | Add `.md` to a page URL, e.g. [docs.cryptonly.net/quickstart.md](https://docs.cryptonly.net/quickstart.md) | One guide in Markdown. | | OpenAPI schema | [api.cryptonly.net/tenant-api-docs-yaml](https://api.cryptonly.net/tenant-api-docs-yaml) | Every endpoint, request, and response field. | | SDK | [`@cryptonly/sdk`](https://www.npmjs.com/package/@cryptonly/sdk) | A typed client, so the assistant gets field names from the types. | | Context7 | [`/llmstxt/cryptonly_net_llms-full_txt`](https://context7.com/llmstxt/cryptonly_net_llms-full_txt) | Up-to-date docs inside Cursor, Claude Code, and other clients with the Context7 MCP server. Add "use context7" to your prompt. | Every guide also has a **Copy page** menu next to its title: copy the page as Markdown, open it as Markdown, or open it in ChatGPT or Claude. ## Next steps - [Quickstart](https://docs.cryptonly.net/quickstart.md): The flow the prompt builds, step by step - [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md): Which statuses to fulfil on - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): Sandbox scenarios to run before going live - [Plugins](https://docs.cryptonly.net/integration/plugins.md): Ready-made checkout plugins # Plugins We develop ready-made plugins for fast and secure integration of Cryptonly with popular platforms and regularly update their list. For each module, we provide step-by-step instructions, so the process of connecting your project takes just a few minutes. - [WooCommerce](https://docs.cryptonly.net/integration/plugins/woocommerce.md): Accept crypto on WooCommerce checkout - [WHMCS](https://docs.cryptonly.net/integration/plugins/whmcs.md): Accept crypto on WHMCS invoices - [Blesta](https://docs.cryptonly.net/integration/plugins/blesta.md): Accept crypto in Blesta - [FOSSBilling](https://docs.cryptonly.net/integration/plugins/fossbilling.md): Accept crypto in FOSSBilling - [Paymenter](https://docs.cryptonly.net/integration/plugins/paymenter.md): Accept crypto on Paymenter invoices - [Medusa](https://docs.cryptonly.net/integration/plugins/medusa.md): Accept crypto in Medusa v2 - [Vendure](https://docs.cryptonly.net/integration/plugins/vendure.md): Accept crypto in Vendure - [FluentCart](https://docs.cryptonly.net/integration/plugins/fluentcart.md): Accept crypto in FluentCart Need a plugin for another platform? Write to **support@cryptonly.net**. ## Related pages - [Invoices](https://docs.cryptonly.net/guides/invoices.md): The checkout payment every plugin creates - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): How plugins confirm a payment - [Sandbox](https://docs.cryptonly.net/guides/sandbox-environment.md): Test a plugin with testnet funds - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): Simulate payment without sending crypto # WooCommerce **Cryptonly - Crypto Payment Gateway for WooCommerce** lets your store accept cryptocurrency payments through Cryptonly's secure hosted checkout. Customers select Cryptonly at checkout, pay on the Cryptonly payment page, and return to your store. WooCommerce order statuses are updated automatically when Cryptonly sends signed `invoice.statusChanged` webhooks. The plugin supports both classic WooCommerce checkout and WooCommerce Blocks. ## How the payment flow works ```mermaid sequenceDiagram participant Customer participant WooStore as WooCommerceStore participant Cryptonly Customer->>WooStore: Place order with Cryptonly WooStore->>Cryptonly: Create invoice Cryptonly-->>WooStore: paymentPageUrl WooStore-->>Customer: Redirect to hosted checkout Customer->>Cryptonly: Pay with crypto Cryptonly->>WooStore: invoice.statusChanged webhook WooStore-->>Customer: Order status updated ``` At a high level: 1. The customer places a WooCommerce order and chooses Cryptonly as the payment method. 2. The plugin creates a Cryptonly invoice server-side (your API key never reaches the browser). 3. The customer is redirected to the Cryptonly hosted payment page. 4. After payment, Cryptonly sends webhooks to your store. 5. The plugin verifies each webhook and updates the WooCommerce order status. For more detail on invoices and statuses, see [Invoices](https://docs.cryptonly.net/guides/invoices.md). ## Requirements Before installing the plugin, make sure you have: | Requirement | Details | | ------------------------ | -------------------------------------------------------------- | | WordPress | 6.0 or higher | | WooCommerce | 7.1 or higher | | PHP | 7.4 or higher | | Cryptonly account | [Cryptonly merchant account](https://merchant.cryptonly.net/) | | Supported store currency | Your WooCommerce store currency must be supported by Cryptonly | :::note The plugin is compatible with WooCommerce HPOS (High-Performance Order Storage) and includes bundled translations for English, Spanish, German, and Russian. ::: ## Install the plugin The plugin is available in the official WordPress plugin directory: 1. In WordPress, go to **Plugins → Add New**. 2. Search for **Cryptonly**. 3. Click **Install Now**, then **Activate**. 1. Download the plugin zip from the [WordPress.org plugin page](https://wordpress.org/plugins/cryptonly-crypto-payment-gateway-for-woocommerce/). 2. In WordPress, go to **Plugins → Add New → Upload Plugin** and upload the zip. Or, move the `cryptonly-crypto-payment-gateway-for-woocommerce` folder to `/wp-content/plugins/` on your server (via FTP, SFTP, or your hosting file manager) and activate it from the **Plugins** menu. After activation, go to **WooCommerce → Settings → Payments → Cryptonly** and enable the payment method. ## Configure the plugin Open **WooCommerce → Settings → Payments → Cryptonly** and review each setting. First enable the payment method, then complete the **Connection** settings, customize customer-facing text, and adjust **Advanced** options only if needed. | Setting | Purpose | | ----------------------------- | --------------------------------- | | **Enable Cryptonly payments** | Turn the payment method on or off | **Connection** | Setting | Purpose | | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **API Key** | Cryptonly API key. The key selects the account. See [required scopes](https://docs.cryptonly.net/integration/plugins/woocommerce.md#api-key-scopes) | | **Webhook Signing Key** | Signing key from that account’s Security settings. Used to verify incoming Cryptonly webhooks | | **Public site URL** | Optional public HTTPS base URL for generated webhook and merchant return links (return / success / failed CTAs). Leave empty on public HTTPS stores; set it when the WordPress site URL is local or private | | **Webhook URL** | Read-only preview of the webhook endpoint sent with each invoice | | **Sandbox Mode** | Use the Cryptonly sandbox API for test payments | ### API key scopes Create the key on the account’s **Security** settings and enable only these scopes: | Scope | Used for | | ----- | -------- | | `invoices.create` | Create the invoice at checkout (`POST /invoice`) | | `invoices.list` | Load an existing invoice when create returns a duplicate `orderId` (`GET /invoice`) | | `invoices.cancel` | Cancel the invoice when the WooCommerce order is cancelled (`POST /invoice/cancel`) | | `currencies.list` | Check that the store currency is supported (`GET /currencies/fiat`) | **Customization** | Setting | Purpose | | ------------------------- | ---------------------------------------------------------------------------------------- | | **Title** | Payment method name shown at checkout (default: Pay with Cryptonly) | | **Description** | Short text shown under the payment method at checkout (default: Pay securely with cryptocurrency via Cryptonly.) | | **Instructions** | Optional text on the thank-you page and in customer emails for pending or on-hold orders | | **Resume payment button** | Button label that returns customers to the Cryptonly payment page (default: Complete payment) | **Advanced** | Setting | Purpose | | ---------------------- | ---------------------------------------------------------------------------------------------------------------- | | **Order ID Prefix** | Prefix for Cryptonly `orderId` values (default: `WC-`). Must not end with a digit. Use a unique prefix per store | | **Compatibility Mode** | Send only the final order total when line-item totals do not match because of checkout or pricing plugins | | **Debug Log** | Write Cryptonly events to **WooCommerce → Status → Logs** (source: `cryptonly`) | **Webhook URL behavior** The plugin sends a `webhookUrl` automatically on every invoice it creates. You do **not** need to configure a default invoice webhook in the Cryptonly Merchant Dashboard for the standard WooCommerce flow. The **Webhook URL** field in plugin settings is a preview for troubleshooting only. In production it must be a public HTTPS address, for example: ``` https://your-store.com/?wc-api=WC_Gateway_Cryptonly ``` ### Merchant return URLs On each invoice the plugin sends browser **“Return to merchant”** CTAs (not webhooks / not auto-redirects). Order status still updates via the HTTPS `webhookUrl`. | Field | WooCommerce URL | Shown when Cryptonly invoice is | |---|---|---| | `returnUrl` | Thank-you / order-received | `cancelled`, `expired` | | `successUrl` | Thank-you / order-received | `paid`, `overpaid` | | `failedUrl` | Order-pay (retry payment) | `failed`, `suspended`, `partially_paid` | Cryptonly accepts any `http`/`https` URL for these fields (including `http://localhost:…` for local testing). See [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md) for the full status → URL map. If your WordPress site URL is local or private (for example during staging), set **Public site URL** to your public HTTPS domain so Cryptonly can reach the webhook endpoint and rewrite merchant return URLs onto the correct store host. For webhook signing details, see [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md). ## Test in sandbox before going live 1. Register at the [sandbox Cryptonly Merchant Dashboard](https://sandbox-merchant.cryptonly.net). 2. Copy your sandbox **API Key** and **Webhook Signing Key** from the account Security settings. 3. In the plugin settings, enable **Sandbox Mode**. 4. Enter your sandbox credentials and save. 5. Place a test order and complete payment on the Cryptonly [sandbox payment page](https://docs.cryptonly.net/guides/sandbox-environment.md) using testnet assets only, or use **Simulate payment** on the invoice in Cryptonly **Accounts → History** to settle it without sending testnet funds. 6. Confirm the WooCommerce order updates to **Completed**. See the [Sandbox environment](https://docs.cryptonly.net/guides/sandbox-environment.md) guide for supported test networks and safety notes, and [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md) for more on the History and simulator tools. :::caution Sandbox uses testnets only. Do not send mainnet funds to sandbox payment addresses. ::: ## Customer checkout experience 1. The customer adds products to the cart and goes to checkout. 2. They select the Cryptonly payment method and place the order. 3. WooCommerce creates the order and the plugin creates a Cryptonly invoice. 4. The customer is redirected to the Cryptonly hosted payment page. 5. After payment, the customer returns to your store thank-you page. **If the customer abandons payment** The WooCommerce order stays open while the Cryptonly invoice is still payable. The customer can return to the payment page from: * the thank-you page * order details * customer emails * customer orders list ## How order statuses are updated The plugin listens for `invoice.statusChanged` webhooks and maps Cryptonly invoice statuses to WooCommerce order statuses: | Cryptonly invoice status | WooCommerce order status | | ------------------------- | ------------------------ | | `created` | pending | | `processing`, `suspended` | on-hold | | `paid`, `overpaid` | completed | | `partially_paid` | on-hold | | `expired`, `failed` | failed | | `cancelled` | cancelled | Key behavior: * Webhooks are the source of truth for payment status updates. * The plugin verifies the `x-webhook-signature` header using your **Webhook Signing Key**. * Once an order is paid or completed, later out-of-order webhooks will not downgrade it. * The invoice (and its WooCommerce order) stays `pending` from checkout until an on-chain transaction is detected, then moves to **on-hold**; there is no separate "deposit address generated" webhook. For the full invoice lifecycle, see [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md). ## Go live checklist Before accepting real payments: * [ ] Disable **Sandbox Mode** * [ ] Enter production **API Key** and **Webhook Signing Key** * [ ] Confirm your store uses a public HTTPS URL * [ ] Confirm the webhook preview in plugin settings shows `https://…` * [ ] Confirm the **Webhook Signing Key** in the plugin matches the account Security settings in Cryptonly * [ ] Place a small real test order * [ ] Verify the order moves from pending/on-hold to completed after payment ## Troubleshooting **Cryptonly is not shown at checkout** * Go to **WooCommerce → Settings → Payments** and make sure Cryptonly is enabled. * Confirm **API Key** and **Webhook Signing Key** are filled in. * For block checkout, hard-refresh the page after saving settings. **“Unable to start Cryptonly payment”** Common causes: * Missing or invalid Cryptonly credentials * Store currency is not supported by Cryptonly * `webhookUrl` is not a valid public HTTPS URL (Cryptonly must reach it) * `returnUrl` / `successUrl` / `failedUrl` are not valid `http`/`https` URLs (localhost is allowed for local testing) If your WordPress site URL is local or private, set **Public site URL** to your public HTTPS domain for webhooks (or use a tunnel such as ngrok), and try again. **Webhooks are not arriving** * Confirm the webhook preview in plugin settings uses `https://…`, not `http://localhost` * Confirm your store is reachable from the public internet * Confirm the **Webhook Signing Key** in the plugin matches the account's **Accounts → Settings → Security** page * Enable **Debug Log** and check **WooCommerce → Status → Logs** (source: `cryptonly`) **Order stays pending after payment** * Check whether Cryptonly shows the webhook as delivered * Verify the webhook signing key is correct (invalid signatures are rejected) * Enable **Debug Log** and look for `Webhook received for event invoice.statusChanged` * Confirm the WooCommerce order exists and matches the Cryptonly invoice **Customer cannot resume payment** * The Cryptonly invoice may have expired or been cancelled * Ask the customer to place a new order if the invoice is no longer payable * Customize the resume button label under **Resume payment button** if needed **WooCommerce cancelled the order while payment was in progress** Crypto payments can take time to confirm on-chain. If orders are cancelled too early: * Increase **WooCommerce → Settings → Products → Inventory → Hold stock (minutes)**, or disable it * The order stays `pending` until an on-chain transaction is detected (invoice moves to `processing`, mapped to **on-hold**) ## Frequently asked questions **Which cryptocurrencies are supported?** Cryptonly supports Bitcoin, Ethereum, USDT, USDC, and many other cryptocurrencies. Available assets depend on your Cryptonly account and enabled networks. **Does it work with WooCommerce Blocks checkout?** Yes. The plugin supports both classic WooCommerce checkout and WooCommerce Blocks. **Can I customize checkout text?** Yes. In plugin settings you can change **Title**, **Description**, **Instructions**, and **Resume payment button**. **Do I need to configure webhooks in the Cryptonly Merchant Dashboard?** No. The WooCommerce plugin sends the webhook URL automatically with each invoice. You only need to enter the **Webhook Signing Key** in the plugin so incoming webhooks can be verified. **Can I run the store in another language?** Yes. The plugin includes bundled translations for Spanish, German, and Russian. Set your site language in **Settings → General → Site Language**. ## Related pages - [Invoices](https://docs.cryptonly.net/guides/invoices.md): How checkout payments work - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verification and payload details - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): History and simulated invoice payments ## Support For help with your Cryptonly merchant account, credentials, or payment questions, write to **support@cryptonly.net**. # WHMCS **Cryptonly** lets your WHMCS store accept Bitcoin, stablecoins and other cryptocurrencies through Cryptonly's secure hosted checkout. Customers pay on the Cryptonly payment page; WHMCS invoices are marked paid automatically. ## Requirements | Requirement | Details | | ----------------------- | ----------------------------------------------------------------- | | WHMCS | 8.0 or higher (tested up to 9.0.5) | | PHP | 7.4 or higher (tested up to 8.2) | | Cryptonly account | [cryptonly.net](https://cryptonly.net) merchant account | | Credentials | API key and webhook signing key from the account’s **Accounts → Settings → Security** page | | Public HTTPS System URL | Required so Cryptonly can deliver webhooks | ## Before you install — Cryptonly account 1. Sign up at [cryptonly.net](https://cryptonly.net) (or [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net) for testing). 2. Open **Accounts**, select the account, then **Settings → Security**. Create an **API key**. The key selects that account. 3. On the same page, under **Webhook signing key**, click **Rotate key** and copy the secret when it is shown. It appears only once, and the previous key stops working immediately. ## Install the module [https://cdn.cryptonly.net/plugins/whmcs/cryptonly-whmcs-stable.zip](https://cdn.cryptonly.net/plugins/whmcs/cryptonly-whmcs-stable.zip) 1. Download the Cryptonly WHMCS gateway zip (WHMCS Marketplace or release package). 2. Extract the archive on your computer. 3. Upload the `modules/` folder into your WHMCS root so it merges with the existing `modules/` directory (FTP, SFTP, or your hosting file manager). After upload, these paths should exist: ``` modules/gateways/cryptonly.php modules/gateways/cryptonly/ modules/gateways/callback/cryptonly.php ``` 4. In WHMCS admin, activate **Cryptonly**: * **Setup → Payments → Payment Gateways**, or * **System Settings → Apps & Integrations** (search "Cryptonly"). ## Configure the gateway ![WHMCS gateway settings](../../../../assets/plugins/whmcs-gateway.png) Open **Setup → Payments → Payment Gateways → Cryptonly → Manage Existing Gateway** and fill in the fields: | WHMCS field | What to enter | | ----------------------- | ------------------------------------------------------------------------ | | **Display Name** | Name shown to customers (e.g. `Pay with Crypto`) | | **API Key** | Cryptonly API key. The key selects the account. See [required scopes](https://docs.cryptonly.net/integration/plugins/whmcs.md#api-key-scopes) | | **Webhook Signing Key** | Required — payments are confirmed only via webhooks | | **Sandbox Mode** | Enable to use the Cryptonly sandbox API for testing | | **Order ID Prefix** | Optional; default `WHMCS` → `WHMCS-123`, `WHMCS-123-2` on retry | | **Debug Log** | Optional; writes entries to **Utilities → Logs → Gateway Log** | ### API key scopes Create the key on the account’s **Accounts → Settings → Security** page and enable only these scopes: | Scope | Used for | | ----------------- | --------------------------------------------------------------------------------------------------------------------------- | | `currencies.list` | Confirm the API key when saving the gateway (`GET /currencies`) | | `invoices.list` | Reuse a payable invoice or choose the next `orderId`, and load the invoice when create returns a duplicate (`GET /invoice`) | | `invoices.create` | Create the invoice at checkout (`POST /invoice`) | :::caution **Webhook Signing Key is mandatory.** Saving an API key without a signing key is blocked. Sandbox mode must match your API key environment (sandbox vs production). ::: Click **Save Changes**. The module validates the API key with Cryptonly `GET /currencies`. ## Test in sandbox 1. Enable **Sandbox Mode** and enter credentials from [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net). 2. Confirm **Setup → General Settings → System URL** is a public HTTPS address. 3. Create a test WHMCS invoice and select Cryptonly as the payment method. 4. Complete payment on the Cryptonly hosted page (testnet only in sandbox), or use **Simulate payment** on the invoice in Cryptonly **Accounts → History** to settle it without sending testnet funds — see [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). 5. Verify the WHMCS invoice is marked **Paid** and entries appear under **Utilities → Logs → Gateway Log**. 6. Optional: in the Cryptonly Merchant Dashboard, use **Settings → Integration → Test webhooks** against your callback URL — see [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). See the Sandbox environment guide for supported test networks and safety notes. ## How WHMCS invoice statuses are updated The module listens for `invoice.statusChanged` webhooks and applies payments only on settled amounts. Other statuses are logged to **Utilities → Logs → Gateway Log** without changing the WHMCS invoice: | Cryptonly invoice status | WHMCS behavior | | -------------------------------- | -------------------------------------------------------------------- | | `created` | Invoice stays **Unpaid** (customer may still pay on the hosted page) | | `processing`, `suspended` | Invoice stays **Unpaid**; status logged only | | `paid`, `overpaid` | Payment applied; invoice marked **Paid** when balance is cleared | | `partially_paid` | Partial payment applied to the WHMCS invoice | | `expired`, `failed`, `cancelled` | Logged only; no automatic payment | The WHMCS invoice stays **Unpaid** from checkout until Cryptonly reports a settled payment (`paid`, `overpaid`, or `partially_paid`). There is no separate webhook when the customer only selects a currency on the hosted page. :::caution Sandbox uses testnets only. Do not send mainnet funds to sandbox payment addresses. ::: ## Go live checklist Before accepting real payments: * [ ] Disable **Sandbox Mode** * [ ] Enter production **API Key** and **Webhook Signing Key** * [ ] Confirm **System URL** is public HTTPS * [ ] Place a small real test payment and confirm the invoice is marked **Paid** ## Related pages - [Invoices](https://docs.cryptonly.net/guides/invoices.md): How checkout payments work - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verification and payload details - [Sandbox](https://docs.cryptonly.net/guides/sandbox-environment.md): Test with testnet funds - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): History and simulated invoice payments ## Support For help with your Cryptonly merchant account, credentials, or payment questions, write to **support@cryptonly.net**. # Blesta > Accept cryptocurrency payments in Blesta through Cryptonly hosted checkout. **Cryptonly** lets your Blesta company accept Bitcoin, stablecoins, and other cryptocurrencies through Cryptonly's secure hosted checkout. Customers pay on the Cryptonly payment page. Blesta applies the settled amount only after a signed webhook. ## Requirements | Requirement | Details | | --- | --- | | Blesta | 6.0 or newer (tested on 6.0.0 and 6.0.3) | | PHP | 8.2, 8.3, or 8.4 | | Cryptonly account | [cryptonly.net](https://cryptonly.net) merchant account | | Credentials | API key and webhook signing key from the account’s **Accounts → Settings → Security** page | | Public HTTPS URL | Required so Cryptonly can deliver webhooks. Cryptonly does not follow redirects | ## Before you install — Cryptonly account 1. Sign up at [cryptonly.net](https://cryptonly.net) (or [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net) for testing). 2. Open **Accounts**, select the account, then **Settings → Security**. Create an **API key**. The key selects that account. 3. On the same page, under **Webhook signing key**, click **Rotate key** and copy the secret when it is shown. It appears only once, and the previous key stops working immediately. ## Install the gateway 1. Download the Cryptonly gateway from the [Blesta Marketplace](https://marketplace.blesta.com/extension/375). 2. Extract the archive in your Blesta root (FTP, SFTP, or your hosting file manager). The zip already contains the `components/` folder, so it merges with the existing one. After extraction, this file should exist: ``` components/gateways/nonmerchant/cryptonly/cryptonly.php ``` 3. In the Blesta staff area, open **Settings → Company → Payment Gateways → Available** and install **Cryptonly**. 4. Enable Cryptonly on the order form under **Packages → Order Forms**. Clients can also pay an open invoice from the client area. ## Configure the gateway Open **Settings → Company → Payment Gateways → Installed**, choose **Manage** next to Cryptonly, and fill in the fields: | Blesta field | What to enter | | --- | --- | | **API Key** | Cryptonly API key. The key selects the account. See [required scopes](https://docs.cryptonly.net/integration/plugins/blesta.md#api-key-scopes) | | **Webhook Signing Key** | Required. Payments are confirmed only via webhooks | | **Order ID Prefix** | Optional. Default `BLESTA` produces `BLESTA-12`, then `BLESTA-12-2` on a later attempt. Several invoices paid together use `BLESTA-12x34` | | **Sandbox Mode** | Enable to use the Cryptonly sandbox API for testing | | **Debug Log** | Optional. Writes entries to **Tools → Logs → Gateway** | The settings page shows the **Webhook URL**. The gateway also sends that URL with each invoice, so you do not paste it into the Cryptonly Merchant Dashboard. Leave the API key or signing key blank on a later save to keep the stored value. ### API key scopes Create the key on the account’s **Accounts → Settings → Security** page and enable only these scopes: | Scope | Used for | | --- | --- | | `currencies.list` | Confirm the API key when saving the gateway (`GET /currencies`) and list the fiat currencies this gateway can be enabled for (`GET /currencies/fiat`) | | `invoices.list` | Reuse a payable invoice or choose the next `orderId`, and load the invoice when create returns a duplicate (`GET /invoice`) | | `invoices.create` | Create the invoice at checkout (`POST /invoice`) | :::caution **Webhook Signing Key is mandatory.** Saving an API key without a signing key is blocked. Sandbox mode must match your API key environment (sandbox vs production). ::: Click **Update Settings**. The gateway validates the API key with Cryptonly `GET /currencies`. ## Test in sandbox 1. Enable **Sandbox Mode** and enter credentials from [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net). 2. Confirm the Blesta URL Cryptonly will call is public HTTPS. 3. Create a test Blesta invoice and choose **Pay with Cryptonly**. 4. Complete payment on the Cryptonly hosted page (testnet only in sandbox), or use **Simulate payment** on the invoice in Cryptonly **Accounts → History** to settle it without sending testnet funds. See [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). 5. Verify Blesta applied the payment and entries appear under **Tools → Logs → Gateway**. 6. Optional: in the Cryptonly Merchant Dashboard, use **Settings → Integration → Test webhooks** against your callback URL. See [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). See the Sandbox environment guide for supported test networks and safety notes. ## How Blesta invoices are updated The gateway listens for `invoice.statusChanged` webhooks and applies payments only on settled amounts. Returning from the hosted page does not mark the invoice paid. | Cryptonly invoice status | Blesta behavior | | --- | --- | | `created`, `processing` | No payment recorded. The customer may still pay on the hosted page | | `suspended` | A pending transaction is recorded. No funds are applied | | `paid`, `overpaid` | The amount still due is applied. An overpay is not added as client credit | | `partially_paid` | The fiat value received (share of crypto received × invoice amount, rounded down to the cent) is applied and the invoice stays open. The next checkout starts a new Cryptonly invoice for the remainder | | `expired`, `failed`, `cancelled` | No payment recorded. A later `paid` after `expired` can still be applied | Cryptonly invoice expiry follows the Blesta due date, from 15 minutes up to 30 days. :::caution Sandbox uses testnets only. Do not send mainnet funds to sandbox payment addresses. ::: The gateway does not send refunds or voids to Cryptonly. Record those in Blesta separately. ## Go live checklist Before accepting real payments: * [ ] Disable **Sandbox Mode** * [ ] Enter production **API Key** and **Webhook Signing Key** * [ ] Confirm the Blesta site URL is public HTTPS * [ ] Place a small real test payment and confirm the invoice is paid ## Related pages - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verification and payload details - [Invoices](https://docs.cryptonly.net/guides/invoices.md): How checkout payments work - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): History and test webhooks ## Support For help with your Cryptonly merchant account, credentials, or payment questions, write to **support@cryptonly.net**. # FOSSBilling > Accept cryptocurrency payments in FOSSBilling through Cryptonly hosted checkout. **Cryptonly** lets your FOSSBilling site accept Bitcoin, stablecoins, and other cryptocurrencies through Cryptonly's hosted checkout. Customers pay on the Cryptonly payment page. FOSSBilling records the money only after a signed webhook. A payment smaller than the invoice total is added as account credit. FOSSBilling marks the invoice paid when that credit covers the invoice total. An overpay is capped at the amount still due and is not stored as extra credit. ## Requirements | Requirement | Details | | --- | --- | | FOSSBilling | 0.8 or newer (tested with 0.8.8 and the current development branch) | | PHP | 8.2 or newer | | Cryptonly account | [cryptonly.net](https://cryptonly.net) merchant account | | Credentials | API key and webhook signing key from the account’s **Accounts → Settings → Security** page | | Public HTTPS URL | Required so Cryptonly can deliver webhooks. Cryptonly does not follow redirects | ## Before you install — Cryptonly account 1. Sign up at [cryptonly.net](https://cryptonly.net) (or [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net) for testing). 2. Open **Accounts**, select the account, then **Settings → Security**. Create an **API key**. The key selects that account. 3. On the same page, under **Webhook signing key**, click **Rotate key** and copy the secret when it is shown. It appears only once, and the previous key stops working immediately. ## Install the adapter 1. Download the Cryptonly adapter from the [FOSSBilling extension directory](https://extensions.fossbilling.org/extension/cryptonly-crypto-payment-gateway). 2. Extract the archive in your FOSSBilling root (FTP, SFTP, or your hosting file manager). The zip already contains the `library/` folder, so it merges with the existing one. After extraction, this file should exist: ```text library/Payment/Adapter/Cryptonly/Cryptonly.php ``` 3. Open **System → Payment gateways → New payment gateway** and install **Cryptonly**. ## Configure the gateway Fill in the fields on the Cryptonly gateway form: | FOSSBilling field | What to enter | | --- | --- | | **API Key** | Cryptonly API key. The key selects the account. See [required scopes](https://docs.cryptonly.net/integration/plugins/fossbilling.md#api-key-scopes) | | **Webhook Signing Key** | Required. Payments are confirmed only via webhooks | | **Order ID Prefix** | Optional. Default `FOSS` produces `FOSS-12`, then `FOSS-12-2` on a later attempt | In FOSSBilling's own **Gateway Behavior** section, turn on **Enabled**. Turn on **Enable Test Mode** to use the Cryptonly sandbox API. The adapter sends the webhook URL with each invoice, so you do not paste it into the Cryptonly Merchant Dashboard. FOSSBilling calls: ```text {siteurl}ipn.php?gateway_id={gateway_id}&invoice_id={invoice_id} ``` Leave the API key or signing key blank on a later save to keep the stored value. ### API key scopes Create the key on the account’s **Accounts → Settings → Security** page and enable only these scopes: | Scope | Used for | | --- | --- | | `currencies.list` | Confirm the API key when saving the gateway (`GET /currencies`) | | `invoices.list` | Reuse a payable invoice or choose the next `orderId`, and load the invoice when create returns a duplicate (`GET /invoice`) | | `invoices.create` | Create the invoice at checkout (`POST /invoice`) | :::caution **Webhook Signing Key is mandatory.** Saving an API key without a signing key is blocked. **Enable Test Mode** must match your API key environment (sandbox vs production). ::: Saving the gateway validates the API key with Cryptonly `GET /currencies`. ## Test in sandbox 1. Turn on **Enable Test Mode** and enter credentials from [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net). 2. Confirm the FOSSBilling URL Cryptonly will call is public HTTPS. 3. Open a test invoice and choose **Pay with Cryptonly**. 4. Complete payment on the Cryptonly hosted page (testnet only in sandbox), or use **Simulate payment** on the invoice in Cryptonly **Accounts → History** to settle it without sending testnet funds. See [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). 5. Confirm the invoice is paid, or that a partial payment appears as account credit. :::caution Sandbox uses testnets only. Do not send mainnet funds to sandbox payment addresses. ::: ## How FOSSBilling invoices are updated The adapter listens for `invoice.statusChanged` webhooks. Returning from the hosted page does not mark the invoice paid. | Cryptonly invoice status | FOSSBilling behavior | | --- | --- | | `created`, `processing` | No credit recorded | | `suspended` | No credit recorded | | `paid`, `overpaid` | The amount still due is added as account credit, then the invoice is paid from that credit. An overpay is not stored | | `partially_paid` | The fiat value received (share of crypto received × invoice amount, rounded down to the cent) is added as account credit. The invoice stays unpaid | | `expired`, `failed`, `cancelled` | No credit recorded. A later `paid` can still be applied | The next checkout after a partial charges what is still due. The order id is `FOSS-12`, then `FOSS-12-2` on a later attempt. Cryptonly invoice expiry follows the FOSSBilling due date, from 15 minutes up to 30 days. An invoice past its due date cannot start a new checkout. Subscriptions are off. A renewal invoice is paid with a new checkout. ## Go live checklist Before accepting real payments: * [ ] Turn off **Enable Test Mode** * [ ] Enter production **API Key** and **Webhook Signing Key** * [ ] Confirm the site URL is public HTTPS * [ ] Place a small real test payment and confirm the invoice is paid ## Related pages - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verification and payload details - [Invoices](https://docs.cryptonly.net/guides/invoices.md): How checkout payments work - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): History and test webhooks ## Support For help with your Cryptonly merchant account, credentials, or payment questions, write to **support@cryptonly.net**. # Paymenter > Accept cryptocurrency payments on Paymenter invoices through Cryptonly hosted checkout. **Cryptonly for Paymenter** lets your Paymenter site accept Bitcoin, stablecoins, and other cryptocurrencies through Cryptonly's hosted checkout. Customers open an invoice, click **Pay**, choose Cryptonly, and pay on the Cryptonly payment page. Invoices stay in your Paymenter currency. Paymenter records the payment only after a signed `invoice.statusChanged` webhook, and marks the invoice paid once nothing is left to pay. ## How the payment flow works ```mermaid sequenceDiagram participant Customer participant Paymenter participant Cryptonly Customer->>Paymenter: Pay invoice with Cryptonly Paymenter->>Cryptonly: Create invoice for the amount due Cryptonly-->>Paymenter: paymentPageUrl Paymenter-->>Customer: Redirect to hosted checkout Customer->>Cryptonly: Pay with crypto Cryptonly->>Paymenter: invoice.statusChanged webhook Paymenter-->>Customer: Invoice marked paid ``` At a high level: 1. The customer clicks **Pay** on a Paymenter invoice and chooses the Cryptonly gateway. 2. The extension creates a Cryptonly invoice server-side for the amount still due. Your API key never reaches the browser. 3. The customer is redirected to the Cryptonly hosted payment page. 4. After payment, Cryptonly sends a signed webhook to Paymenter. 5. The extension verifies the webhook and records the payment on the invoice. For more detail on invoices and statuses, see [Invoices](https://docs.cryptonly.net/guides/invoices.md). ## Requirements | Requirement | Details | | --- | --- | | Paymenter | 1.5 or newer (tested with 1.5.9) | | PHP | 8.3 or newer | | Cryptonly account | [Cryptonly merchant account](https://merchant.cryptonly.net/) | | Public HTTPS App URL | Paymenter’s **Settings → General → App URL** must be a public HTTPS address so Cryptonly can deliver webhooks. Cryptonly does not follow redirects | | Supported invoice currency | The invoice currency must be one Cryptonly prices. Other currencies do not show the gateway | ## Before you install — Cryptonly account 1. Sign up at [cryptonly.net](https://cryptonly.net), or at [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net) for testing. 2. Open **Accounts**, select the account, then **Settings → Security**. Create an **API key**. The key selects the account. 3. On the same page, under **Webhook signing key**, click **Rotate key** and copy the secret when it is shown. It appears only once, and the previous key stops working immediately. ## Install the extension Download `cryptonly-paymenter-1.0.0.zip` from the [Paymenter marketplace](https://paymenter.org/marketplace), then install it one of two ways: 1. In Paymenter admin, open **Extensions → Available Extensions → Ready to Install / Upload**. 2. Click **Upload Extension**, choose the zip, and click **Submit**. 1. Extract the zip into your Paymenter `extensions/Gateways/` folder (FTP, SFTP, or your hosting file manager). After extraction, this file should exist: ```text extensions/Gateways/Cryptonly/Cryptonly.php ``` 2. Make sure the web server user can read the new folder. To update, upload the newer zip the same way. Paymenter replaces the folder and keeps the gateway settings. ## Configure the gateway Open **Extensions → Gateways**, click **New**, and choose **Cryptonly** under **Gateway**. Enter a **Name**, which is what customers see at checkout, then fill in the gateway settings. | Setting | Purpose | | --- | --- | | **Name** | The payment method name customers see, for example `Crypto` | | **API Key** | Cryptonly API key. The key selects the account. See [required scopes](#api-key-scopes) | | **Webhook Signing Key** | Signing key from the same account’s Security page. Paymenter rejects webhooks it cannot verify | | **Sandbox mode** | Tick for a sandbox API key from [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net) | | **Order ID Prefix** | Optional. Default `PAYMENTER` produces `PAYMENTER-12`, then `PAYMENTER-12-2` on a later attempt. Use a different prefix for each site that shares an account | | **Debug log** | Writes Cryptonly API responses to the Paymenter log (`storage/logs`). The API key is never logged | | **Webhook URL** | Read-only. The address Cryptonly calls, built from App URL | Saving checks the API key with Cryptonly `GET /currencies`. A sandbox key is refused unless **Sandbox mode** is ticked, and a production key is refused while it is ticked. The extension sends the webhook URL with each invoice, so you do not paste it into the Cryptonly Merchant Dashboard: ```text {App URL}/extensions/gateways/cryptonly/webhook ``` :::caution Paymenter builds this URL from **Settings → General → App URL**, which overrides `APP_URL` in `.env`. If App URL is not public HTTPS, checkout stops with a message instead of creating an invoice Cryptonly cannot confirm. ::: ### API key scopes Create the key on the account’s **Accounts → Settings → Security** page and enable only these scopes: | Scope | Used for | | --- | --- | | `currencies.list` | Confirm the API key when saving the gateway (`GET /currencies`) and list the invoice currencies Cryptonly prices (`GET /currencies/fiat`) | | `invoices.list` | Reuse a payable invoice or choose the next `orderId`, and load the invoice when create returns a duplicate (`GET /invoice`) | | `invoices.create` | Create the invoice at checkout (`POST /invoice`) | ## Test in sandbox before going live 1. Tick **Sandbox mode** and enter credentials from [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net). 2. Confirm **Settings → General → App URL** is public HTTPS. For a local Paymenter, use a tunnel such as ngrok and set App URL to the tunnel address. 3. Sign in as a customer, open an unpaid invoice, click **Pay**, choose the Cryptonly gateway, and click **Pay Now**. 4. Complete payment on the Cryptonly [sandbox payment page](https://docs.cryptonly.net/guides/sandbox-environment.md) using testnet assets only, or use **Simulate payment** on the invoice in Cryptonly **Accounts → History** to settle it without sending testnet funds. 5. Confirm the Paymenter invoice shows **Paid** with a **Succeeded** transaction. See [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md) for more on the History and simulator tools. :::caution Sandbox uses testnets only. Do not send mainnet funds to sandbox payment addresses. ::: ## Customer payment experience 1. The customer opens an unpaid invoice and clicks **Pay**. 2. They choose the Cryptonly gateway (named **Crypto** here) and click **Pay Now**. 3. The extension creates a Cryptonly invoice for the amount still due and redirects the customer to the Cryptonly payment page, where they pick a coin and network and pay. 4. The customer returns to the invoice. It shows **Payment Processing** and checks every few seconds until the webhook arrives. 5. Paymenter records the payment and marks the invoice **Paid**. The transaction id is the Cryptonly invoice id, so you can find the payment in Cryptonly **Accounts → History**. **If the customer leaves before paying** The Paymenter invoice stays unpaid. Clicking **Pay** again returns the customer to the same Cryptonly payment page while it is still payable, and creates a new one after it expires or is cancelled. ## How Paymenter invoices are updated The extension listens for `invoice.statusChanged` webhooks. Returning from the hosted page does not mark the invoice paid. | Cryptonly invoice status | Paymenter behavior | | --- | --- | | `created`, `processing` | Nothing recorded | | `suspended` | A **Processing** transaction is added. A later `paid` completes it; `failed`, `cancelled` or `expired` marks it **Failed** | | `paid`, `overpaid` | The amount still due is recorded and Paymenter marks the invoice paid. An overpay is not stored as credit | | `partially_paid` | The fiat value received (share of crypto received × invoice amount, rounded down to the cent) is recorded. The invoice stays open for the rest | | `expired`, `failed`, `cancelled` | Nothing recorded. A later `paid` can still be applied | A repeated webhook updates the same transaction instead of adding money twice. The next **Pay** after a partial payment charges only what is still due, with order id `PAYMENTER-12-2`, then `PAYMENTER-12-3`. Overdue invoices can still be paid. Saved payment methods (billing agreements) and refunds are not supported, so a renewal invoice is paid with a new checkout. ## Go live checklist * [ ] Untick **Sandbox mode** * [ ] Enter production **API Key** and **Webhook Signing Key** * [ ] Confirm **App URL** is public HTTPS and reachable from the internet * [ ] Confirm each invoice currency you use is offered by Cryptonly * [ ] Place a small real payment and confirm the invoice is marked **Paid** ## Troubleshooting **Cryptonly is not offered on an invoice** * Confirm **API Key** and **Webhook Signing Key** are saved on the gateway. * Check the invoice currency. The gateway is hidden for currencies Cryptonly does not price. * The invoice must have something left to pay. **“Cryptonly needs this site on a public HTTPS address”** **Settings → General → App URL** is `http://`, `localhost`, or an IP address. Set it to your public HTTPS domain. The read-only **Webhook URL** on the gateway form shows the result. **“Invalid Cryptonly API key” when saving** * **Sandbox mode** must match the key: ticked for a sandbox key, unticked for a production key. * The key needs the [required scopes](#api-key-scopes). **The invoice stays on Payment Processing** * Confirm Paymenter is reachable from the internet at App URL, and that a firewall, WAF, or bot protection does not block `POST /extensions/gateways/cryptonly/webhook`. * Confirm the **Webhook Signing Key** matches the account’s **Accounts → Settings → Security** page. A wrong key makes Paymenter answer `401`, and the payment is not recorded. * Look in the Paymenter log (`storage/logs`) for `Cryptonly webhook` lines, which show the status and what was recorded. **“This invoice already has a finished Cryptonly payment”** The Cryptonly invoice for this order id was already paid. Check the payment in Cryptonly **Accounts → History** and the invoice transactions in Paymenter before taking a new payment. ## Frequently asked questions **Which cryptocurrencies are supported?** Cryptonly supports Bitcoin, Ethereum, USDT, USDC, and many other cryptocurrencies. Available assets depend on your Cryptonly account and enabled networks. **Do I need to configure webhooks in the Cryptonly Merchant Dashboard?** No. The extension sends the webhook URL with each invoice. You only enter the **Webhook Signing Key** so incoming webhooks can be verified. **Can customers pay part of an invoice?** Yes. A partial crypto payment is recorded on the invoice, and the customer pays the rest with a new checkout or another payment method. **Does it work with Paymenter account credit?** Yes. If credit covers part of the invoice, Cryptonly charges only the amount still due. ## Related pages - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verification and payload details - [Invoices](https://docs.cryptonly.net/guides/invoices.md): How checkout payments work - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): History and test webhooks ## Support For help with your Cryptonly merchant account, credentials, or payment questions, write to **support@cryptonly.net**. # Medusa > Accept cryptocurrency payments in Medusa v2 through Cryptonly hosted checkout. The **Cryptonly payment provider for Medusa** lets your Medusa v2 store accept cryptocurrency payments through Cryptonly's hosted checkout. Customers select Cryptonly at checkout, pay on the Cryptonly payment page, and return to your store. The Medusa payment status updates automatically via signed webhooks — no manual reconciliation. Setting up takes four steps: 1. [Install and register the provider](https://docs.cryptonly.net/integration/plugins/medusa.md#installation) 2. [Configure your credentials and webhook URL](https://docs.cryptonly.net/integration/plugins/medusa.md#configuration) 3. Enable the provider on a region in Medusa Admin 4. [Wire up your storefront](https://docs.cryptonly.net/integration/plugins/medusa.md#storefront) ## How the payment flow works ```mermaid sequenceDiagram participant Customer participant Storefront participant Medusa participant Cryptonly Customer->>Storefront: Checkout with Cryptonly Storefront->>Medusa: initiatePaymentSession Medusa->>Cryptonly: Create invoice Cryptonly-->>Storefront: paymentPageUrl Storefront-->>Customer: Redirect to hosted checkout Customer->>Cryptonly: Pay with crypto Cryptonly->>Medusa: invoice.statusChanged webhook Medusa-->>Customer: Payment status updated ``` At a high level: 1. The customer checks out and chooses Cryptonly as the payment method. 2. Medusa creates a Cryptonly invoice server-side — your API key never reaches the browser. 3. The storefront redirects the customer to the hosted payment page (`paymentPageUrl`). 4. After payment, Cryptonly sends signed webhooks to your Medusa backend. 5. The provider verifies each webhook and marks the payment session **captured** once the invoice is `paid` or `overpaid`. For details on invoices and statuses, see [Invoices](https://docs.cryptonly.net/guides/invoices.md). ## Requirements | Requirement | Details | | -------------------- | ----------------------------------------------------------------------------- | | Medusa | v2.8+ (peer dependency) | | Node | 20+ | | Cryptonly account | [merchant.cryptonly.net](https://merchant.cryptonly.net/) | | Public HTTPS backend | Cryptonly must reach `{MEDUSA_BACKEND_URL}/hooks/payment/cryptonly_cryptonly` | ## Installation Install the plugin: ```bash npm install @cryptonly/medusa-plugin-cryptonly ``` Register the provider in `medusa-config.ts`: ```ts module.exports = defineConfig({ modules: [ { resolve: "@medusajs/medusa/payment", options: { providers: [ { resolve: "@cryptonly/medusa-plugin-cryptonly/providers/cryptonly", id: "cryptonly", options: { apiKey: process.env.CRYPTONLY_API_KEY, webhookSigningKey: process.env.CRYPTONLY_WEBHOOK_SIGNING_KEY, sandbox: process.env.CRYPTONLY_SANDBOX === "true", backendUrl: process.env.MEDUSA_BACKEND_URL, }, }, ], }, }, ], }) ``` Finally, enable the provider on a region: in Medusa Admin, open **Settings → Regions**, edit the region and add **Cryptonly (CRYPTONLY)** under **Payment Providers**. ## Configuration | Option | Required | Description | | ------------------- | -------- | ------------------------------------------------------------------- | | `apiKey` | Yes | API key from the account Security settings. The key selects the account. See [required scopes](https://docs.cryptonly.net/integration/plugins/medusa.md#api-key-scopes). | | `webhookSigningKey` | Yes | Signing key from the same account. Verifies incoming Cryptonly webhooks | | `backendUrl` | One of | Public HTTPS Medusa origin used to build the webhook URL | | `webhookUrl` | One of | Full HTTPS webhook URL (overrides `backendUrl`) | | `sandbox` | No | Use the Cryptonly sandbox API (default: `false`) | | `returnUrl` | No | Default browser URL after `cancelled` / `expired` | | `successUrl` | No | Default browser URL after `paid` / `overpaid` | | `failedUrl` | No | Default browser URL after `failed` / `suspended` / `partially_paid` | | `expiresInMinutes` | No | Invoice expiry passed to Cryptonly (default: 1440) | Provide either `backendUrl` or `webhookUrl`. ### API key scopes Create the key on the account’s **Security** settings and enable only these scopes: | Scope | Used for | | ----- | -------- | | `currencies.list` | Confirm the API key can reach the merchant API | | `invoices.create` | Start checkout (`POST /invoice`) and recreate an invoice when the cart amount or currency changes | | `invoices.list` | Read the invoice while authorizing, polling status, or retrieving the session (`GET /invoice`) | | `invoices.cancel` | Cancel the invoice when the customer abandons checkout or the cart total changes (`POST /invoice/cancel`) | Keep in mind: * `apiKey` and `webhookSigningKey` must be non-empty — otherwise the provider will not register. * Webhook URLs must be public **HTTPS**. Localhost and private IPs are rejected. * The provider sets `webhookUrl` automatically on every invoice it creates, so you do **not** need to configure a default invoice webhook in the Cryptonly Merchant Dashboard. * Refunds made in Medusa are not sent to Cryptonly. Handle them manually. ### Browser return URLs Cryptonly's hosted page shows a button labelled **Return to** and your store name. Where it leads depends on the invoice status: | Option | Used when invoice status is | | ------------ | ----------------------------------------- | | `successUrl` | `paid` / `overpaid` | | `returnUrl` | `cancelled` / `expired` | | `failedUrl` | `failed` / `suspended` / `partially_paid` | :::note These are **browser** links, not server webhooks. Order completion always depends on Cryptonly calling your Medusa `webhookUrl` — even if the customer never clicks that button. See [Invoice statuses](https://docs.cryptonly.net/guides/invoices/statuses.md) for the full status model. ::: A few things to know: * Any `http` or `https` URL is accepted, including local storefronts such as `http://localhost:8000/...`. * Provider options are only fallbacks. Prefer passing per-session values in the `initiatePaymentSession` `data` so each cart gets the right confirmation or retry URL. **Recommended storefront mapping:** * `successUrl` → confirmation / poll page (e.g. `/order/cryptonly/return?cart_id=…`) * `returnUrl` / `failedUrl` → checkout review, so the customer can try again (e.g. `/checkout?step=review&cart_id=…`) Include `cart_id` on all three URLs. On the Next.js starter, set the `_medusa_cart_id` cookie to `SameSite=Lax` so it is sent on the top-level return from Cryptonly — otherwise checkout may 404 after a cancel. For webhook signing details, see [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md). For sandbox testing (simulated payments, test webhooks), see [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). ## Storefront ### Start a new session on every pay attempt On **each** "Pay with Cryptonly" click, call `initiatePaymentSession` again and redirect to the **new** `paymentPageUrl`. Do not reuse a URL from an earlier session — once the customer cancels or the invoice expires on Cryptonly, that URL is dead. (Same principle as Stripe Checkout: one session per pay attempt.) ```ts const base = baseUrl.replace(/\/$/, "") const successUrl = `${base}/order/cryptonly/return?cart_id=${cart.id}` const returnUrl = `${base}/checkout?step=review&cart_id=${cart.id}` const failedUrl = `${base}/checkout?step=review&cart_id=${cart.id}` const { payment_collection } = await initiatePaymentSession(cart, { provider_id: "pp_cryptonly_cryptonly", data: { returnUrl, successUrl, failedUrl }, }) const session = payment_collection.payment_sessions.find( (s) => s.provider_id.startsWith("pp_cryptonly_") ) window.location.href = session.data.paymentPageUrl ``` ### Checkout label and icon Checkout labels and icons are storefront-owned — Medusa does not expose them from the provider. On the [Next.js starter](https://github.com/medusajs/nextjs-starter-medusa), add an entry to `paymentInfoMap` in `src/lib/constants.tsx`: ```tsx pp_cryptonly_cryptonly: { title: "Cryptonly (crypto)", icon: , }, ``` A reference icon component ships with the plugin under [assets/storefront/cryptonly.tsx](https://github.com/cryptonly-net/cryptonly-medusa/blob/main/assets/storefront/cryptonly.tsx), and PNG/SVG brand marks are available in `assets/` as well. ## Status mapping The plugin listens for `invoice.statusChanged` webhooks and maps Cryptonly statuses to Medusa results as follows: | Cryptonly status | Medusa result | | -------------------------------- | ----------------------- | | `paid`, `overpaid` | Captured (successful) | | `created`, `processing` | Pending (no completion) | | `partially_paid` | Failed | | `failed`, `expired`, `suspended` | Failed | | `cancelled` | Canceled | ## Live demo (sandbox) Try the full flow - no real funds needed: [medusa-demo.cryptonly.net](https://medusa-demo.cryptonly.net) ## Related pages - [Invoices](https://docs.cryptonly.net/guides/invoices.md): How checkout payments work ## Support For help with your Cryptonly merchant account, credentials, or payment questions, write to **support@cryptonly.net**. # Vendure > Accept cryptocurrency payments in Vendure 3.8+ through Cryptonly hosted checkout. The **Cryptonly plugin for Vendure** lets your Vendure store accept cryptocurrency payments through Cryptonly's hosted checkout. Customers choose Cryptonly at checkout, pay on the Cryptonly payment page and return to your store. The order is placed once Cryptonly confirms the payment through a signed webhook. There is no manual reconciliation. Setup takes four steps: 1. [Install the plugin](https://docs.cryptonly.net/integration/plugins/vendure.md#installation) 2. [Create a Cryptonly payment method](https://docs.cryptonly.net/integration/plugins/vendure.md#payment-method) in the Dashboard 3. [Redirect to the payment page](https://docs.cryptonly.net/integration/plugins/vendure.md#storefront) from your storefront 4. Add a return page that waits for the payment ## How the payment flow works ```mermaid sequenceDiagram participant Customer participant Storefront participant Vendure participant Cryptonly Customer->>Storefront: Place order with Cryptonly Storefront->>Vendure: addPaymentToOrder Vendure->>Cryptonly: Create invoice Vendure-->>Storefront: Payment "Created" with paymentPageUrl Storefront-->>Customer: Redirect to hosted checkout Customer->>Cryptonly: Pay with crypto Cryptonly->>Vendure: invoice.statusChanged webhook Vendure->>Cryptonly: Confirm invoice status Vendure-->>Customer: Order placed (PaymentSettled) ``` In detail: 1. The customer reaches `ArrangingPayment`, and the storefront calls the standard `addPaymentToOrder` mutation with the Cryptonly method. 2. Vendure creates a Cryptonly invoice server-side, so your API key never reaches the browser. It records a payment in the `Created` state. The cart is locked while the invoice is open. 3. The storefront redirects the customer to the hosted payment page (`paymentPageUrl`). 4. Cryptonly sends signed webhooks to Vendure. The plugin verifies each one, confirms the invoice status with the Cryptonly API, and settles the payment once the invoice is `paid` or `overpaid`. For details on invoices and statuses, see [Invoices](https://docs.cryptonly.net/guides/invoices.md). ## Requirements | Requirement | Details | | -------------------- | ------------------------------------------------------------------------------- | | Vendure | 3.8+ | | Node | 22.12+ | | Cryptonly account | [merchant.cryptonly.net](https://merchant.cryptonly.net/) | | Public HTTPS server | Cryptonly must reach `{host}/payments/cryptonly/{channelToken}/{paymentMethodId}` | ## Installation Install the plugin: ```bash npm install @cryptonly/vendure-plugin-cryptonly ``` Add it to `vendure-config.ts`: ```ts export const config: VendureConfig = { // ... systemOptions: { // Needed only with encryptSecrets: true encryptionStrategy: new DefaultEncryptionStrategy({ secret: process.env.VENDURE_ENCRYPTION_KEY }), }, plugins: [ CryptonlyPlugin.init({ host: process.env.VENDURE_PUBLIC_URL, // e.g. https://api.my-shop.com encryptSecrets: true, }), ], }; ``` | Option | Required | Description | | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | | `host` | Yes | Public HTTPS origin of the Vendure server. Webhooks are sent to `{host}/payments/cryptonly/...`. Localhost and IP addresses are rejected. | | `encryptSecrets` | No | Store the API key and signing key encrypted, and hide them from admins without the `ReadSecret` permission. Requires an `EncryptionStrategy` with a key. Default: `false`. | The plugin adds no database columns, so no migration is needed. :::tip For local development, expose the server through a tunnel such as ngrok and use the tunnel URL as `host`. ::: ## Payment method In the Dashboard, open **Settings → Payment methods**, create a payment method with the code `cryptonly` and choose the **Cryptonly crypto payments** handler: | Field | Description | | ------------------------------------- | ------------------------------------------------------------------------------------------- | | API key | API key from the account **Security** settings. The key selects the account. | | Webhook signing key | Signing key from the same account. Used to verify webhooks. | | Sandbox mode | Turn on for sandbox keys. | | Invoice lifetime (minutes) | Optional, 15 to 43200. Empty uses the account default. | | Return URL | Your storefront's return page, opened by the **Return to** button on the hosted page whatever the outcome. `{orderCode}` is replaced with the order code. | Create one payment method per channel that should accept crypto. Each channel can use its own Cryptonly account. ### API key scopes | Scope | Used for | | ----------------- | ------------------------------------------------------------ | | `invoices.create` | Create the invoice when the customer places the order | | `invoices.list` | Confirm the invoice status for webhooks and manual settlement | | `invoices.cancel` | Cancel the invoice when the customer leaves checkout | The plugin sets the webhook URL on every invoice, so you do **not** need to configure a default webhook in the Merchant Dashboard. ## Storefront ### Redirect to the payment page The order must be in `ArrangingPayment`. Add the payment and send the customer to its `paymentPageUrl`: ```ts const { addPaymentToOrder } = await shopApi(` mutation { addPaymentToOrder(input: { method: "cryptonly", metadata: {} }) { __typename ... on Order { code payments { method state metadata } } ... on ErrorResult { errorCode message } ... on PaymentFailedError { paymentErrorMessage } } } `); const payment = addPaymentToOrder.payments.find( (p) => p.method === 'cryptonly' && p.state === 'Created' ); window.location.assign(payment.metadata.public.paymentPageUrl); ``` If the customer places the order again while the invoice is still open, redirect to the same `paymentPageUrl` from `activeOrder.payments`. A second `addPaymentToOrder` returns `PaymentFailedError` until the order goes back to `AddingItems`. ### Return page Set the payment method's Return URL to a page such as `/checkout/cryptonly/{orderCode}`. Customers land there whether they paid, cancelled or let the invoice expire, so the page polls the Shop API every few seconds: | What you see | Meaning | | --------------------------------------------------------------- | ---------------------------------------------------- | | `activeOrder` has this code, state `ArrangingPayment` | Waiting for payment: show a spinner | | `activeOrder` has this code, state `AddingItems` | Invoice cancelled or expired: send back to checkout | | `orderByCode(code)` returns `PaymentSettled` | Paid: show the order confirmation | Ready-made helpers for both steps are in the plugin's [assets/storefront](https://github.com/cryptonly-net/cryptonly-vendure/tree/main/assets/storefront) folder. ## Status mapping | Cryptonly status | Vendure | | -------------------------------- | --------------------------------------------------------------------------------- | | `paid`, `overpaid` | Payment **Settled**, order moves to `PaymentSettled` | | `created`, `processing` | Payment stays `Created` | | `cancelled`, `expired`, `failed` | Payment **Declined**, order goes back to `AddingItems` | | `partially_paid`, `suspended` | Payment stays `Created` and is flagged `needsReview`. Resolve it in the Merchant Dashboard | Keep in mind: * When an order leaves `ArrangingPayment` unpaid (the customer returns to the cart, or the order is cancelled), the open invoice is cancelled in Cryptonly. * **Settle** in the Dashboard only succeeds when Cryptonly reports the invoice as paid. **Cancel** is refused once the invoice has received funds. * Refunds made in Vendure are not sent to Cryptonly. Refund the customer from the Merchant Dashboard. For webhook signing details, see [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md). For sandbox testing, see [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). ## Related pages - [Invoices](https://docs.cryptonly.net/guides/invoices.md): How checkout payments work ## Support For help with your Cryptonly merchant account, credentials, or payment questions, write to **support@cryptonly.net**. # FluentCart > Accept cryptocurrency payments in FluentCart through Cryptonly hosted checkout. The **Cryptonly plugin for FluentCart** adds **Crypto** as a payment method to your FluentCart store, using Cryptonly's hosted checkout. Customers choose Crypto at checkout, pay on the Cryptonly payment page and return to the FluentCart receipt. The order is marked paid once Cryptonly confirms the payment through a signed webhook. There is no manual reconciliation. Setup takes three steps: 1. [Install the plugin](https://docs.cryptonly.net/integration/plugins/fluentcart.md#installation) 2. [Paste your keys](https://docs.cryptonly.net/integration/plugins/fluentcart.md#configuration) in FluentCart's payment settings 3. Switch the method on and place a test order ## How the payment flow works ```mermaid sequenceDiagram participant Customer participant FluentCart participant Cryptonly Customer->>FluentCart: Place order with Crypto FluentCart->>Cryptonly: Create invoice FluentCart-->>Customer: Redirect to hosted checkout Customer->>Cryptonly: Pay with crypto Cryptonly->>FluentCart: invoice.statusChanged webhook FluentCart->>Cryptonly: Confirm invoice status FluentCart-->>Customer: Receipt: Purchase Successful ``` In detail: 1. When the customer places the order, the plugin creates a Cryptonly invoice server-side for the order total, in the store currency. Your API key never reaches the browser. 2. The customer is redirected to the hosted payment page and chooses a coin and network there. 3. Cryptonly sends signed webhooks to your store. The plugin verifies each one, reads the invoice from the Cryptonly API and only then updates the FluentCart transaction and order. 4. The **Back to store** button on the payment page opens the FluentCart receipt. If the order is still pending there, the plugin checks the invoice with the API once more, so a late webhook does not keep the customer waiting. For details on invoices and statuses, see [Invoices](https://docs.cryptonly.net/guides/invoices.md). ## Requirements | Requirement | Details | | ------------------- | ----------------------------------------------------------------------------- | | WordPress | 6.7+ | | PHP | 7.4+ | | FluentCart | 1.2.5+ (the free plugin is enough) | | Cryptonly account | [merchant.cryptonly.net](https://merchant.cryptonly.net/) | | Public HTTPS site | Cryptonly must reach `https://your-store.com/?fluent-cart=fct_payment_listener_ipn&method=cryptonly` | ## Installation The plugin is published in the [WordPress.org plugin directory](https://wordpress.org/plugins/cryptonly-crypto-payments-for-fluentcart/). 1. In WordPress, go to **Plugins → Add New**. 2. Search for **Cryptonly FluentCart**. 3. Click **Install Now** on **Cryptonly – Crypto Payments for FluentCart**, then **Activate**. 1. Download the plugin zip from the [WordPress.org plugin page](https://wordpress.org/plugins/cryptonly-crypto-payments-for-fluentcart/). 2. In WordPress, go to **Plugins → Add New → Upload Plugin** and upload the zip. Or, move the `cryptonly-crypto-payments-for-fluentcart` folder to `/wp-content/plugins/` on your server and activate it from the **Plugins** menu. After activation, open **FluentCart → Settings → Payment Settings → Cryptonly**. ## Configuration | Setting | Description | | ------------------------------- | ----------------------------------------------------------------------------------------------- | | Live credentials | API key and webhook signing key from [merchant.cryptonly.net](https://merchant.cryptonly.net/). | | Test credentials (sandbox) | The same pair from [sandbox-merchant.cryptonly.net](https://sandbox-merchant.cryptonly.net/). | | Underpayments | What happens when a customer sends less than the invoice amount. See [Underpayments](https://docs.cryptonly.net/integration/plugins/fluentcart.md#underpayments). | | Order ID prefix | `FC-` by default, so order 12 appears as `FC-12` in Cryptonly. Use a different prefix for each store that shares a Cryptonly account. | FluentCart's store-wide order mode (**Settings → Store Settings → Order Mode**) decides which pair is used: **Test** uses the sandbox keys and the sandbox API, **Live** uses the live ones. Saving the settings checks the keys with the Cryptonly API, and a wrong key is refused. **Test Connection** checks the saved key again and warns if Cryptonly does not invoice in your store currency. In that case the method stays hidden at checkout. ### API key scopes | Scope | Used for | | ----------------- | ----------------------------------------------------------- | | `invoices.create` | Create the invoice when the customer places the order | | `invoices.list` | Confirm the invoice status for webhooks and returning customers | | `invoices.cancel` | Cancel an open invoice when the cart changes or the order is cancelled | | `currencies.list` | Check the key and the store currency | The plugin sends its webhook URL with every invoice, so you do **not** need to configure a webhook in the Merchant Dashboard. ## Checkout The method name (**Crypto**), its logo and the text under it can be changed. Click the pencil icon at the top right of the Cryptonly settings to open FluentCart's **Checkout Customization**: | Field | Default | | --- | --- | | Checkout Label | Crypto | | Checkout Logo | The Cryptonly logo | | Checkout Instructions | *After you place the order, you will pay on a secure Cryptonly page with the cryptocurrency of your choice.* Your text replaces it. Leave it empty to show the default again. | | Thank you page instruction | Empty. Shown on the receipt after checkout. | * A customer who goes back to the checkout and places the order again is sent to the same open invoice. * If the cart total changed, the old invoice is cancelled and a new one is issued as `FC-12-2`. * After an invoice expires or is cancelled, the customer can pay again from the checkout or from the **Payment Pending** receipt. ## Status mapping | Cryptonly status | FluentCart | | -------------------------------- | ------------------------------------------------------------------------------------------------ | | `created`, `processing` | No change. `processing` (transfer seen, waiting for confirmations) is noted in the order activity. | | `paid` | Transaction **Succeeded**, payment **Paid**, order **Processing**. Digital orders complete automatically. | | `overpaid` | As `paid`, with an overpayment note. Refund the extra from the Merchant Dashboard. | | `partially_paid` | Depends on the [Underpayments](https://docs.cryptonly.net/integration/plugins/fluentcart.md#underpayments) setting. | | `expired`, `failed`, `cancelled` | Transaction **Failed**, payment **Failed**. The customer can pay again. A paid transaction is never downgraded. | The Cryptonly invoice ID is the transaction's **Gateway ID**, and each step is written to the order's **Activity**. ### Underpayments | Setting | When a customer sends less than the invoice amount | | ----------------------------------------- | ------------------------------------------------------------------------------------------------------ | | **Hold the order for review** (default) | Nothing is marked paid. The order stays **On Hold** with a note of what arrived. | | **Record the amount received** | The received value becomes a succeeded payment and the order is **Partially Paid**. | The received value is the share of crypto received times the invoice amount, rounded down to the cent. Either way, decide whether to ship, collect the rest or refund the customer. A second payment for the same order is refused until you resolve it. Keep in mind: * Cancelling an order in FluentCart cancels its open Cryptonly invoice. * Refunds made in FluentCart are not sent to Cryptonly. Refund the customer from the Merchant Dashboard. * Automatic subscription renewals are not supported. FluentCart can offer Crypto for store-billed subscription invoices, which are paid as one-time charges. ## Testing Set the order mode to **Test**, paste sandbox keys in **Test credentials** and place an order. You can pay with testnet coins, or click **Simulate payment** in the [sandbox dashboard](https://sandbox-merchant.cryptonly.net/) to trigger `paid`, `partially_paid` and other statuses without sending funds. See [Sandbox environment](https://docs.cryptonly.net/guides/sandbox-environment.md) and [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md). ## Webhook responses | Code | Meaning | | ----- | --------------------------------------------------------------------------------------------- | | `200` | Handled, or a repeat delivery that changed nothing | | `401` | The signature matches neither the live nor the test signing key | | `404` | No FluentCart transaction belongs to the invoice | | `503` | The invoice could not be confirmed with the Cryptonly API, or another delivery for the same order is in progress. Cryptonly retries. | For webhook signing details, see [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md). ## Related pages - [Invoices](https://docs.cryptonly.net/guides/invoices.md): How checkout payments work ## Support For help with your Cryptonly merchant account, credentials, or payment questions, write to **support@cryptonly.net**. # Authorization Cryptonly API requests must be authorized with an API key. Send the key from your backend only, and never expose it in a browser or mobile app. ## Who can manage API keys? Members with the **Owner**, **Admin** or **Developer** role can create API keys, edit a key's name and scopes, and delete keys. Other roles can only see the list. See [Managing access & roles](https://docs.cryptonly.net/guides/managing-access-and-roles.md). ## How to create an API key API keys belong to an account. Requests authenticated with it operate on the account it was created for. Get API key Get sandbox API key 1. Open the Cryptonly Merchant Dashboard. 2. Go to **Accounts** and select the account. 3. Open the **Settings** tab, then **Security**. 4. In **API Keys**, create a key. Set a name and at least one scope. 5. Copy the secret immediately. It is shown only once. ## How to use an API key Include your API key in the `x-tenant-api-key` header of each request, sent over HTTPS: ```bash curl https://api-merchant.cryptonly.net/currencies \ -H "x-tenant-api-key: YOUR_API_KEY" ``` Use `https://sandbox-api-merchant.cryptonly.net` with a sandbox key. A missing or invalid key returns `401`; a key without the required scope returns `403`. ## Deleting a key If an API key is no longer needed, or if you suspect it has been compromised, delete it from the account's **Security** page. Once deleted, the key can no longer be used to authorize API requests. ## Related pages - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): The signing key is on the same Security page - [HTTP status codes](https://docs.cryptonly.net/api-reference/http-status-codes.md): 401 and 403 when a key is missing or not allowed - [Idempotency](https://docs.cryptonly.net/api-reference/idempotency.md): Retry create requests with the same orderId - [API reference](https://docs.cryptonly.net/api-reference.md): What an API key can call # Idempotency > orderId retries for create requests, and replay protection for webhook deliveries. ## Requests `orderId` is the idempotency key when you create invoices, standalone deposits, and withdrawal quotes. Generate it in your system so it identifies your own object, such as an order number, payment attempt, or withdrawal request. A request with an `orderId` that was already used never creates a second object. | Operation | Repeat with the same `orderId` | | --- | --- | | `POST /invoice` | Returns `409 Conflict` | | `POST /deposit` | Returns `409 Conflict` | | `POST /withdrawal/quote` | Returns the same quote. After that quote is committed, returns `409 Conflict` | Invoice `orderId` values must be unique across your organization; deposit and withdrawal values must be unique per account. `orderId` is not an idempotency key for other endpoints. ### Retrying safely Use a new `orderId` for each new invoice, deposit, or withdrawal. Reuse it only when retrying after a timeout or an uncertain response: * **Invoices and deposits.** If the retry returns `409`, the first request succeeded. Fetch the object by `orderId`, for example `GET /invoice?orderId=…`, instead of creating a new one. * **Withdrawals.** Repeat the quote with the same `orderId` until you get a `quoteId`, then commit it once. A single `orderId` can back at most one committed withdrawal. :::caution If a retried request uses a new `orderId`, Cryptonly treats it as a new create request, and your customer may be charged or paid twice. ::: ## Webhooks ### Duplicate events and replay protection The webhook signature proves the body was signed with your signing key, but it doesn't stop replays: someone who captures a valid request could send it again. Make your handler idempotent and do at least one of the following: * **Reject old events.** Compare the signed `timestamp` field in the body with your clock, for example rejecting events older than 5 minutes. Don't use the `x-webhook-timestamp` header for this, because it isn't signed. * **Deduplicate deliveries** by the `x-webhook-id` header. Retries and manual resends of one delivery always carry the same id, so store the ids you have processed and skip repeats. * **Deduplicate status transitions.** Two different deliveries can still describe the same transition, for example if a status event is emitted twice. Use the event name, the resource id, and the status as a key, such as `invoice.statusChanged` + `data.id` + `data.status`. If you have already processed the transition, return `200 OK` and don't repeat the action. ## Related pages - [Invoices](https://docs.cryptonly.net/guides/invoices.md): orderId on invoice creation - [Deposits](https://docs.cryptonly.net/guides/deposits.md): orderId on standalone deposits - [Withdrawals lifecycle](https://docs.cryptonly.net/guides/withdrawals/withdrawals-lifecycle.md): orderId applies to the quote, then commit - [HTTP status codes](https://docs.cryptonly.net/api-reference/http-status-codes.md): 409 when that orderId was already used - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Signed deliveries, retries, and resends # HTTP status codes > HTTP status codes the Cryptonly API returns, and the JSON error format. ## Status codes | Status code | Meaning | | --- | --- | | `200 OK` | The request succeeded | | `201 Created` | The request succeeded and created a new resource | | `400 Bad Request` | The request is malformed or failed validation, for example an amount below the minimum | | `401 Unauthorized` | The API key is missing or invalid | | `403 Forbidden` | The API key doesn't have the scope this endpoint requires | | `404 Not Found` | The resource doesn't exist, or belongs to another account | | `409 Conflict` | The `orderId` was already used — see [Idempotency](https://docs.cryptonly.net/api-reference/idempotency.md) | | `429 Too Many Requests` | More than 200 requests per minute for this API key. Retry after the window resets | | `500 Internal Server Error` | Something went wrong on our side. Retry later, or contact support if it persists | | `503 Service Unavailable` | The operation is temporarily unavailable, for example deposits in a currency whose network fee can't be quoted right now | ## Error format Every error response has the same JSON body: ```json { "code": "exceptions.invoice.orderIdAlreadyExists", "message": "Invoice with orderId order_1001 already exists", "extension": {} } ``` | Field | Description | | --- | --- | | `code` | Stable, machine-readable error code. Branch on this in your code | | `message` | Human-readable explanation. It may change, so don't parse it | | `extension` | Optional extra details about the error | Some codes you may handle explicitly: | Code | Status | When | | --- | --- | --- | | `exceptions.auth.insufficientScope` | `403` | The API key lacks the scope for this endpoint | | `exceptions.invoice.orderIdAlreadyExists` | `409` | An invoice with this `orderId` already exists | | `exceptions.depositFee.quoteUnavailable` | `503` | The [deposit network fee](/guides/fees-and-commissions/#deposit-network-fee) for this currency is temporarily unavailable | ## Related pages - [Authorization](https://docs.cryptonly.net/api-reference/authorization.md): 401 and 403 come from the API key - [Idempotency](https://docs.cryptonly.net/api-reference/idempotency.md): 409 means this orderId was already used # Webhooks Cryptonly sends a webhook to your server on every status change of an invoice, deposit, or withdrawal, not only when it reaches a final status. Each webhook is signed with HMAC-SHA256 so you can verify it came from Cryptonly. ## How webhooks are sent ### HTTP contract | Item | Value | | ---------------- | --------------------- | | Method | `POST` | | Content type | `application/json` | | Signature header | `x-webhook-signature` | | Signature format | Lowercase hex string | | Encoding | UTF-8 JSON body | | Redirects | Not followed | Request headers: | Header | Value | | --------------------- | -------------------------------------------------------------------------------------------------- | | `Content-Type` | `application/json` | | `User-Agent` | `Cryptonly-Webhooks/1` | | `x-webhook-id` | Delivery id (UUID). The same on every attempt of one delivery, including retries and manual resends | | `x-webhook-timestamp` | Unix time in seconds when this attempt was sent | | `x-webhook-event` | Event name, the same as `event` in the body | | `x-webhook-signature` | HMAC-SHA256 of the raw body. | :::note Only the request body is signed. `x-webhook-id`, `x-webhook-timestamp`, and `x-webhook-event` are informational and are not covered by the signature. Use the signed `timestamp` field in the body for replay checks. ::: The `timestamp` field in the body is set when each attempt is sent, so a retry carries a newer `timestamp` and a different signature than the attempt before it. ### Supported webhook events Cryptonly sends a signed webhook whenever a resource status changes. | Event | When Cryptonly sends it | | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `invoice.statusChanged` | On invoice create (initial `created`) and on every subsequent status transition | | `deposit.statusChanged` | On each status transition of a standalone deposit (not on initial create) | | `withdrawal.statusChanged` | On each post-commit status transition; the first webhook typically arrives when the withdrawal moves to `processing` | **Deposit webhooks are not sent** when a deposit is linked to an invoice (`invoiceId` is set). For invoice checkout payments, listen for `invoice.statusChanged` instead. ### Payload Every webhook body has the same envelope: the `event` name, the signed `timestamp` (ISO 8601), and `data`, the resource as the API returns it plus `previousStatus`. An `invoice.statusChanged` body looks like this: ```json { "event": "invoice.statusChanged", "timestamp": "2026-01-01T12:00:00.000Z", "data": { "id": "8f0c2d4e-1b7a-4c1e-9d3f-2a6b5c7d8e90", "accountId": "3a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", "orderId": "order_1001", "status": "paid", "previousStatus": "processing", "amount": 25, "fiatCurrencyCode": "USD", "cryptoCurrencyCode": "USDT_TRC20", "cryptoAmountExpected": 25.42, "cryptoAmountReceived": 25.42, "address": "TXYZ...", "txHash": "a1b2c3...", "settlement": { "amountPaid": 25.42, "commissionAmount": 0.25, "netAmount": 24.75, "completedAt": "2026-01-01T12:00:00.000Z" }, "paymentPageUrl": "https://...", "expiresAt": "2026-01-02T11:40:00.000Z", "createdAt": "2026-01-01T11:40:00.000Z" } } ``` `settlement` amounts (`amountPaid`, `commissionAmount`, `netAmount`) are in the crypto currency (`cryptoCurrencyCode`), not the invoice's fiat currency. For the fiat value of a partial payment, use `cryptoAmountReceived / cryptoAmountExpected × amount`. The example is shortened. See the OpenAPI reference for every field of [`invoice.statusChanged`](/api-reference/openapi/operations/webhookreferenceinvoicestatuschanged/), [`deposit.statusChanged`](/api-reference/openapi/operations/webhookreferencedepositstatuschanged/), and [`withdrawal.statusChanged`](/api-reference/openapi/operations/webhookreferencewithdrawalstatuschanged/). ### Webhook URLs Each webhook goes to the `webhookUrl` from the create request (or, for withdrawals, the commit request). Without one, Cryptonly uses the organization default for that resource type, which you set under **Settings → Integration**. If neither is set, no webhook is sent. :::caution Webhook URLs must use HTTPS. ::: ## Signing keys ### Getting your webhook signing key Each account has its own webhook signing key. The **Webhook signing key** section on the account's **Security** page shows a fingerprint of the current key. Members with the Owner, Admin or Developer role can rotate the key. :::caution The full webhook signing key is shown only once after rotation. Copy it immediately and store it securely. ::: **How to obtain the key** 1. Open the Cryptonly Merchant Dashboard. 2. Go to **Accounts** and select the account. 3. Open the **Settings** tab, then **Security**. 4. Find the **Webhook signing key** section. 5. Click **Rotate key**. 6. Confirm the rotation. 7. Copy the new signing key immediately. 8. Store it in your server environment variables. ```bash CRYPTONLY_WEBHOOK_SECRET=your_signing_key_here ``` ## Verifying webhooks ### Signature format The `x-webhook-signature` header is `HMAC-SHA256(rawBody, webhookSigningKey)` as a lowercase hex string, where `rawBody` is the exact raw UTF-8 bytes of the request body and `webhookSigningKey` is the signing key of the account the resource belongs to. Compute the signature over the body exactly as received. Parsing and re-serializing the JSON first changes the bytes and breaks verification. ### Recommended verification flow Your webhook endpoint should follow this order: 1. Receive the webhook request. 2. Read the raw request body. 3. Read the `x-webhook-signature` header. 4. Calculate the expected signature using your webhook signing key. 5. Compare signatures using a timing-safe comparison. 6. Reject invalid signatures with `401 Unauthorized`. 7. Parse the JSON body only after signature verification succeeds. 8. Optionally validate timestamp and deduplicate the event. 9. Process the webhook. 10. Return a `2xx` response. :::note Return a successful `2xx` response only after the webhook has been accepted by your server. ::: ### Verify a webhook If you use the Cryptonly SDK, you can verify invoice, deposit, and withdrawal webhooks with helper functions. ```ts verifyInvoiceWebhook, verifyWithdrawalWebhook, verifyDepositWebhook, } from '@cryptonly/sdk'; export function cryptonlyWebhookHandler(req: Request, res: Response) { const rawBody = req.body as Buffer; const signature = req.headers['x-webhook-signature']; const secret = process.env.CRYPTONLY_WEBHOOK_SECRET; if (!secret) { return res.status(500).json({ error: 'webhook secret is not configured', }); } const signatureHeader = typeof signature === 'string' ? signature : undefined; const invoiceResult = verifyInvoiceWebhook( rawBody, signatureHeader, secret, ); if (invoiceResult.ok) { const { event, data, timestamp } = invoiceResult.envelope; // Handle invoice.statusChanged. // Optional: validate timestamp. // Optional: deduplicate event. return res.status(200).json({ received: true }); } const withdrawalResult = verifyWithdrawalWebhook( rawBody, signatureHeader, secret, ); if (withdrawalResult.ok) { const { event, data, timestamp } = withdrawalResult.envelope; // Handle withdrawal.statusChanged. // Optional: validate timestamp. // Optional: deduplicate event. return res.status(200).json({ received: true }); } const depositResult = verifyDepositWebhook( rawBody, signatureHeader, secret, ); if (depositResult.ok) { const { event, data, timestamp } = depositResult.envelope; // Handle deposit.statusChanged. // Optional: validate timestamp. // Optional: deduplicate event. return res.status(200).json({ received: true }); } return res.status(401).json({ error: 'webhook verification failed', }); } ``` Use `express.raw()` for the webhook route so you can verify the exact raw request body. ```ts const app = express(); function verifyCryptonlySignature( rawBody: Buffer, signatureHeader: string | undefined, secret: string, ): boolean { if (!signatureHeader || signatureHeader.trim() === '') { return false; } const expectedHex = createHmac('sha256', secret) .update(rawBody) .digest('hex'); const expected = expectedHex.toLowerCase(); const received = signatureHeader.trim().toLowerCase(); if (expected.length !== received.length || expected.length % 2 !== 0) { return false; } try { return timingSafeEqual( Buffer.from(expected, 'hex'), Buffer.from(received, 'hex'), ); } catch { return false; } } app.post( '/webhooks/cryptonly', express.raw({ type: 'application/json' }), (req, res) => { const rawBody = req.body as Buffer; const signature = req.headers['x-webhook-signature']; const secret = process.env.CRYPTONLY_WEBHOOK_SECRET; if (!secret) { return res.status(500).send('webhook secret is not configured'); } const isValid = verifyCryptonlySignature( rawBody, typeof signature === 'string' ? signature : undefined, secret, ); if (!isValid) { return res.status(401).send('invalid signature'); } const webhook = JSON.parse(rawBody.toString('utf8')) as { event: string; data: unknown; timestamp: string; }; // Optional: validate webhook.timestamp for replay protection. // Optional: deduplicate by req.headers['x-webhook-id']. switch (webhook.event) { case 'invoice.statusChanged': // Handle invoice status update. break; case 'withdrawal.statusChanged': // Handle withdrawal status update. break; case 'deposit.statusChanged': // Handle deposit status update. break; default: // Unknown event type. break; } return res.status(200).send('ok'); }, ); ``` Read the raw request body before parsing JSON. In Flask, use `request.get_data()`. ```python from flask import Flask, request app = Flask(__name__) def verify_cryptonly_signature( raw_body: bytes, signature_header: str | None, secret: str, ) -> bool: if signature_header is None or signature_header.strip() == "": return False expected = hmac.new( secret.encode("utf-8"), raw_body, hashlib.sha256, ).hexdigest() received = signature_header.strip().lower() if len(expected) != len(received): return False return hmac.compare_digest(expected, received) @app.post("/webhooks/cryptonly") def cryptonly_webhook(): raw_body = request.get_data() signature = request.headers.get("x-webhook-signature") secret = os.environ.get("CRYPTONLY_WEBHOOK_SECRET") if not secret: return "webhook secret is not configured", 500 if not verify_cryptonly_signature(raw_body, signature, secret): return "invalid signature", 401 webhook = json.loads(raw_body.decode("utf-8")) # Optional: validate webhook["timestamp"] for replay protection. # Optional: deduplicate by request.headers.get("x-webhook-id"). event = webhook.get("event") if event == "invoice.statusChanged": # Handle invoice status update. pass elif event == "withdrawal.statusChanged": # Handle withdrawal status update. pass elif event == "deposit.statusChanged": # Handle deposit status update. pass return "ok", 200 ``` Read `r.Body` before unmarshalling JSON so you verify the exact raw request body. ```go package main "crypto/hmac" "crypto/sha256" "encoding/hex" "encoding/json" "io" "net/http" "os" "strings" ) func verifyCryptonlySignature(rawBody []byte, signatureHeader, secret string) bool { signatureHeader = strings.TrimSpace(signatureHeader) if signatureHeader == "" { return false } mac := hmac.New(sha256.New, []byte(secret)) mac.Write(rawBody) expected := hex.EncodeToString(mac.Sum(nil)) received := strings.ToLower(signatureHeader) if len(expected) != len(received) { return false } return hmac.Equal([]byte(expected), []byte(received)) } func cryptonlyWebhook(w http.ResponseWriter, r *http.Request) { rawBody, err := io.ReadAll(r.Body) if err != nil { http.Error(w, "invalid body", http.StatusBadRequest) return } secret := os.Getenv("CRYPTONLY_WEBHOOK_SECRET") if secret == "" { http.Error(w, "webhook secret is not configured", http.StatusInternalServerError) return } signature := r.Header.Get("X-Webhook-Signature") if !verifyCryptonlySignature(rawBody, signature, secret) { http.Error(w, "invalid signature", http.StatusUnauthorized) return } var webhook struct { Event string `json:"event"` Data json.RawMessage `json:"data"` Timestamp string `json:"timestamp"` } if err := json.Unmarshal(rawBody, &webhook); err != nil { http.Error(w, "invalid json", http.StatusBadRequest) return } // Optional: validate webhook.Timestamp for replay protection. // Optional: deduplicate by r.Header.Get("X-Webhook-Id"). switch webhook.Event { case "invoice.statusChanged": // Handle invoice status update. case "withdrawal.statusChanged": // Handle withdrawal status update. case "deposit.statusChanged": // Handle deposit status update. } w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte("ok")) } func main() { http.HandleFunc("/webhooks/cryptonly", cryptonlyWebhook) http.ListenAndServe(":8080", nil) } ``` Read `php://input` so you verify the exact raw request body. ```php Read the request body bytes before parsing JSON. This example uses the JDK HTTP server and Jackson. ```java public class CryptonlyWebhook { private static final ObjectMapper JSON = new ObjectMapper(); static boolean verifyCryptonlySignature(byte[] rawBody, String signatureHeader, String secret) { if (signatureHeader == null || signatureHeader.isBlank()) { return false; } try { Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256")); byte[] expected = mac.doFinal(rawBody); byte[] received = HexFormat.of().parseHex(signatureHeader.trim()); return MessageDigest.isEqual(expected, received); } catch (GeneralSecurityException | IllegalArgumentException e) { return false; } } static void handle(HttpExchange exchange) throws IOException { if (!"POST".equalsIgnoreCase(exchange.getRequestMethod())) { send(exchange, 405, "method not allowed"); return; } byte[] rawBody = exchange.getRequestBody().readAllBytes(); String secret = System.getenv("CRYPTONLY_WEBHOOK_SECRET"); if (secret == null || secret.isEmpty()) { send(exchange, 500, "webhook secret is not configured"); return; } String signature = exchange.getRequestHeaders().getFirst("X-Webhook-Signature"); if (!verifyCryptonlySignature(rawBody, signature, secret)) { send(exchange, 401, "invalid signature"); return; } JsonNode webhook = JSON.readTree(rawBody); String event = webhook.path("event").asText(); // Optional: validate webhook.path("timestamp") for replay protection. // Optional: deduplicate by exchange.getRequestHeaders().getFirst("X-Webhook-Id"). switch (event) { case "invoice.statusChanged" -> { // Handle invoice status update. } case "withdrawal.statusChanged" -> { // Handle withdrawal status update. } case "deposit.statusChanged" -> { // Handle deposit status update. } default -> { } } send(exchange, 200, "ok"); } private static void send(HttpExchange exchange, int status, String body) throws IOException { byte[] bytes = body.getBytes(StandardCharsets.UTF_8); exchange.sendResponseHeaders(status, bytes.length); exchange.getResponseBody().write(bytes); exchange.close(); } public static void main(String[] args) throws IOException { HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0); server.createContext("/webhooks/cryptonly", CryptonlyWebhook::handle); server.start(); } } ``` ## Delivery ### Delivery behavior and retries Cryptonly expects your server to respond with a successful `2xx` status code. | Behavior | Description | | ----------------- | --------------------------------------------------------------------------- | | Success | Any `2xx` response is treated as successful | | Failure | Non-`2xx` responses, including `3xx` redirects, are treated as failed | | Timeout | Webhook delivery has a 10-second timeout | | Invalid signature | Your server should return `401 Unauthorized` | | Retry policy | Cryptonly makes up to 15 delivery attempts in total | | Retry delay | Retries use exponential backoff starting from 20 seconds | | Not retried | An invalid URL, or a URL that resolves to a private or reserved address | If your endpoint is temporarily unavailable, Cryptonly will retry delivery automatically. The retry delay grows after each failed attempt. In practice, this means retries are spaced out approximately like this: | Retry | Approximate delay after previous failed attempt | | ---------- | ----------------------------------------------- | | 1st retry | 20 seconds | | 2nd retry | 40 seconds | | 3rd retry | 80 seconds | | 4th retry | about 2.7 minutes (160 seconds) | | 5th retry | about 5.3 minutes (320 seconds) | | 6th retry | about 10.7 minutes (640 seconds) | | 7th retry | about 21 minutes (1,280 seconds) | | 8th retry | about 43 minutes (2,560 seconds) | | 9th retry | about 85 minutes (5,120 seconds) | | 10th retry | about 2.8 hours (10,240 seconds) | | 11th retry | about 5.7 hours (20,480 seconds) | | 12th retry | about 11.4 hours (40,960 seconds) | | 13th retry | about 22.8 hours (81,920 seconds) | | 14th retry | about 45.5 hours (163,840 seconds) | With 15 total attempts, that is 1 initial delivery plus up to 14 retries. The last retry happens about 3 days 19 hours after the first attempt. After that the delivery is marked `failed`, and a member with the Owner, Admin or Developer role can still resend it from the delivery log. :::note Retry timing may vary slightly depending on queue load and infrastructure conditions. ::: Your handler should avoid long-running processing before responding. If needed, store the event and process it asynchronously. ### Webhook delivery log and manual resend Every webhook Cryptonly sends is listed in the Cryptonly Merchant Dashboard under **Webhooks**, **Settings → Integration → Webhook delivery log**, and **View deliveries** on a transaction. Each entry shows the event, resource, endpoint URL, and status (`pending`, `retrying`, `succeeded` shown as **Delivered**, or `failed`), plus every attempt's request and response. Filter by status, event, resource type, or date, and search by `x-webhook-id`, resource id, or `orderId`. Members with the Owner, Admin or Developer role can **Resend now** a `failed` or `succeeded` delivery. The resend uses the recorded URL, the same `x-webhook-id` and `data`, the current signing key, and a new `timestamp`. A delivery that is still retrying cannot be resent until it finishes. ### Duplicate events and replay protection See [Idempotency](/api-reference/idempotency/#duplicate-events-and-replay-protection). ## Going live ### Security checklist Before going live, make sure that: * your webhook URL uses HTTPS; * your server verifies `x-webhook-signature`; * invalid signatures are rejected with `401 Unauthorized`; * verification uses the raw request body; * signature comparison is timing-safe; * the webhook signing key is stored securely; * replay protection or event deduplication is implemented; * webhook processing is idempotent; * test webhooks from **Settings → Integration → Test webhooks** pass. See [Testing your integration](/guides/testing-your-integration/#test-webhooks). ## Related pages - [Authorization](https://docs.cryptonly.net/api-reference/authorization.md): Where the webhook signing key is issued - [Idempotency](https://docs.cryptonly.net/api-reference/idempotency.md#duplicate-events-and-replay-protection): Reject replays and duplicate webhook events - [Testing your integration](https://docs.cryptonly.net/guides/testing-your-integration.md): Send a signed test webhook from the Cryptonly Merchant Dashboard # API reference > Base URLs, authentication, errors, and rate limits for the Cryptonly merchant API. The Cryptonly merchant API is a JSON over HTTPS API. Call it from your backend only, never from a browser or mobile app. New to the API? Start with the [Quickstart](/quickstart/). ## Base URLs | Environment | Base URL | | --- | --- | | Production | `https://api-merchant.cryptonly.net` | | Sandbox | `https://sandbox-api-merchant.cryptonly.net` | The two environments are fully separate, with their own dashboards, API keys, and signing keys. See [Sandbox environment](/guides/sandbox-environment/). ## Organizations and accounts Your **organization** can hold several **accounts**, each with its own balances. * **API keys** and **webhook signing keys** belong to an account. Create them under **Accounts → *account* → Settings → Security**. Requests authenticated with a key operate on that account. * **Default webhook URLs** belong to the organization. Configure them under **Settings → Integration**. * The API key determines the account, so requests never take an `accountId`. To work with several accounts, use a separate key for each. ## Authentication Send your API key in the `x-tenant-api-key` header: ```http x-tenant-api-key: YOUR_API_KEY ``` See [Authorization](https://docs.cryptonly.net/api-reference/authorization.md) for creating keys and scopes. ## Requests and responses * Send request bodies as JSON with `Content-Type: application/json`. * Create requests take an `orderId`, your own reference and the [idempotency key](https://docs.cryptonly.net/api-reference/idempotency.md). * Errors return a JSON body with a stable `code` and a human-readable `message`. See [HTTP status codes](https://docs.cryptonly.net/api-reference/http-status-codes.md). * Each API key can make up to **200 requests per minute**. Beyond that, the API returns `429`. The [OpenAPI reference](/api-reference/openapi/) lists every endpoint with its request and response fields. ## Related pages - [Authorization](https://docs.cryptonly.net/api-reference/authorization.md): API keys for server-to-server requests - [OpenAPI reference](https://docs.cryptonly.net/api-reference/openapi/): Every endpoint and field - [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Payment notifications sent to your server - [HTTP status codes](https://docs.cryptonly.net/api-reference/http-status-codes.md): Error format and codes