Overview
SaaS platforms need flexible payment solutions to handle:- Monthly and annual subscription billing
- One-time purchases (add-ons, credits)
- Plan upgrades and downgrades
- Trial period management
- Payment failure handling
Yabetoo currently supports one-time payments. For recurring billing, you’ll need to implement a cron job or scheduler that creates payment intents at regular intervals.
Architecture
Implementation
1. Define Your Pricing Plans
First, define your subscription tiers:2. Create Subscription Payment
When a user subscribes, create a payment intent:3. Handle Payment Confirmation
After the user provides payment details:4. Webhook Handler for Subscription Activation
Set up a webhook to activate subscriptions when payment succeeds:5. Implement Recurring Billing
Set up a scheduled job to handle recurring payments:6. Handle Plan Upgrades
Allow users to upgrade their plan:Complete Subscription Flow
1
User Selects Plan
User chooses a subscription plan and billing cycle on your pricing page.
2
Create Payment Intent
Your backend creates a payment intent with subscription metadata.
3
Collect Payment Details
User enters their mobile money number and confirms payment.
4
Payment Processing
Yabetoo processes the payment via MTN or Airtel Money.
5
Webhook Notification
Yabetoo sends a webhook when payment succeeds or fails.
6
Activate Subscription
Your webhook handler activates the subscription and grants access.
7
Recurring Billing
A scheduled job creates renewal payments before each billing period ends.
Best Practices
Grace Period
Grace Period
Implement a grace period (e.g., 3-7 days) for failed renewal payments before suspending access.
Payment Reminders
Payment Reminders
Send reminders 7 days, 3 days, and 1 day before subscription renewal.
Failed Payment Handling
Failed Payment Handling
Retry failed payments automatically (e.g., 3 attempts over 7 days) before canceling.
Proration
Proration
Calculate prorated amounts fairly when users upgrade or downgrade mid-cycle.
Example Database Schema
Related Resources
Payment Intents
Learn about creating and confirming payments
Webhooks
Set up webhooks for payment notifications