In this quickstart, you will wire the core Gwop backend flow:
invoice.paid webhookYou should be able to go from install to working code in under 5 minutes.
When your backend calls invoices.create(), Gwop returns a headless x402 checkout session built for agents.
That session includes x402 payment URLs for every supported chain. The agent fetches the public invoice, discovers the available payment methods, picks a chain, and pays the session-scoped x402 URL — exactly the same way it would pay any other x402 endpoint on the internet.
The payment URL is tied to the checkout session, not to your backend. The agent pays Gwop x402 generated URL directly, Gwop settles the session, and your backend receives a signed webhook confirming the sale.
Your backend keeps full control of the API surface and business rules. Gwop handles multi-chain settlement, webhook confirmation, and the x402 payment contract — the infrastructure you would otherwise build and maintain yourself. The agent gets a machine-readable checkout with concrete payment options and pays using a standard x402 URL, no special integration required.
If you want the production-minded architecture behind this flow, continue into Integration Patterns.
ESM only. For CommonJS projects, use await import("@gwop/sdk").
Create a file called quickstart.ts, then add the code below in order.
One shared client is enough for invoices and webhook validation. Identity-specific calls stay explicit through identityRequestOptions.
The agent is now a customer. verified.subject is the permanent account identity — every purchase, credit balance, and entitlement you create from here is scoped to this wallet. First auth from a wallet creates the account; repeat auth returns the existing one.
The publicInvoiceId is what the agent uses to fetch the checkout and discover available x402 payment methods. The agentProtocol payload tells the agent exactly what to do next: fetch the invoice, pick a chain, pay the x402 URL. Your backend keeps id for internal references and cancellation.
When the agent fetches the public invoice, it sees the full checkout session — including one x402 payment method per supported chain:
Each paymentUrl is scoped to the checkout session. The agent picks a chain and pays the URL the same way it would pay any x402 endpoint. Gwop verifies the transaction on-chain and settles the session.
That is the full merchant-side loop: create a checkout, let the agent pay over x402, and settle via webhook. The next layer is architecture — where these pieces live in your routes, services, and adapters.
See how to turn this flow into a production-minded backend architecture
Learn why Gwop invoices have both merchant and payer-facing identifiers
Learn when local JWT verification is enough and when to check the session
Learn why {chain}:{address} is the durable customer identity