Payments
Glide lets you accept payments from users in any supported token on any supported chain, while you settle in the currency and chain of your choice. The user pays in whatever they hold, and Glide handles the routing, conversion, and settlement.
The payment flow has three steps:
- Create a payment session — get a firm quote with exchange rates and fees.
- Let the user pay — complete the payment action returned by the session.
- Track completion — wait for the session in your app, or receive webhooks on your server.
1. Create a payment session
Create a session with the currency the user will pay in, the currency you want to receive, and the wallet that should receive the funds.
import { createPaymentSession } from "@paywithglide/glide-js";
import { base, polygon } from "@paywithglide/glide-js/chains";
import { usdc } from "@paywithglide/glide-js/currencies";
import { config } from "./config";
const session = await createPaymentSession(config, {
paymentCurrency: usdc.on(base),
settleCurrency: usdc.on(polygon),
recipientWallet: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
paymentAmount: "100",
// Optional: attach your own identifiers to the session
metadata: JSON.stringify({ orderId: "order-12345" }),
});The session is valid for a limited time, during which the user should complete the payment. If a payment is made for an expired session, the payment is refunded.
See the create payment session reference for all parameters, including commissions, refund emails, and stable deposit addresses.
2. Let the user pay
The session's paymentAction field tells you what the user needs to do:
transfer— the user sends the payment tosession.depositAddress. Show the address, thepaymentAmount, and thepaymentCurrencyto the user. This is the most common flow for headless, server-driven payments.signAndSendTransaction— the user signs and sendssession.unsignedTransactionfrom their connected wallet.signTypedData— the user signssession.unsignedTypedDatafor a gasless payment.redirectToUrl— redirect the user tosession.redirectUrlto complete the payment through an external service.
If the user pays from a connected wallet in your app, use executeEVMSession — it switches chains, triggers the transaction or signature, reports the payment to Glide, and waits for the session to complete in a single call.
3. Track completion
Wait for the session
Use waitForSession to poll the session until the settlement transaction succeeds:
import { waitForSession } from "@paywithglide/glide-js";
const completedSession = await waitForSession(config, {
sessionId: session.sessionId,
onUpdate: (session) => {
console.log("Payment status:", session.paymentStatus);
console.log("Settlement status:", session.sponsoredTransactionStatus);
},
});
console.log("Settled:", completedSession.sponsoredTransactionHash);You can also fetch the session on demand with getSessionById — for example, when the user returns to your app after paying.
Webhooks
For production, track payments server-side with webhooks — Glide sends a SESSION_UPDATE event with the full session object every time the session changes, so your backend can fulfill the order even if the user closes the tab. Use the metadata field to correlate the session with your own records.
See the Webhooks guide for setup, signature verification, and reliability best practices.