Documentation

How to Use Everything in TurboPay

Complete guide for users, merchants, platforms, and AI agents — covering instant browser wallets, 1-click USDC & ETH checkout on Base, gasless x402 relays, recurring EIP-2612 subscriptions, platform fee splits, and on-chain verification.

1. Using Your TurboPay Wallet

TurboPay gives every visitor an instant, non-custodial wallet directly in their browser with zero extensions or app installs required. Your private keys are generated client-side and stored only in your browser's local storage — TurboPay never sees or touches your keys.

Funding Your Wallet

Send USDC (and a small amount of ETH on Base if using the Free tier) on the Base network to the address shown on the home page. Click the QR code icon next to your address to scan from any mobile wallet or exchange.

Backing Up Your Private Key

Always back up your hot wallet! On the home page, click the copy icon inside the BACKUP YOUR PRIVATE KEY banner and save it in a password manager.

Multi-Wallet Switcher & Import Key

Click your wallet address pill on the home page to open the Your Wallets dialog. From there you can switch between wallets, click New Wallet to generate an additional address, or click Import Key to import an existing hex private key.

External Browser Wallets & Direct Send

Prefer MetaMask or Coinbase Wallet? On any /pay screen, click Use Browser Wallet (MetaMask / Coinbase) to sign or pay from your extension. You can also send USDC directly to any 0x... address from the home page by clicking Pay.

2. One-Time Checkout Integration (/pay)

Accepting payments requires no signup or SDK installation. Simply link or redirect your customer to https://turbopay.me/pay with your payment parameters:

https://turbopay.me/pay?appName=MyStore&description=Order+%23123&to=0xYourMerchantAddress&amount=10.00&symbol=usdc&network=base&data=%7B%22orderId%22%3A%22ord_123%22%7D&successURL=https%3A%2F%2Fmystore.com%2Fcheckout%2Fsuccess&cancelURL=https%3A%2F%2Fmystore.com%2Fcart
Checkout Query Parameters
Parameter Required Description
appName Required The display name of your store or application.
description Required Description of the item, order, or service being purchased.
to Required Your recipient wallet address on Base (0x...).
amount Required Amount to charge in decimal format (e.g. 10.00).
symbol Optional Token symbol: usdc (default) or eth.
network Optional Blockchain network: base (default).
successURL Optional URL where TurboPay redirects the customer after on-chain confirmation. Receives the turbo JSON query parameter.
cancelURL Optional URL for the back arrow button if the customer cancels checkout.
data Optional JSON-encoded object (e.g. {"orderId":"ord_123"}) passed back untouched inside the turbo redirect payload.
mode Optional payment (default) for one-time checkout or subscription for recurring USDC billing.
platformAddress & platformFeeBps Optional Platform fee recipient address and fee in basis points (e.g. 250 = 2.5%). See Platform Fee Splitting.
Handling the successURL Redirect

Once the transaction is confirmed on Base, TurboPay redirects the user to your successURL with a URL-encoded turbo query parameter:

const params = new URL(window.location.href).searchParams
const rawTurbo = params.get('turbo')
if (rawTurbo) {
  const turbo = JSON.parse(decodeURIComponent(rawTurbo))
  console.log('Confirmed tx hash:', turbo.transaction.hash)
  console.log('Custom order data:', turbo.data)
}

Example decoded turbo object:

{
  "transaction": {
    "hash": "0x...",
    "status": "success",
    "blockNumber": "12345678"
  },
  "from": "0xCustomerWalletAddress",
  "to": "0xYourMerchantAddress",
  "amount": "10.00",
  "symbol": "usdc",
  "network": "base",
  "mode": "payment",
  "data": { "orderId": "ord_123" }
}

3. Merchant On-Chain Verification (Required)

To prevent spoofed redirects, underpayments, and replay attacks, always verify transactions on-chain on your backend before fulfilling an order:

  1. Never trust redirect query parameters blindly: Treat the turbo parameter as a notification containing the transaction.hash, then verify that hash via a Base RPC.
  2. Prevent replay attacks: Store processed txHash values in a UNIQUE database column so the same transaction hash cannot be claimed twice.
  3. Check receipt status: Verify receipt.status === 'success'.
  4. Verify token contract, recipient, and amount: For Base USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913), decode the ERC-20 Transfer event log and confirm to matches your merchant address and value >= expectedUnits.
Backend Verification Example (Node.js & viem)
import { createPublicClient, http, parseAbiItem, parseUnits, decodeEventLog } from 'viem'
import { base } from 'viem/chains'

const USDC_BASE_ADDRESS = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'

const publicClient = createPublicClient({
  chain: base,
  transport: http(process.env.BASE_RPC_URL || 'https://mainnet.base.org'),
})

