Skip to content
The Subscriptions Delegation Program enables developers to let users authorize future token transfers from their wallets with clear limits. It is designed for recurring payments, subscriptions, merchant billing, and other flows where a user should not have to sign every transfer manually.

​Purpose

Solana token accounts can approve another authority to move tokens, but each token account can only have one approved authority at a time. That makes it hard for one wallet to safely support several spending arrangements for the same token, such as a monthly subscription, a fixed spending allowance, and a merchant billing agreement. This program solves that by giving each (user, token mint) pair a program-controlled Subscription Authority. The user’s token account approves that authority once. The program then checks each requested transfer against a separate record that defines who can pull funds, how much they can pull, and when the authorization expires or resets. The Subscription Authority cannot move funds by itself. A transfer only succeeds when it matches one of the user’s active authorizations.
To put an HTTP API behind a subscription plan with a command-line gateway, see the Pay.sh guide.

​Program ID

The program ID is declared in program/src/lib.rs. Local Surfpool workflows install the program at this canonical address.

​Set Up A Local Environment

The guides in this section build on a few shared values: a user who pays, a delegatee or merchant who collects, a token mint, and funded token accounts. This setup creates them on a local network, so you can run every snippet without real funds. Create a project and install the TypeScript SDK with the @solana/kit versions it supports. "type": "module" lets the scripts use top-level await:
Install the Surfpool CLI and start a local network that forks mainnet, so the Subscriptions program and the USDC mint load from mainnet on first use. Leave it running in its own terminal:
Then create the signers and fund them. Surfpool’s surfnet_setTokenAccount RPC method writes a token account with any balance, so you don’t need a faucet or a mint authority. Save this as setup.ts:
setup.ts
Run each guide in its own file next to setup.ts, such as fixed.ts. Start the file with this import. It runs setup.ts first, so every run starts with new funded wallets:
Paste the guide’s TypeScript snippets below it in order. Move their imports to the top of the file and import each name once. Then fill in the placeholders:
In the guideUse
TOKEN_MINT_ADDRESS_HEREEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v (USDC)
address('DELEGATEE_WALLET_ADDRESS_HERE'), address('PULLER_WALLET_ADDRESS_HERE'), address('NEW_PULLER_WALLET_ADDRESS_HERE')delegateeSigner.address
address('RECEIVER_TOKEN_ACCOUNT_ADDRESS_HERE'), address('MERCHANT_TOKEN_ACCOUNT_ADDRESS_HERE')merchantTokenAccount
merchantOrPullerSignermerchantSigner
Run the file with npx tsx fixed.ts. Start with Create Subscription Authority. Close Subscription Authority closes an authority that another guide created. Add its snippets to the end of that guide’s file, drop their client, tokenMint, and subscriptionAuthorityPda declarations, which the file already has, and leave out receiver, because no sponsor funded the authority.

​Delegation Models

The program supports three authorization models:
ModelPurpose
Fixed delegationLet another wallet or service spend up to a fixed total amount, optionally until an expiry time.
Recurring delegationLet another wallet or service spend up to a limit that resets every period, such as daily, weekly, or monthly.
Subscription planLet a merchant publish billing terms that users can accept, then allow approved collectors to charge subscribers each billing period.

​Supported Tokens

Supports all mints from both SPL Token and Token-2022. For Token-2022 mints with a configured TransferHook, the program forwards the mint’s hook accounts (hook program, ExtraAccountMetaList PDA, extras) into the TransferChecked CPI on each delegated transfer, so the hook policy is enforced. The SDK resolves them for you:
  • Plugin client (transferFixed, transferRecurring, transferSubscription) — appended automatically.
  • Building manually — call resolveTransferHookAccounts, pass transferHookAccounts.

​Onchain Events

The program emits onchain events via self-CPI so indexers and applications can track activity. All events are registered in the published IDL, so generated clients can decode them. The emitted events are:
  • FixedTransferEvent, RecurringTransferEvent, and SubscriptionTransferEvent — one per delegated transfer. Each carries the credited receiverTokenAccount; SubscriptionTransferEvent also carries the puller.
  • SubscriptionCreatedEvent, SubscriptionCancelledEvent, and SubscriptionResumedEvent — subscription lifecycle. SubscriptionCreatedEvent carries the payer. Dual-signed immediate cancellations also emit SubscriptionCancelledEvent, with expiresAtTs set to the cancellation time instead of the end of the billing period.
  • PlanUpdatedEvent — emitted when a plan is updated.

​Versioning

Program-owned records include a version field. This gives the program a path to upgrade account data over time without breaking existing users. The migration strategy supports:
  • Lazy in-place update
  • Explicit migrate instruction
  • Revoke and recreate fallback

​Contributors

The project is maintained by contributors to the solana-program/subscriptions repository.

​Audit Status

The program has been audited by Cantina. Audit status, baseline commit, fix-verified commit, and current unaudited delta are tracked in the repository’s audits/ directory.

​Demo Application

If you want to play around with the program yourself, you can view an example application here to see an end-to-end implementation of the concepts covered in this section.