Skip to content
Platform documentation
Recurring subscriptions
Guides

Recurring subscriptions

Collect fixed 30-day payments with explicit payer permission and durable recovery.

Create a monthly plan

Use interval=month. The service fixes ttl_seconds to 2592000: 30 days, not a variable calendar month. The provider gas authorization must cover subscription operations and have at least 31 days remaining when checkout opens.

Checkout prepares a BagSubscriptionPlan contract for the fixed token, provider recipient, price and period. Its signed deployment is journaled before broadcast. Checkout polling verifies the existing receipt, runtime and terms before changing preparing to ready; it never deploys another contract.

What the customer approves

  1. 1

    Connect the paying wallet

    Use the checkout network and configured token. AVAX for wallet transaction fees and USDC for the plan price are different balances.

  2. 2

    Approve a bounded token allowance

    The wallet helper checks allowance and requests an increase only when needed. A newly requested allowance is limited to 12 charges; it is not unlimited approval.

  3. 3

    Subscribe and pay the first period

    The payer approves the contract subscription transaction. Bagseven verifies its payment event and transfer before fulfilling the paid entitlement and recording its receipt.

Existing grants are not enrolled

Owning prepaid credits does not create a recurring payment permission. Neither provider gas approval nor an off-chain flag can subscribe a customer.

Collection and fulfillment

The durable worker selects bounded due batches, coordinates collectors with database locks, and journals signed bytes before broadcasting. It checks payer balance, allowance, cancellation and provider gas authority. Confirmed periods are fulfilled once. Renewal invoices are separate records; first-period payments reuse the checkout invoice.

StateMeaning
ACTIVEA recorded recurring permission is active; check paid-through and credits separately for feature access.
PAST_DUECollection failed and is within the bounded retry policy.
RECONCILIATION_REQUIREDA payment or fulfillment outcome is uncertain. Resolve the existing journal before another charge or mint.
CANCELLEDPayer cancellation has been verified on-chain; paid time remains.
ENDEDCollection has ended, for example after the retry window.

Insufficient balance or allowance does not authorize an overdraft. Keep provider gas permission current; expiry or revocation stops new server signing. A confirmed payment receipt and successful entitlement fulfillment are separate facts.

Cancel and synchronize

The portal asks the paying wallet to approve BagSubscriptionPlan.cancel. The backend then syncs the on-chain state. POST /v1/subscriptions/:id/cancel returns a draft; POST /v1/subscriptions/:id/sync reconciles it. The server cannot synthesize the payer signature or declare cancellation from a database flag.

Cancellation preserves already-paid access until paid_through, subject to remaining credits. It does not refund a payment already collected or unsign a pending transaction.

Use a separate customer wallet

The customer pays the provider wallet configured on the plan. SDK and confirmation reject self-payment. With multiple authorized wallet accounts, choose the intended customer account explicitly; transfer and confirmation signing keep that selection. New subscription contract artifacts reject self-payment on-chain, while existing immutable plans are preserved rather than silently redeployed.

Bagseven documentationemail and wallet · Avalanche · Registry