How to paywall a feature in your SaaS

Short answer

To paywall a feature in your SaaS, ask Ruba for the customer’s state, which lists their active subscriptions, benefits and meter balances, and open the feature only if the right one is there. Ruba tells your app who has paid. Your app decides what to lock. Ruba pays you to your own bank.

Free and paid in one app

Ruba’s customer state tells your app what a buyer has paid for, and webhooks tell it when that changes. Mehwish in Faisalabad runs a note-taking app. Everyone can write notes. Only paying users can export to PDF. That one export button is a paywalled feature.

The idea is simple: before the button works, the app checks whether this user has paid. The question is how to ask.

Three ways to ask

Ruba has a customer state, benefits such as license keys, and webhooks. Tap each way.

Customer stateEasiest
You askOne API call, by your user ID
You getSubscriptions, benefits, meters
Stays current viacustomer.state_changed webhook
Best forAccounts with sign-in

Great for Most web apps. One object tells you everything.

Watch for Cache it, and refresh it from the webhook.

Figure 1From Ruba’s docs. You can combine them.

What happens when the state changes

A user upgrades
  1. PayUser subscribesOn Ruba’s checkout.
  2. EventState changescustomer.state_changed fires.
  3. Your appUpdates its cacheThe user is now paid.
  4. UseExport opensThe button works.
Figure 2Based on Ruba’s customer state docs.

The webhook fires when a customer is created, modified or removed, and when their subscriptions or benefits change.

For subscriptions, Ruba offers 7, 14 or 30-day trials that save the card without charging it, retries a declined renewal over about 21 days, and gives customers a hosted portal to see invoices, replace a card and cancel.

Who decides what

Ruba tells you
Is there an active subscription?
Which benefits are granted?
What is the meter balance?
Your app decides
Which feature needs which plan
Whether to keep access during a retry
What a free user sees instead
Figure 3Ruba gives you the facts. Your app makes the rules.

When a renewal fails, Ruba retries over about three weeks and then revokes the subscription. You can set Keep access after a failed payment to keep benefits during that time. Decide what is kinder to your users.

What to do next

Build in the sandbox, then go live. Apply for Ruba early access. Ruba charges 4% + $0.50 per payment, plus 0.5% on subscriptions, and has no monthly fee. Read how to set up the routes in the Next.js subscriptions guide.

Check the customer’s state, then open the door. A company is not required, and no monthly fee applies. If you are approved during early access, your 4% + $0.50 is locked for your paid feature for as long as your account stays open and in good standing. Surprise fees are covered: Ruba refunds one it never told you about and pays you $100. Terms apply. See the early-access deal.

Questions people ask

How does my app know who has paid?

Read the customer state. One API call, or one customer.state_changed webhook event, returns the customer’s active subscriptions, awarded benefits and meter balances. Using your own external ID, you can connect it quickly.

Should I check on every request?

Cache the result and refresh it when the webhook tells you the state changed. That keeps requests fast, and your app current.

What if a renewal fails?

The subscription moves to past due and Ruba retries over about 21 days. You can set Keep access after a failed payment so benefits stay available while it is past due.

Can I lock one feature, not the whole app?

Yes. Attach a benefit to the paid plan, such as a license key or a custom benefit. Check for it in your app before opening that feature.

Does Ruba enforce the paywall for me?

No. Ruba tells your app the state. Your app decides what to lock. That keeps the control with you.

Sources

We check these when we update this guide. Rules can change, so check them yourself before you decide.

A note from FaizanHi, I’m Faizan, the founder of Ruba. I built it so people anywhere, from Pakistan, India and Bangladesh to the UK, the EU and the US, can sell software to the world and get paid at home.I wrote these guides to be as fair as I can. But I built Ruba, so I’m about as neutral as a parent at a school play. That’s why every fact has a source you can check.
Early access is live.

Sellers approved now keep 4% + $0.50 per sale locked for as long as they sell, plus +$100 if we ever charge a fee we never told you about. No company and no monthly fee. You are paid to a bank in your own name, in PKR, INR, BDT or 51 other currencies, whenever you ask, from $10. A payout costs $2 up to $200.

Applying is not approval. Terms apply.
All guides

Can’t find your country or currency? Email support@getruba.com.

This guide is general information, not legal, tax or financial advice. Other companies named here set their own rules, which can change. Check their websites before you decide.