Skip to main content

Documentation Index

Fetch the complete documentation index at: https://yanhgming.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Marlin is a stablecoin-native billing platform. Rather than processing traditional fiat payments through a bank network, every transaction settles directly on Solana using one of three supported stablecoins. Because all three tokens share the same six-decimal precision, the same amount encoding rules apply across the board.

Supported tokens

Marlin supports USDC, PYUSD, and USDG on both Solana mainnet and devnet.

USDC

USD Coin — issued by Circle. The most widely used stablecoin on Solana.

PYUSD

PayPal USD — issued by PayPal. Regulated US dollar stablecoin.

USDG

Global Dollar — issued by the Global Dollar Network.

Mint addresses

Each token is identified by its SPL mint address on Solana:
TokenNetworkMint address
USDCMainnetEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
PYUSDMainnet2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo
USDGMainnet2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH
USDCDevnet4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU
PYUSDDevnetCXk2AMBfi3TwaEL2468s6zP8xq9NxTXjp9gjMgzeUynM
USDGDevnetGh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr
Marlin resolves the correct mint address automatically based on your account’s active network — you specify the currency by symbol ("USDC", "PYUSD", or "USDG") in your API requests.

How amounts work

All amounts in Marlin — on invoices, plans, and API responses — are expressed as integers in the token’s smallest unit, not as decimal strings. All three supported stablecoins use 6 decimal places.
Human-readable amountamount value
$1.001000000
$9.909900000
$49.0049000000
$0.0110000
To convert: multiply the dollar amount by 10^6. To display a stored amount: divide by 10^6 and format to two decimal places.
Never use floating-point arithmetic for amount calculations. Use BigInt internally to avoid rounding errors. Multiply by 10n ** 6n to convert to the smallest unit, and divide to format for display.
// Convert a decimal string to the smallest unit
function toSmallestUnit(decimal: string, decimals = 6): bigint {
  const [whole, fraction = ""] = decimal.split(".");
  const padded = fraction.padEnd(decimals, "0").slice(0, decimals);
  return BigInt(whole) * BigInt(10 ** decimals) + BigInt(padded);
}

// toSmallestUnit("49.00") → 49000000n
// toSmallestUnit("9.90")  →  9900000n

The currency field

The currency field on an invoice or subscription plan is a string that maps to one of the supported token symbols: "USDC", "PYUSD", or "USDG". Marlin resolves this symbol to the correct mint address for the active cluster (mainnet or devnet) before constructing any on-chain transaction.
// Creating an invoice in PYUSD
await marlin.invoices.create({
  customerId: "cus_01HXYZ",
  currency: "PYUSD",
  lineItems: [{ description: "Consulting — May 2026", quantity: 1, unitAmount: 150000000 }],
  autoSend: true,
});
When you onboard as a merchant, you choose a default settlement mint for your account. All invoices and plans use this default unless you explicitly pass a currency field to override it on a per-invoice or per-plan basis.

Non-custodial settlement

Marlin never holds your funds. When a customer pays an invoice, the on-chain smart contract transfers tokens atomically in a single Solana transaction:
  • 99.5% of the invoice amount goes directly to your configured settlement wallet.
  • 0.5% (50 basis points) goes to the Marlin protocol treasury.
There is no withdrawal step, no daily payout batch, and no intermediary wallet. The moment the transaction confirms on-chain, the funds are in your wallet.
You can verify any payment independently using the transactionSignature on a paid invoice. Paste it into Solscan or any Solana explorer to see the exact token transfers.