Skip to content

Private invoices

A private invoice fixes what the recipient receives while the payer chooses a supported source asset and chain. The invoice creator supplies the output address, chain, and exact amount; the payer supplies inputAddress, sourceAsset or sourceToken, and sourceChainId.

import { parseUsdc, type QuoteRequest, type SilentSwapClient } from '@silentswap/sdk';
 
declare const client: SilentSwapClient;
declare const payerAddress: string;
 
const invoice = {
  address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
  chainId: 8453,
  amount: parseUsdc('25'),
} as const;
 
const payment: QuoteRequest = {
  privacy: true,
  inputAddress: payerAddress,
  sourceAsset: 'ETH',
  sourceChainId: 1,
  outputs: [invoice],
};
 
const quote = await client.quote(payment);
 
// Render every output, asset, fee, and expiry in trusted UI before this line.
const order = await client.placeOrder(quote);
 
void order;

Omit top-level amount to keep exact-output semantics. In this example the recipient gets exactly 25 USDC, while the quote calculates how much ETH the payer must supply, including fees. Changing the payer's source asset or chain does not change the invoice destination.

Share the request safely

An application can serialize the recipient, destination chain, amount, and an optional note into a shareable link. Treat those fields as untrusted input when the link opens: validate them, then show the recipient, chain, asset, amount, fees, and expiry for the payer to approve. A note is application metadata and is not part of QuoteRequest or transaction calldata.

Direct invoices pay USDC on Base (8453) or BNB Chain (56), with a 10 USDC minimum. For another output asset or destination, use the single-recipient dest flow described in pay out in any asset.

The wallet deposit calldata does not reveal the recipient. Render all outputs, assets, fees, and expiry in trusted UI before calling placeOrder.