Docs/Widget Integration

Widget Integration

The fastest way to accept payments. No backend required.

Quick Start

Add two lines to your HTML. The widget handles wallet connection, chain selection, transaction signing, and cross-chain bridging automatically.

Minimal Setup
<script async src="https://checkout.fivo.finance/v1/fivo.js"></script>

<fivo-button
  merchant-id="YOUR_MERCHANT_ID"
  amount="29.99"
  currency="USDC">
</fivo-button>
i

Merchant ID

Your Merchant ID is shown in the page of your dashboard.Integration Format: fivo_live_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Payment Modes

Fixed Amount

For products, invoices, subscriptions. Set the attribute and the customer can only pay that exact price.amount

Variable Amount

For donations, tips, pay-what-you-want. Omit the attribute and the customer enters how much they want to pay.amount

Fixed Amount

Set the price and the system verifies the exact amount on blockchain. Amounts must be between 0.01 and 1,000,000.

Product Checkout
<script async src="https://checkout.fivo.finance/v1/fivo.js"></script>

<!-- Product: $49.99 USDC -->
<fivo-button
  merchant-id="YOUR_MERCHANT_ID"
  amount="49.99"
  currency="USDC">
</fivo-button>

Use Cases

  • E-commerce product checkout
  • SaaS subscription payments
  • Service invoices
  • Event tickets

Variable Amount

Omit the attribute. The widget shows an input field where the customer types how much to pay.amount

Donation / Tip
<script async src="https://checkout.fivo.finance/v1/fivo.js"></script>

<!-- Donation: customer chooses amount -->
<fivo-button
  merchant-id="YOUR_MERCHANT_ID"
  currency="USDC">
</fivo-button>
!

Amount Limits

Variable amounts are validated between 0.01 and 1,000,000. Amounts outside this range will show an error message.

Use Cases

  • Donations and fundraising
  • Tips for content creators
  • Pay-what-you-want pricing
  • Crowdfunding contributions

Attributes

The element accepts the following attributes:<fivo-button>

fivo-button Attributes

merchant-idstringRequired

Your Merchant ID (format: fivo_live_UUID)

amountstringOptional

Fixed payment amount (0.01 - 1,000,000). Omit for variable mode.

currencystringOptional

"USDC" or "EURC". Defaults to "USDC".

wallet-idstringOptional

Specific wallet UUID for multi-wallet merchants. Omit to use your default wallet.

data-amount-fromstringOptional

CSS selector of element containing cart total. Amount is read at click time.

data-referencestringOptional

Your internal reference (order ID, invoice number, etc.). Max 255 chars.

data-descriptionstringOptional

Payment description shown in dashboard. Max 500 chars.

data-metadatastringOptional

JSON string with custom key-value pairs. Max 10KB.

i

Dynamic Attributes

Attributes are reactive. You can update them with JavaScript (e.g. ) and the button label updates automatically.el.setAttribute('amount', '59.99')

Events

The button dispatches custom DOM events you can listen to. All event data is available in .e.detail

fivo:payment-success

Data: txHash, amount, token, chainId

Payment confirmed on blockchain

fivo:payment-error

Data: error

Payment failed or was rejected

fivo:payment-tracking

Data: paymentId, status, step

Cross-chain transfer progress update

Listening for Events
<fivo-button
  id="pay-btn"
  merchant-id="YOUR_MERCHANT_ID"
  amount="25.00"
  currency="USDC">
</fivo-button>

<script>
  const btn = document.getElementById('pay-btn');

  btn.addEventListener('fivo:payment-success', (e) => {
    console.log('TX hash:', e.detail.txHash);
    console.log('Amount:', e.detail.amount, e.detail.token);
    console.log('Chain ID:', e.detail.chainId);
    window.location.href = '/thank-you?tx=' + e.detail.txHash;
  });

  btn.addEventListener('fivo:payment-error', (e) => {
    console.error('Payment failed:', e.detail.error);
  });

  btn.addEventListener('fivo:payment-tracking', (e) => {
    // Only fires for cross-chain (CCTP) payments
    console.log('Step:', e.detail.step, 'Status:', e.detail.status);
  });
</script>

Dynamic Cart

Paste this button inside your cart. It automatically reads the total from your page when the customer clicks. If it doesn't pick up the total, change to match your cart total element's ID.#cartTotal

Cart Integration (Recommended)
<script async src="https://checkout.fivo.finance/v1/fivo.js"></script>

