LazorKit Logo

LazorKit

Devnet
← Back to Home
💰

Recipe 03: Subscription Service

Automated recurring payments demonstrating blockchain-native subscriptions with LazorKit

The Magic: Sign Once with Face ID, Never Again

This is what makes blockchain subscriptions incredible:

1️⃣

User subscribes with Face ID (gasless via LazorKit)

One Face ID authentication to delegate token spending permission

2️⃣

Automatic charges every billing cycle

Backend service charges the user automatically - no signatures needed!

3️⃣

Cancel anytime (also gasless)

One click to cancel, rent gets refunded automatically

🎯Just like Netflix or Spotify - but decentralized, transparent, and user-controlled!

What We're Building

An automated subscription billing system demonstrating how blockchain-native recurring payments work with LazorKit integration:

  • Subscribe with minimal friction (gasless flow via LazorKit)
  • Get charged automatically every billing cycle (no user signature needed!)
  • Cancel anytime with rent refunds
  • View subscription history and payment details

This is a working proof-of-concept showcasing a novel integration pattern with LazorKit.

The Core Innovation: Token Delegation

The key mechanism enabling automatic recurring payments is Solana's token delegation:

// During subscription, user delegates once
const delegateIx = createApproveInstruction(
  userTokenAccount,
  merchantDelegate,
  userWallet,
  amountToDelegate
);

// Now merchant can charge automatically
// without requiring signatures! 🎉

After this one-time approval with Face ID, the merchant can charge the user automatically without requiring signatures for each payment.

🚀 LazorKit Integration Benefits

1. Simplified Onboarding

User subscribes with Face ID - LazorKit handles the complexity

2. Gasless User Actions

LazorKit's paymaster covers gas fees for canceling, updating preferences, and viewing status.

3. Smart Wallet Persistence

LazorKit's smart wallets maintain consistent addresses across sessions.

4. Developer Experience

Simple hooks instead of complex wallet adapter setup.

⚠️ Current Limitations & Production Roadmap

This is a proof-of-concept demonstrating feasibility. For production deployment, several enhancements would be needed.

1. PDA Rent Costs (~0.002 SOL)

Currently required to create subscription accounts. Gets refunded on cancellation.

2. Backend Charging Fees

The automated charging service pays transaction fees. In production, these could be absorbed as business costs.

Architecture Overview

Frontend (Next.js + LazorKit)

  • Users connect via Face ID
  • Subscribe with gasless flow
  • Manage subscriptions easily

Backend Service

  • Scans for due subscriptions
  • Charges using delegated tokens
  • Handles business logic

Smart Contract (Anchor)

  • Validates delegations
  • Processes charges
  • Manages cancellations