export async function verifyTurboPayment({ txHash, expectedMerchantAddress, expectedAmountUSDC, orderId, db }) {
  // 1. Prevent replay attacks
  const existingOrder = await db.orders.findByTxHash(txHash)
  if (existingOrder) {
    throw new Error('Transaction hash has already been used.')
  }

  // 2. Fetch transaction receipt on Base
  const receipt = await publicClient.getTransactionReceipt({ hash: txHash })
  if (!receipt || receipt.status !== 'success') {
    throw new Error('Transaction is not confirmed or reverted on-chain.')
  }

  // 3. Verify ERC-20 USDC Transfer event
  const transferEventAbi = parseAbiItem('event Transfer(address indexed from, address indexed to, uint256 value)')
  const expectedValueUnits = parseUnits(expectedAmountUSDC.toString(), 6)

  let paymentFound = false
  for (const log of receipt.logs) {
    if (log.address.toLowerCase() !== USDC_BASE_ADDRESS.toLowerCase()) continue
    try {
      const decoded = decodeEventLog({ abi: [transferEventAbi], data: log.data, topics: log.topics })
      if (
        decoded.eventName === 'Transfer' &&
        decoded.args.to.toLowerCase() === expectedMerchantAddress.toLowerCase() &&
        decoded.args.value >= expectedValueUnits
      ) {
        paymentFound = true
        break
      }
    } catch {}
  }

  if (!paymentFound) {
    throw new Error('Valid USDC transfer matching merchant and amount was not found.')
  }

  await db.orders.update(orderId, { status: 'PAID', transactionHash: txHash })
  return { success: true, blockNumber: receipt.blockNumber }
}

4. Connecting User Wallets (/connect)

Want to identify a user's wallet address to personalize your app or display their balances without charging them? Redirect them to /connect. Connecting only shares the user's public 0x... address — it never grants spending permissions.

https://turbopay.me/connect?appName=MyApp&successURL=https%3A%2F%2Fmyapp.com%2Fauth%2Fcallback&cancelURL=https%3A%2F%2Fmyapp.com%2Flogin
  • appName (Required): Your application name shown on the prompt.
  • successURL (Required): Where to redirect once the user clicks Connect. TurboPay appends ?address=0x...&data=%7B%22address%22%3A%220x...%22%7D.
  • cancelURL (Required): Where to send the user if they click back.

5. Recurring USDC Subscriptions (/pay?mode=subscription)

TurboPay supports gasless recurring USDC subscriptions on Base powered by EIP-2612 Permits. Customers authorize a recurring allowance with a single gasless signature, and TurboPay settles the first charge immediately and processes renewals automatically on schedule.

https://turbopay.me/pay?mode=subscription&interval=month&appName=MySaaS&description=Pro+Plan&to=0xYourMerchantAddress&amount=15.00&symbol=usdc&network=base&webhookURL=https%3A%2F%2Fmysaas.com%2Fwebhooks%2Fturbopay&successURL=https%3A%2F%2Fmysaas.com%2Fwelcome&cancelURL=https%3A%2F%2Fmysaas.com%2Fpricing
Subscription Parameters & Lifecycle
  • mode=subscription: Enables recurring EIP-2612 Permit subscription checkout.
  • interval: month (30 days, default) or year (365 days).
  • webhookURL (optional): HTTPS endpoint to receive POST webhook events (includes x-turbopay-secret header when configured): subscription.created, subscription.renewed, subscription.pastDue, subscription.canceled, and subscription.expired.
  • Success Redirect Payload: Includes subscription: { id, status, interval, nextBillingAt, expiresAt } inside the turbo query param.
Querying & Canceling Customer Subscriptions via API
# 1. Fetch a subscription by ID
GET /x402/subscriptions?subscriptionId=sub_...

# 2. List subscriptions by subscriber or merchant
GET /x402/subscriptions?subscriber=0xSubscriberAddress
GET /x402/subscriptions?merchant=0xMerchantAddress&subscriber=0xSubscriberAddress

# 3. Cancel a customer subscription (at period end or immediately)
POST /x402/subscriptions
Content-Type: application/json

{
  "action": "cancelCustomer",
  "subscriptionId": "sub_...",
  "immediate": false,
  "signature": "0x..." // Wallet signature on "TurboPay:cancelSubscription:<subscriptionId>" (or use x-turbopay-key)
}

6. Platform Fee Splitting & Gas Sponsorship

Marketplaces, SaaS platforms, and multi-tenant apps can automatically split payments and subscriptions between a merchant (to) and a platform treasury (platformAddress) by passing platformFeeBps (basis points, where 100 = 1%, 250 = 2.5%):

https://turbopay.me/pay?appName=CreatorHub&description=VIP+Pass&to=0xCreatorAddress&amount=20.00&symbol=usdc&platformAddress=0xPlatformTreasury&platformFeeBps=250&successURL=https%3A%2F%2Fcreatorhub.example%2Fdone