<!-- Replace #cartTotal with YOUR cart total element's ID -->
<fivo-button
  merchant-id="YOUR_MERCHANT_ID"
  data-amount-from="#cartTotal"
  currency="USDC">
</fivo-button>
i

Not picking up the total?

Right-click your cart total, click Inspect. The highlighted code will show . Use in . Dollar signs and commas are stripped automatically.id="something"#somethingdata-amount-from

Advanced: manual control

If you need full programmatic control (e.g. the total isn't visible on the page), you can update the amount attribute directly with JavaScript:

Manual setAttribute
<fivo-button
  id="checkout-btn"
  merchant-id="YOUR_MERCHANT_ID"
  currency="USDC">
</fivo-button>

<script>
  // Update when cart changes
  function updateCheckout(total) {
    document.getElementById('checkout-btn')
      .setAttribute('amount', total.toFixed(2));
  }

  // Redirect after payment
  document.getElementById('checkout-btn')
    .addEventListener('fivo:payment-success', (e) => {
      window.location.href = '/thank-you?tx=' + e.detail.txHash;
    });
</script>
!

E-commerce with order management?

For stores that need server-side order tracking, see below.Checkout Sessions

Multiple Products

Load the script once, then add as many buttons as you need. Each works independently.

Multiple Buttons
<script async src="https://checkout.fivo.finance/v1/fivo.js"></script>

<!-- Product A -->
<fivo-button merchant-id="YOUR_MERCHANT_ID" amount="19.99" currency="USDC"></fivo-button>

<!-- Product B -->
<fivo-button merchant-id="YOUR_MERCHANT_ID" amount="49.99" currency="USDC"></fivo-button>

<!-- Donation (variable) -->
<fivo-button merchant-id="YOUR_MERCHANT_ID" currency="EURC"></fivo-button>

Direct Checkout Link

You can also link directly to the checkout page without embedding the widget. Useful for email invoices, social media links, or QR codes.

Checkout URL Format
https://checkout.fivo.finance?merchant=YOUR_MERCHANT_ID&amount=49.99&currency=USDC

URL Parameters

merchantstringRequired

Your Merchant ID

amountstringOptional

Fixed amount. Omit for variable mode.

currencystringOptional

"USDC" or "EURC". Defaults to "USDC".

walletIdstringOptional

Specific wallet UUID for multi-wallet merchants.

referencestringOptional

Your internal reference (order ID, etc.).

descriptionstringOptional

Payment description.

metadatastringOptional

URL-encoded JSON string with custom data.

Example: Invoice Link
<a href="https://checkout.fivo.finance?merchant=YOUR_MERCHANT_ID&amount=150.00&currency=USDC">
  Pay Invoice #1234, $150.00 USDC
</a>

Checkout Sessions (Redirect Mode)

For server-side integrations, you can create a checkout session via the API and redirect your customer to a Fivo-hosted payment page. After payment, the customer is redirected back to your site. This is similar to Stripe Checkout.

i

Server-Side Integration

Checkout Sessions require an API key. Create one in your . Never expose your API key in client-side code.dashboard

How it works

1

Your server creates a session

Call POST /checkout/sessions with the amount, currency, and a return URL.

2

Redirect the customer

Use the returned URL to redirect your customer to the Fivo checkout page.

3

Customer pays

The customer connects their wallet and completes the payment on the hosted page.

4

Customer returns to your site

After payment, the customer is redirected to your return_url with the session ID.

5

Verify payment on your server

Call GET /checkout/sessions/:id to confirm the payment status before fulfilling the order.

1. Create a session (server-side)

Create Checkout Session
const response = await fetch(`https://api.fivo.finance/checkout/sessions`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': process.env.FIVO_API_KEY,
  },
  body: JSON.stringify({
    amount: '49.99',
    currency: 'USDC',
    return_url: 'https://yoursite.com/success',
    cancel_url: 'https://yoursite.com/cancel',
    metadata: { order_id: 'order_123' },
    expires_in: 1800,   // 30 minutes (default)
  }),
});

const { data } = await response.json();
// data.id  → "cs_live_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
// data.url → "https://checkout.fivo.finance?session=cs_live_..."
// data.expires_at → "2026-02-18T11:00:00.000Z"
// After payment, the customer is redirected to:
// https://yoursite.com/success?session_id=cs_live_...

