PPPHP

Subscriptions — recurring billing

The Subscription component adds a pricing table of recurring plans to any page. Define your plans (price, billing period, optional free trial); visitors pick one and subscribe, and the gateway bills them on schedule. The plans are stored and seeded for you, every subscriber is tracked in a pp_subscriptions table, and renewals and cancellations are handled automatically via webhooks plus a self-service manage page. It builds on the Payment gateways, so it reuses the same keys.

Two steps to go live. (1) Enter your gateway keys once in Payments (project sidebar). (2) Drop a Subscription component onto a page, add your plans, and rebuild. The Test gateway needs no keys and simulates the whole recurring flow.

Contents

How it works

  1. The visitor picks a plan and clicks Subscribe. The button sends only the component id + plan code — never the price — so the amount can't be changed from the browser.
  2. Your server creates the subscription with the gateway and sends the visitor to its hosted page to authorise it.
  3. On return the server confirms the subscription is active and records it. The subscriber sees a receipt with a manage / cancel link (also emailed).
  4. Each renewal, payment failure, or cancellation reaches your app as a webhook and updates the subscription's status and next-billing date automatically.

Defining plans

Add one or more plans in the inspector. Each plan has a code (a stable id like pro), a name, an amount, a billing period (day/week/month/year) with an every-N multiplier, an optional free trial in days, a Popular highlight, and a features list (one per line). Plans are seeded into pp_subscription_plans the first time the page renders, so you always have a plans table to build reports on.

Which gateways

GatewayRecurring?
TestSimulated recurring — no keys, no real money. Full subscribe → active → cancel flow for building + demos.
ManualRecords an offline recurring pledge you manage by hand.
StripeYes — Stripe Checkout in subscription mode (test with an sk_test_ key).
PayPalYes — PayPal Subscriptions (product + plan). Set mode to sandbox to test.
RazorpayYes — Razorpay Subscriptions (INR). Test with an rzp_test_ key.
Khalti, eSewa and Fonepay don't support recurring billing, so they aren't offered for subscriptions — use them with the one-time Payment component instead. Razorpay subscriptions require INR.

Tables & records

Two tables are created automatically (MySQL, MariaDB, PostgreSQL, SQLite, SQL Server):

Build a List page on either table to manage plans and subscribers.

Renewals, cancellation & webhooks

Renewals are asynchronous — webhooks are required for the live gateways so status stays in sync (Stripe & Razorpay webhooks are signature-verified; PayPal is verified via its verify-signature API using the Webhook ID you set in Payments). The Test gateway needs no webhook.

Every property

PropertyWhat it does
Title / SubtitleThe pricing-table heading.
GatewayWhich gateway bills the subscriptions (keys from Settings → Payments).
Default currencyUsed for plans that don't set their own (Razorpay requires INR).
Ask for emailCollect the subscriber's email up front so confirmations + the manage link work.
PlansCode, name, amount, currency, billing period + every-N, free-trial days, “Popular” highlight, features.
Button label / AlignThe Subscribe button text and the widget alignment.