Guides
Hosted checkout
The easiest integration: create a payment on your server and send the customer to its checkout_url. Our hosted page shows your business name and the amount, and lets the customer pay.
The checkout link
A payment's checkout_url looks like https://…/pay/pi_…#client_secret=…. The part after # is the payment's client secret. It stays in the URL fragment, so browsers never send it to any server, and the page removes it from the address bar after loading. Treat the whole link as private to that customer.
// Express example: create a payment on your server, then send the customer to checkout.
app.post("/checkout", async (req, res) => {
const order = await loadOrder(req.body.orderId); // your own order lookup
const r = await fetch("https://YOUR-API/v1/payment_intents", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CLEARGATEWAY_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": `order-${order.id}`,
},
body: JSON.stringify({
amount: toUnits(order.total), // e.g. "25500000"
merchant_order_id: order.id,
success_url: `https://shop.example.com/orders/${order.id}/thanks`,
cancel_url: "https://shop.example.com/cart",
}),
});
const payment = await r.json();
res.redirect(303, payment.checkout_url);
});How the customer can pay
- Wallet. Connect a browser wallet on Base Sepolia holding USDC. The customer approves USDC, then confirms the payment: two wallet confirmations. Funds go straight to the contract, which splits them between you and ClearGateway.
- Exchange or transfer. The page shows a unique deposit address for this payment. The customer sends the full amount of USDC on Base to it from any wallet or exchange. We detect it, confirm it and move it to the contract automatically. Sending anything else, or using a different network, can lose funds permanently; the page warns about this.
- Card. Buy USDC with a card into the customer's own wallet, then pay with the wallet. Not live yet: this depends on an on-ramp partner that is still being connected.
After payment
Checkout shows the live status and, once succeeded, a “Return to…” button that goes to your success_url. If a payment expires, fails or is canceled it offers your cancel_url.
Do not trust the redirect
A customer can open yoursuccess_url without paying. Always confirm with the payment_intent.succeeded webhook or by fetching the payment with your API key before you fulfil.Building your own checkout
You can build a custom page against the /v1/checkout/{id}/… endpoints (wallet payload, deposit address, status stream). They authenticate with the payment's client secret in the x-client-secret header rather than your API key. See the API reference.