LayerHopDocsLaunch app (opens in a new tab)

Checkout (pay with any token)

Accept crypto payments in USDC or USDT while your customers pay with any token on any of 71 chains. Create a checkout session, send the payer to the hosted page, and get a checkout.session.completed webhook once LayerHop has verified the delivery on chain.

Checkout lets you get paid in a stablecoin you choose (USDC or USDT on Ethereum, Arbitrum, Base, Optimism, BNB Chain, Polygon or Solana) while your customer pays with any token on any chain LayerHop routes. You create a checkout session for an amount, send the customer to its hosted page, and LayerHop routes their payment so that at least the amount due lands in your wallet. When the delivery is verified on chain, the session becomes paid and you receive a checkout.session.completed webhook.

LayerHop never holds the funds: the payer's wallet sends them, and the route delivers straight to your address.

How it works#

  1. Your server creates a session with an API key: amount, settlement token and chain, your payout address. You get back a hosted url (https://layerhop.com/pay/cs_…). You can also create payment links by hand in the dashboard under Payments.
  2. Your customer opens the link, connects an EVM or Solana wallet (or a Tron wallet, where Tron is available) and picks what to pay with. The page asks LayerHop for a route that delivers the full amount to your address and shows exactly what they pay.
  3. The payer signs one transaction (plus an approval for some ERC-20 tokens). The session moves to processing.
  4. LayerHop tracks the payment and, once it has landed, checks the settlement chain for a transfer of at least the amount due to your address. Only then is the session paid and the webhook sent. The page sends the customer back to your successUrl.
Session status Meaning
open Waiting for payment. A failed or refunded payment attempt returns the session here so the customer can try again.
processing A payment was sent and is being tracked.
paid Delivery to your address was verified on the settlement chain. Fulfil the order.
expired Not paid before expiresAt (default 60 minutes), or you expired it.
needs_review The payment completed but the delivery could not be verified automatically. Rare; contact dev@layerhop.com with the session id.

1. Create a session#

Terminal
curl -X POST https://api.layerhop.com/v1/checkout/sessions \
  -H "x-api-key: $LAYERHOP_API_KEY" -H "content-type: application/json" \
  -d '{
    "amount": "49000000",
    "settleChain": "base",
    "settleToken": "USDC",
    "recipient": "0xYourPayoutAddress",
    "description": "Pro plan, 1 month",
    "reference": "order_1042",
    "successUrl": "https://shop.example.com/thanks",
    "cancelUrl": "https://shop.example.com/cart"
  }'

With the TypeScript SDK:

TypeScript
import { LayerHop } from "@layerhop/sdk";

const lh = new LayerHop({ apiKey: process.env.LAYERHOP_API_KEY });
const session = await lh.checkout.create({
  amount: "49000000", // 49 USDC (6 decimals)
  settleChain: "base",
  settleToken: "USDC",
  recipient: "0xYourPayoutAddress",
  description: "Pro plan, 1 month",
  reference: "order_1042",
  successUrl: "https://shop.example.com/thanks",
});
// Redirect the customer to session.url
Field Notes
amount Integer string in base units of the settlement token (USDC and USDT have 6 decimals, except 18 on BNB Chain).
settleChain, settleToken One of the supported pairs: USDC on Ethereum, Arbitrum, Base, Optimism, BNB Chain, Polygon or Solana; USDT on Ethereum, Arbitrum, BNB Chain or Solana.
recipient Your payout address on the settlement chain. LayerHop sets it on every route; the payer cannot change it.
description, merchantName Shown to the payer.
reference, metadata For your records. Returned to you and in webhooks, never shown to the payer.
successUrl, cancelUrl Where the hosted page sends the payer. ?session_id=cs_… is appended to successUrl.
expiresInMinutes 5 to 10080 (7 days). Default 60.

2. Send the customer to the hosted page#

