Integration Patterns
Recommended backend patterns for @gwop/sdk
These patterns show the smallest production-minded backend shape for a Gwop integration:
- one shared SDK client
- thin app-owned adapters around Gwop
- local JWT verification with cached JWKS
- webhook-driven state transitions
- app-owned routes, persistence, and entitlements
Architecture
Your backend owns the API surface and business rules. Gwop owns identity, invoices, sessions, JWKS, and webhook signatures.
Design rules
- Bootstrap the SDK once and share it.
- Keep auth, invoice, and webhook code in app-owned adapters so upstream details stay isolated.
- Verify JWTs locally, then use
sidfor a live session check when revocation matters. - Store both merchant and public invoice IDs.
- Trust webhook state transitions only after verifying the raw request body.
These patterns are demonstrated end-to-end in the Agentrouter sample app, a headless LLM store built on @gwop/sdk.
Next pages
Shared SDK Client
Bootstrap one client and keep identity request options explicit
Wallet Auth
Create challenges, exchange them for JWTs, and manage sessions
JWT Verification
Verify access tokens locally and refresh JWKS on key rotation
Subscription Checkout
Create invoices and carry both IDs through your app model
Webhook Verification
Validate signed deliveries before mutating local state