Advanced / Custom Web3
Low-level @recur/sdk builders for full control over transactions and signing.
Advanced / Custom Web3
Most apps should use Integration instead. This section is for builders who want to construct, inspect, or modify on-chain transactions directly — for example to bundle Recur with other instructions in the same transaction, ship a custom wallet flow, or run server-side keepers.
The @recur/sdk package exposes raw builders for every on-chain operation, plus REST wrappers and webhook primitives.
When to use this layer
- You compose Recur with other Solana instructions in a single transaction
- You sign with a non-standard wallet (HSM, MPC, custodian)
- You build merchant tooling that bypasses the React/JWT flow
- You're writing tests or scripts against the protocol
For everything else — drop-in components, hooks, server-side helpers, and webhook verification — start at /docs/integration.
Subscriber operations
- Quickstart — install and configure
RecurClient - Subscribe —
buildSubscribeTransaction,buildReapproveTransaction - Cancel —
buildCancelTransaction,buildFinalizeCancelTransaction,buildSubscriberCancelTransaction - Subscriptions —
getMySubscriptions,getSubscription,registerSubscription,getSubscriptionAccount,deriveSubscriptionPda
Merchant operations
API-key-authenticated REST wrappers:
- Plans —
createPlan,listPlans,getPlan,getPlans - Subscriptions —
listSubscriptions,getPaymentHistory
Webhooks (low-level)
- Webhooks —
verifyWebhookSignature,parseWebhookPayload
For framework-aware middleware (Express, Next.js, Node) prefer @recur/server, which delegates to the same primitives.
High-level helpers (also on RecurClient)
The same orchestration the React hooks use is available directly on the client. See Server-side helpers for details.
| Method | Equivalent low-level calls |
|---|---|
client.authenticate(wallet) | POST /auth/nonce → wallet.signMessage → POST /auth/verify |
client.subscribe(wallet, options, token) | buildSubscribeTransaction → sign+send → registerSubscription |
client.cancel(wallet, options) | buildCancelTransaction or buildSubscriberCancelTransaction → sign+send |
client.reapprove(wallet, options) | buildReapproveTransaction → sign+send |
Re-exports
The SDK re-exports useful helpers and types so you don't need to depend on @recur/solana-client or @recur/types directly:
| Re-export | Source | Description |
|---|---|---|
PROGRAM_ID | @recur/solana-client | Default devnet program ID |
USDC_MINT_DEVNET | @recur/solana-client | Devnet mock USDC mint |
findSubscriptionPda | @recur/solana-client | PDA derivation |
findTreasuryVaultPda | @recur/solana-client | Treasury PDA derivation |
planSeedToBuffer | @recur/solana-client | Hex → 8-byte Buffer |
planSeedToArray | @recur/solana-client | Hex → number[] for Anchor |
EventType | @recur/types | Webhook event union |
SubscriptionStatus | @recur/types | active | past_due | cancelled | expired |
WebhookPayload | @recur/types | Webhook payload shape |
RecurError (and subclasses) | — | Typed error hierarchy |
getClusterDefaults | — | cluster → { rpcUrl, programId, usdcMint } |
signAndSend | — | Wallet → tx → send → confirm pipeline |
unwrap | — | Throw on { success: false } envelopes |