2. Redirect the customer

Redirect
// Express.js example
app.post('/create-checkout', async (req, res) => {
  const session = await createCheckoutSession(req.body);
  res.redirect(303, session.url);
});

3. Verify payment on return

Verify Session
// When the customer lands on your return_url
app.get('/success', async (req, res) => {
  const sessionId = req.query.session_id;

  const response = await fetch(
    `https://api.fivo.finance/checkout/sessions/${sessionId}`,
    { headers: { 'X-API-Key': process.env.FIVO_API_KEY } }
  );
  const { data } = await response.json();

  if (data.status === 'complete' && data.payment) {
    // Payment confirmed: fulfill the order
    console.log('Payment ID:', data.payment.id);
    console.log('TX Hash:', data.payment.tx_hash);
    console.log('Amount:', data.payment.amount, data.currency);
  } else {
    // Payment not yet confirmed: show a waiting state
    console.log('Session status:', data.status);
  }
});

POST /checkout/sessions: Parameters

amountstring | numberOptional

Payment amount (0.01 - 1,000,000). Omit for variable amount.

currencystringOptional

"USDC" or "EURC". Defaults to "USDC".

return_urlstringRequired

URL to redirect the customer after payment. Must be HTTPS in production.

cancel_urlstringOptional

URL to redirect if the customer cancels. Must be HTTPS in production.

metadataobjectOptional

Up to 5 key-value pairs for your internal reference (e.g. order ID).

expires_innumberOptional

Session lifetime in seconds (60 - 86400). Defaults to 1800 (30 min).

Supported Currencies & Chains

CurrencyCodeChains
USD CoinUSDCAll 9 chains
Euro CoinEURCEthereum, Avalanche, Base
BlockchainTokens
EthereumUSDC, EURC
PolygonUSDC
AvalancheUSDC, EURC
ArbitrumUSDC
BaseUSDC, EURC
OptimismUSDC
LineaUSDC
UnichainUSDC
SonicUSDC

Customers can pay from any chain. If their chain differs from your wallet's chain, USDC payments are automatically bridged via Circle CCTP (typically 1-2 minutes). EURC is same-chain only and does not support cross-chain transfers.

How It Works

1

Customer clicks the button

A checkout overlay opens on top of your page. Your site stays loaded underneath.

2

Customer connects wallet

Supports MetaMask, Coinbase Wallet, WalletConnect, and other popular wallets.

3

Customer selects chain and pays

The widget scans supported chains for USDC (9 chains) or EURC (3 chains) balances and shows available options.

4

You receive the funds

Same-chain payments are instant. Cross-chain USDC payments arrive in 1-2 minutes via CCTP. EURC is same-chain only.

Customer Email & Receipts

Every payment requires the customer to enter their email address before paying. The widget handles this automatically. A required email field is shown before the wallet connection step.

For customers

After payment, the customer receives a receipt email with their Payment ID, amount, merchant name, and blockchain transaction link.

For merchants

You can see customer emails in your Transactions page and search refunds by email instead of Payment ID.

Order Tracking

Use optional attributes to link payments to your internal systems. These are passed through to webhooks and visible in your dashboard.

E-commerce Integration
<fivo-button
  merchant-id="YOUR_MERCHANT_ID"
  amount="49.99"
  currency="USDC"
  data-reference="ORD-2024-001"
  data-description="Pro Plan - Monthly"
  data-metadata='{"product_id": "plan_pro", "customer_name": "John"}'>
</fivo-button>

Order Tracking Attributes

data-referencestringOptional

Your order/invoice ID. Visible in dashboard and webhooks. Max 255 chars.

data-descriptionstringOptional

Payment description. Visible in dashboard. Max 500 chars.

data-metadatastringOptional

JSON string with any custom data. Included in webhooks. Max 10KB.

i

These are optional

Customer email is always required (handled by the widget automatically). Reference, description, and metadata are optional. Use them when you need to link payments to your order system.

Good to Know

Lightweight

~7KB script, loads async. Won't slow your site.

Isolated styles

Uses Shadow DOM. Your CSS won't break it.

Fraud protection

Fixed amounts are verified on blockchain.

9 blockchains

USDC on all 9 chains with auto-bridging via CCTP. EURC on 3 chains (same-chain only).

Need more control?

Use for server-side redirect flows, or check out the API integration guide for webhooks and programmatic payment queries.Checkout Sessions