Web purchases run through Stripe rather than an app store. When a customer
signs in with the same app_user_id on web and mobile, entitlements bought in
a Stripe checkout unify with those bought on iOS and Android automatically. See
Entitlements.
Stripe
Connect Stripe Billing so web subscriptions live in the same entitlement model and revenue ledger as your App Store and Google Play sales.
Stripe powers card, wallet, and bank payments for the web side of your business. Connect Stripe Billing to CashSDK and a checkout on the web resolves to the same entitlement your mobile SDK already respects: one customer, one set of access, one revenue number to reconcile.
How it works#
Add a restricted Stripe API key in your dashboard. CashSDK reads your prices, subscriptions, and tax settings. It never stores card data.
Each Stripe Price maps to a CashSDK product and the entitlement it
unlocks, so a subscription resolves to pro (or whatever you name it)
everywhere.
Every Stripe event (payments, renewals, cancellations, refunds) is verified against its signature, retried, and merged into your unified revenue timeline.
Prerequisites#
- A Stripe account with Stripe Billing enabled.
- Products and recurring Prices created in Stripe (or create them as you map the catalog).
- Access to your Stripe API keys and Webhooks settings.
Connect Stripe#
In the Stripe dashboard, go to Developers → API keys → Create restricted
key and grant read access to Products, Prices, Customers,
Subscriptions, and Checkout Sessions (plus write on Checkout Sessions
if you use CashSDK-hosted checkout). Copy the rk_live_… key.
In your dashboard, open Settings → Billing → Stripe and paste the
restricted key. It is stored encrypted at rest. Use a test-mode key
(rk_test_…) while you build.
Copy the webhook URL from Settings → Billing → Stripe and add it in
Stripe under Developers → Webhooks. Subscribe to
checkout.session.completed, customer.subscription.*, invoice.paid, and
charge.refunded. Paste Stripe's signing secret (whsec_…) back into the
dashboard so CashSDK can verify every event.
Use a restricted key, not your secret key, and keep it server-side.
CashSDK holds it, your app never does. In the browser your app only ever uses a
CashSDK publishable key (csk_pk_…).
Map prices to entitlements#
For each Stripe Price, create a matching product in CashSDK and attach the entitlement it unlocks. Trials, coupons, and proration are read straight from Stripe, so you manage pricing in one place.
Sell on the web#
Use the Web SDK to present the offering and open Stripe checkout. On return, CashSDK confirms the payment and resolves the customer's entitlements.
The Web SDK is on the roadmap and cashsdk-web is not published yet. The
snippet below shows the intended API. Stripe webhook ingestion works today
and is what the rest of this page describes.
import { CashSDK } from "cashsdk-web";
CashSDK.configure({ publishableKey: "csk_pk_…" });
const offering = await CashSDK.offerings();
const result = await CashSDK.purchase(offering.monthly);
if (result.entitlements.pro?.isActive) {
unlockPro();
}
Let subscribers manage plans and payment methods through Stripe's hosted customer portal. Changes flow back through webhooks and are reflected in CashSDK instantly.
Test and go live#
With a rk_test_… key and the SDK on csk_pk_…, complete a checkout using a
Stripe test card (for example
4242 4242 4242 4242). Confirm it grants the entitlement and appears under
Events.
Turn on Stripe Tax to collect and record tax; CashSDK stores revenue both net and gross so your ledger reconciles.
Swap in your rk_live_… restricted key and the live webhook signing secret.
The CashSDK key does not change. It already serves both environments.