Skip to content

Quickstart

Accept your first cross-chain payment in 5 minutes

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
npm install @paywithglide/glide-js

2. Configure

Create a config with your project ID and the chains you want to accept payments on:

config.ts
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:

index.ts
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.ts

You'll see output like:

Pay 10 USDC
On Ethereum
To 0x93f480a6b0e6D02271D8e70d9d05Ac5cee01D379
Status: unpaid / created

Send 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:

FlowPayerRecipientGuide
Paymentsyour user/customeryouPayments
Depositsthe user (from anywhere)the user's in-app walletDeposits / Withdrawals
Withdrawalsthe user's in-app walletthe user's external addressDeposits / Withdrawals
Payoutsyour project's Glide walletyour userCustodial 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