Defined in the Base Account SDK
Base Subscriptions enable recurring USDC payments. Users grant your application permission to charge their account periodically, eliminating the need for manual approvals on each payment. No fees for merchants or users.

How Subscriptions Work

1

User Creates Subscription

User approves a spend permission for your application to charge a specific amount periodically.
2

Application Charges Periodically

Your backend charges the subscription when payment is due, up to the permitted amount per period.
3

Automatic Period Reset

The spending limit resets automatically at the start of each new period.
4

User Can Cancel Anytime

Users maintain full control and can revoke the permission at any time.

Core Functions

Type Definitions

// Subscription creation options
interface SubscriptionOptions {
  recurringCharge: string;
  subscriptionOwner: string;
  periodInDays?: number;
  testnet?: boolean;
  telemetry?: boolean;
}

// Subscription result
interface SubscriptionResult {
  id: string;
  subscriptionOwner: Address;
  subscriptionPayer: Address;
  recurringCharge: string;
  periodInDays: number;
}

// Subscription status
interface SubscriptionStatus {
  isSubscribed: boolean;
  recurringCharge: string;
  remainingChargeInPeriod?: string;
  currentPeriodStart?: Date;
  nextPeriodStart?: Date;
  periodInDays?: number;
}

// Charge preparation
interface PrepareChargeOptions {
  id: string;
  amount: string | 'max-remaining-charge';
  testnet?: boolean;
}

type PrepareChargeResult = Array<{
  to: Address;
  data: Hex;
  value: '0x0';
}>;

Next Steps