Flexible Gas Sponsorship: When evaluating whether a USDC payment can be relayed gaslessly via x402, TurboPay checks quota across three parties in order: the merchant (to), the payer (customer's wallet), and the platform sponsor (platformAddress). If any of the three has an active Plus plan, Refill Credits, or Pro status, the checkout is relayed with zero ETH gas required!

7. Gasless Relays, Plus Plan & Refill Credits (/pro)

Anyone — whether a merchant sponsoring customer checkouts or an individual wallet user who has USDC on Base without ETH for gas — can enable gasless x402 relays on /pro:

Plan Price Included Relays & Features
Free Tier $0 Full non-custodial checkout & wallet support. Requires Base ETH in wallet to pay network gas.
Refill Pack $1 USDC 10 gasless settlement credits ($0.10/relay). Credits never expire, and TurboPay relays your credit purchase transaction for free.
Plus Plan $5 USDC / mo 100 gasless USDC relays / month ($0.05/relay), instant payment notification emails, and full transaction history. Subscribed gaslessly via EIP-2612 USDC Permit.
TurboPay Pro Custom Unlimited relays via x-turbopay-key, dedicated high-throughput relayers, multi-chain sponsorship, and 99.9% SLA.

Checking Any Wallet or Merchant Address: Visit /pro?address=0x... or use the Target Wallet / Merchant Address lookup bar on /pro to inspect relay usage, credit balance, or purchase credits for any merchant wallet.

8. Transaction History & Email Alerts (/history)

Visit /history (or /history?address=0x...) to view incoming and outgoing Base transactions, manage your Plus subscription, and configure instant email alerts whenever you receive a payment.

# Fetch transaction history as JSON
GET /x402/history?address=0xYourWalletAddress&limit=50
# or:
GET /history?format=json&address=0xYourWalletAddress

# Update notification email (requires wallet signature on "TurboPay:update:<addressLower>:<email>" or Pro API key)
POST /x402/subscriptions
Content-Type: application/json

{
  "action": "update",
  "merchant": "0xYourWalletAddress",
  "email": "alerts@example.com",
  "signature": "0x..."
}

9. x402 Facilitator API Reference

TurboPay is a full x402 protocol facilitator (Protocol Version 2) on Base (eip155:8453) and Base Sepolia (eip155:84532), enabling automated HTTP 402 micropayments and AI agent payments via EIP-3009 (transferWithAuthorization). All endpoints are available under both /x402/* and the root path.

Endpoint Method Description
/x402/supported GET Returns supported x402 schemes (exact), networks (Base & Base Sepolia), USDC token metadata, fee policy, and relayer signer addresses.
/x402/verify POST Gaslessly validates an EIP-712 TransferWithAuthorization payment payload, checking signature, recipient, amount, validity window, nonce state, and on-chain USDC balance.
/x402/settle POST Executes the signed authorization on-chain using TurboPay's gas-sponsored relayer. Idempotent per authorizer + nonce. Accepts optional x-turbopay-key header.
/x402/usage GET Returns monthly relay usage, plan status, credit balance, and whether gasless settlement is allowed for ?payTo=0x...&payer=0x...&platformAddress=0x....
/x402/credits GET / POST Query credit balance (GET ?merchant=0x...) or purchase refill credits (10 credits per $1 USDC) via a gasless x402 payment payload or an on-chain txHash.
/x402/subscriptions GET / POST Query or manage Plus merchant subscriptions and recurring customer EIP-2612 Permit subscriptions (subscribe, update, cancel, subscribeCustomer, cancelCustomer).
/x402/history GET / POST Query recorded Base payments for an address (GET ?address=0x...) or record a verified on-chain transfer receipt (POST).
Example: Verify & Settle an x402 Payment
POST /x402/settle
Content-Type: application/json
x-turbopay-key: tp_pro_optional_api_key

{
  "x402Version": 2,
  "paymentPayload": {
    "x402Version": 2,
    "accepted": {
      "scheme": "exact",
      "network": "eip155:8453",
      "amount": "1000000",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "payTo": "0xMerchantAddress"
    },
    "payload": {
      "signature": "0x...",
      "authorization": {
        "from": "0xPayerAddress",
        "to": "0xMerchantAddress",
        "value": "1000000",
        "validAfter": "0",
        "validBefore": "1793465600",
        "nonce": "0x..."
      }
    }
  },
  "paymentRequirements": {
    "scheme": "exact",
    "network": "eip155:8453",
    "amount": "1000000",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "payTo": "0xMerchantAddress"
  }
}

The best checkout experience for web3

Go Pro View docs

© 2025 TurboPay

Made with on Earth