Quickstart
In this quickstart, you'll accept a payment with the headless SDK from a plain TypeScript script — no wallet connection or frontend required. You'll create a payment session, get a deposit address, and watch the payment settle.
1. Install the SDK
npm install @paywithglide/glide-js2. Configure
Create a config with your project ID and the chains you want to accept payments on:
import { createGlideConfig } from "@paywithglide/glide-js";
import { base, ethereum } from "@paywithglide/glide-js/chains";
export const config = createGlideConfig({
projectId: "your-project-id",
chains: [base, ethereum],
});3. Accept a payment
Create a payment session, show the deposit address, and wait for the payment to settle:
import { createPaymentSession, waitForSession } from "@paywithglide/glide-js";
import { base, ethereum } from "@paywithglide/glide-js/chains";
import { usdc } from "@paywithglide/glide-js/currencies";
import { config } from "./config";
// Create a session: the payer sends USDC on Ethereum,
// and you receive USDC on Base
const session = await createPaymentSession(config, {
paymentCurrency: usdc.on(ethereum),
settleCurrency: usdc.on(base),
recipientWallet: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", // your wallet
paymentAmount: "10",
});
console.log("Pay", session.paymentAmount, session.paymentCurrencySymbol);
console.log("On", session.paymentChainName);
console.log("To", session.depositAddress);
// Poll until the payment arrives and settlement completes
const completed = await waitForSession(config, {
sessionId: session.sessionId,
onUpdate: (s) => console.log("Status:", s.paymentStatus, "/", s.sponsoredTransactionStatus),
});
console.log("Settled!", completed.sponsoredTransactionUrl);4. Run it
npx tsx index.tsYou'll see output like:
Pay 10 USDC
On Ethereum
To 0x93f480a6b0e6D02271D8e70d9d05Ac5cee01D379
Status: unpaid / createdSend the payment to the deposit address (from any wallet or exchange), and the script keeps polling until settlement:
Status: waiting_confirmations / created
Status: paid / pending
Status: paid / success
Settled! https://basescan.org/tx/0x36145cfe...That's it — you've accepted a cross-chain payment. The payer sent USDC on Ethereum, and you received USDC on Base.
Which flow do I need?
Every Glide flow uses the same session primitive — pick the guide that matches who pays and who receives:
| Flow | Payer | Recipient | Guide |
|---|---|---|---|
| Payments | your user/customer | you | Payments |
| Deposits | the user (from anywhere) | the user's in-app wallet | Deposits / Withdrawals |
| Withdrawals | the user's in-app wallet | the user's external address | Deposits / Withdrawals |
| Payouts | your project's Glide wallet | your user | Custodial Withdrawals |
Next steps
- Sessions — understand the session lifecycle and statuses
- Webhooks — track payments server-side in production
- Testing — develop without moving real funds
- Error handling — handle every failure mode