Redirect to session.url, link to it, or show it as a QR code. To keep customers on your site, open the session in a popup or inline with the embedded checkout instead. For a fixed price with no backend, use a product and payment button; for WooCommerce, the WordPress plugin. The page works on desktop and mobile with any EVM or Solana wallet, shows the amount due and the expiry, and walks the payer through approval, signing and confirmation. Sessions can be paid once.

3. Fulfil on the webhook#

Add a webhook endpoint subscribed to checkout.session.completed (or to all events) and verify the signature as usual. The event carries the session:

JSON
{
  "id": "evt_…",
  "type": "checkout.session.completed",
  "livemode": true,
  "createdAt": "2026-10-18T10:03:12.000Z",
  "data": {
    "session": {
      "id": "cs_01k7t9m2c4x8q6r0v3b5n7p9d",
      "status": "paid",
      "amount": "49000000",
      "settlement": { "chainId": 8453, "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "symbol": "USDC", "decimals": 6 },
      "recipient": "0xyourpayoutaddress",
      "reference": "order_1042",
      "payment": { "payer": "0x…", "srcChainId": 42161, "srcToken": "0x0000000000000000000000000000000000000000", "srcAmount": "15623001000000000", "srcTxHash": "0x…", "dstTxHash": "0x…", "paidAt": "2026-10-18T10:03:12.000Z" }
    }
  }
}

Match the session to your order with reference (or the session id) and fulfil it. The other checkout events are checkout.session.processing (a payment was sent), checkout.session.payment_failed (the attempt failed or was refunded; the session is open again), checkout.session.expired, and checkout.session.refunded (you refunded part or all of a paid session). You can also poll GET /v1/checkout/sessions/{id}.

Tip

Treat paid as final. Do not fulfil on processing: a cross-chain payment can still be refunded.

Sessions also carry:

Field Meaning
refundedAmount Total of completed refunds, in settlement-token base units ("0" until you refund). The session stays paid after a refund.
invoiceId The invoice this session pays, or null.
productId The product the session was started from, or null.

Pay by QR code#

The hosted page offers three ways to pay: Connect wallet, Scan on phone and Send to address.

  • Scan on phone shows a QR code of the payment page itself, a copy-link button and "Open in MetaMask / Coinbase Wallet / Phantom" links. The payer opens the same page on their phone, in a wallet app's browser, and pays there with a connected wallet as usual (normal fees, normal verification).
  • Send to address lets the payer pay without connecting anything to the page, by scanning a payment request QR or copying the address and amount. The session is marked paid automatically once the payment lands, with the same checkout.session.completed webhook; payment.method is transfer (and payment.quoteId is null). Funds go straight to your recipient; LayerHop never holds them.
    • Solana sessions: the QR is a Solana Pay transaction request. The wallet asks LayerHop for one transaction with the transfer to you, LayerHop's 0.25% same-token fee on top (exactly as for a connected wallet) and a per-session reference key that LayerHop looks up to find the payment.
    • EVM sessions, deposit address (on chains where LayerHop has deployed its fee-splitting deposit contract): each session gets its own deposit address. The payer sends the exact amount shown (the amount due plus LayerHop's 0.25% same-token fee, sized so you receive at least the amount due) with an EIP-681 QR or by copying address and amount. The session is paid once the deposit is confirmed; shortly after, LayerHop sweeps the deposit to your recipient (transfer.sweepTxHash). The contract is non-custodial and has no owner: it can only ever pay your recipient and LayerHop's fee, and anyone (including you) can trigger the sweep. A deposit address is the same on every chain where the contract exists, so a payment sent on the wrong network still reaches your recipient address there; if your recipient is a smart-contract wallet that doesn't exist on that network, contact support. If your recipient can't receive the token (for example a blocklisted USDC address), the sweep can't pay it; the contract's sweepTo lets the recipient address itself send the deposit (minus the fee) to another address of yours.
    • Deposit addresses are offered on Base, Arbitrum, OP Mainnet, Polygon and BNB Chain: the low-fee EVM chains where checkout settles. Not on Ethereum mainnet: there the gas to sweep a deposit costs more than the fee. The contract, CheckoutSplitterFactory, has the same address on every one of them, 0xbC8CF31dd2E2f501587df0cfbA703E7298DB100e, with its source verified on Sourcify.
    • EVM sessions, other chains: not available on LayerHop's hosted service (transferAvailable: false). Where an operator enables it (CHECKOUT_TRANSFER_LIVE=1), the payer sends the exact amount shown to your recipient with an EIP-681 QR. That amount is the amount due plus a few millionths of a token (at most 0.0099): those last digits identify the session, so several open sessions can share one payout address.

The page warns the payer to send exactly the amount shown, in that token, on that network: other tokens or networks aren't detected. While waiting it shows "Waiting for payment", then "Payment seen, confirming" (EVM chains that need confirmations), then the paid screen.

Case What happens
Exact amount paid.
Less (for example an exchange took its withdrawal fee from the amount) The session stays open with statusDetail "received X of Y; send the remaining Z", and the page shows the rest to send.
More paid, with statusDetail "overpaid by X". Refund the difference with a refund if you want to.
More than one payment to a deposit address Payments that arrive before the sweep are swept with it. Funds that arrive after the sweep (a late top-up, a second payment) set the session to needs_review; LayerHop checks them and sweeps them to you (minus the fee). Very small deposits (under about $1) aren't swept automatically.
Arrives after the session expired needs_review: the money is in your wallet, decide yourself. Sessions are watched for 24 hours after they expire.

In your own page: transferAvailable on the session says whether the option exists; POST /v1/checkout/sessions/{id}/transfer returns the session with a transfer object (uri for the QR, address, amount, received, seen, state). Test-mode sessions can't be paid by transfer.

Pay with Bitcoin (rolling out)#

Where it is enabled, sessions that settle on an EVM chain show a fourth option, Bitcoin (bitcoinAvailable: true). The payer sends BTC from any wallet or exchange and you still receive exactly the amount due in your settlement token; nothing changes on your side (same session, same checkout.session.completed webhook).

  • The page shows a Bitcoin deposit address, the exact BTC amount and a BIP21 QR code. The address comes from Relay and is bound to this one payment: Relay converts the BTC and delivers the amount due to your recipient. LayerHop never holds the funds.
  • The BTC price holds for about 20 minutes (a countdown on the page); after that the payer gets a fresh quote. A payment already seen in the mempool keeps the session open until it completes, usually a few minutes after one Bitcoin confirmation (two for large amounts).
  • Fees: LayerHop's API channel fee (0.1%) plus Relay's conversion and network fees are included in the BTC amount, as on any routed checkout payment.
  • payment.srcChainId is 8253038 (Relay's id for Bitcoin), payment.srcTxHash the Bitcoin transaction and payment.dstTxHash the delivery to you, which LayerHop verifies on chain before the session becomes paid.
Case What happens
Exact amount paid.
Less Relay refunds the BTC (minus network fees) to the payer's refund address, or to the sending address when none was given. The session stays open with a note and you get checkout.session.payment_failed; the payer can pay again.
More You receive the amount due; Relay refunds the excess to the payer.
Delivered after the session expired needs_review: the money is in your wallet, decide yourself.

Payers sending from an exchange should enter a refund address of their own: exchange hot wallets can't receive refunds reliably. In your own page: POST /v1/checkout/sessions/{id}/bitcoin returns the session with a bitcoin object (address, amountSats, amountBtc, uri, expiresAt, status). Test-mode sessions can't be paid in Bitcoin.

Invoices, refunds and analytics#

  • Invoices: bill a customer by email with line items. LayerHop hosts the invoice at layerhop.com/invoice/{id}, starts a checkout session when they pay, and emails a receipt.
  • Refunds: return all or part of a paid session to the payer's original chain and token. You sign the refund from your own wallet; LayerHop routes and tracks it.
  • Analytics and CSV export: revenue, conversion and refunds in the dashboard, and every session as a CSV for your accounting.

What the payer pays#

  • Same token, same chain (for example USDC on Base for a USDC-on-Base session): a plain token transfer of exactly the amount to you, plus LayerHop's 0.25% fee on top, sent by the payer straight to LayerHop (the quote shows fees.ourFeeBps: 25 and srcAmount = amount + fee). You still receive the full amount. On Solana both transfers are in one transaction. On EVM chains the fee is a second ERC-20 transfer in the built transaction's extraTxs, sent after the payment. The hosted checkout sends both in one confirmation when the wallet supports EIP-5792 batching; in your own integration, @layerhop/wagmi does the same. Nothing is held by LayerHop either way.
  • Anything else: a swap or bridge route through LayerHop's providers. The route guarantees at least the amount due after slippage, so the payer sends slightly more than the face value (usually under 1%, capped at about 3%), and you may receive a little extra. The standard LayerHop API fee (0.10%) and the provider's fees are included in what the payer sees before signing.

How LayerHop verifies payments#

A session is only marked paid after LayerHop checks the settlement chain:

  • the delivering transaction succeeded and contains a transfer of the settlement token to your recipient totalling at least amount (EVM: Transfer logs; Solana: the token balance change of your account);
  • it was mined after the session was created;
  • for a direct transfer, it came from the payer;
  • it has not already paid another session (a transaction can pay only one session).

A link cannot be paid from its own payout address: a transfer from your wallet to itself moves nothing, so LayerHop refuses to quote it (INVALID_PARAMS). To try a live link yourself, pay from a different wallet.

If any check fails the session goes to needs_review instead of paid.

Before any of that, LayerHop also checks the payer's own transaction on the source chain: it must be the transaction LayerHop built for this payment (same contract and calldata), mined after LayerHop built it. Somebody else's transfer to your address can't be reported as a payment.

Can customers pay from Tron?#

Yes, where Tron is available. A customer with a Tron wallet (TronLink or WalletConnect) can pay with USDT or TRX on Tron; the payment is routed to your settlement chain like any other cross-chain payment, and you still receive USDC or USDT there. Your settlement chain and payout address can't be on Tron.

In your own integration, quote with srcChain: "tron" and the customer's T-address as sender. POST /v1/orders then returns a TronTx: the customer signs the token approval (for USDT) and then the deposit, and you report the deposit's transaction id with POST /v1/orders/{quoteId}/submitted (not the approval's: it is refused). Tron burns TRX for network fees, so the customer's wallet needs some TRX also when paying in USDT; the hosted page checks this before asking for a signature.

A refund of a Tron payment goes back to the customer's token on Tron (to: "original"); to: "settlement" isn't possible because a Tron address can't receive on your settlement chain.

Test mode#

Create sessions with an lh_test_ key (or with Test mode on in the dashboard). Test sessions (cs_test_…) are paid through the sandbox: the hosted page shows a Test mode badge, nothing moves on chain, and the session is paid about 10 to 20 seconds after the payment is reported. Webhooks go to your test endpoints only. Use the magic amounts to rehearse a failed or refunded payment.

Build your own payment page#

The hosted page uses public endpoints you can call yourself:

  1. GET /v1/checkout/sessions/{id} to show the amount and status (no key needed; reference and metadata are omitted).
  2. POST /v1/checkout/sessions/{id}/quote with { srcChain, srcToken, sender }. Every quote's dstAmountMin is at least the amount due, and srcAmount is what the payer sends.
  3. POST /v1/orders with the quoteId, sign the transaction in the payer's wallet, then POST /v1/orders/{quoteId}/submitted with the hash.
  4. Poll the session until it is paid.

With the SDK: lh.checkout.get(id), lh.checkout.quote(id, { srcChain, srcToken, sender }), lh.buildTx(quoteId), lh.reportSubmitted(quoteId, txHash).

Last updated