SETUP GUIDES · PAYMENTS
Connect your Stripe account
Charge your own customers (one-off or subscriptions) through your Stripe account.
With Claspine Payments, your app can sell things to its users. Claspine creates the checkout pages, listens to Stripe for you, keeps track of every subscription and tells your app what changed. The money goes straight into your Stripe account; Claspine never touches it. You set it up once in test mode (fake cards, no real money) and again in live mode when you are ready to charge for real.
Words you’ll see
- Test mode and live mode
- Payment providers keep two separate worlds: test mode, where nothing is really charged and you use test cards, and live mode, where real money moves. Each has its own keys.
- Price (in Stripe)
- What you charge for something, such as €9 per month. Each price has an ID starting with price_ that Claspine uses to start a checkout.
- Restricted key
- A Stripe API key that can only do the things you tick. Safer than the full secret key, which can do everything in your account.
- Webhook
- A message the provider sends to Claspine when something happens (for example a payment succeeds), so Claspine learns about it right away.
- Signing secret
- A secret shared between the provider and Claspine. Each webhook message is signed with it, so Claspine can prove the message really came from the provider.
Before you start
- A Stripe account at dashboard.stripe.com. You can do everything below in test mode before your account is fully activated.
Steps
- Sign in to the Stripe Dashboard and switch on Test mode (top right). Everything you create now is test-only.
- Create what you sell. Open Product catalog → Add product. Give it a name customers will see (for example “Pro plan”), choose Recurring and Monthly for a subscription (or One-off), set the price and save. Open the product and copy the price ID (starts with
price_, notprod_). - Turn on the customer portal. Open Settings → Billing → Customer portal, allow customers to update payment methods, see invoices and cancel, and click Save. Claspine’s “manage billing” links open this page.
- Create a restricted key for Claspine. Open Developers → API keys → Create restricted key, choose “Powering an integration you build”, then “Choose your own” permissions. Give Write to Customers, Checkout Sessions, Customer portal, Subscriptions and Refunds, and Read to Prices, Invoices and Payment Intents. Leave everything else at None. Copy the key (starts with
rk_test_). - Tell Stripe where to send updates. In the Claspine console open Payments and copy the Stripe webhook URL. In Stripe open Developers → Webhooks → Create an event destination: choose Your account, payload style Snapshot, and select these events:
checkout.session.completed,checkout.session.async_payment_succeeded,checkout.session.async_payment_failed,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted,customer.subscription.paused,customer.subscription.resumed,invoice.paid,invoice.payment_failed. Choose Webhook endpoint, paste the URL and create it. Then reveal and copy the Signing secret (starts withwhsec_). - In the Claspine console open Payments → Stripe connection → Stripe (test mode) → Add key, paste the restricted key and the signing secret, and save.
- Open Payments in the console. Under What you sell, add a short name your code will use (for example
pro-monthly) with the test price ID. Under Where customers return, add your app’s domain (andlocalhost:3000or similar while developing). Save. - Make a test payment from your app using an
sp_test_API key and Stripe’s test card4242 4242 4242 4242(any future date, any CVC). See “Receiving payment events” for how your app learns about it. - Going live: switch Stripe to live mode and repeat steps 2–6 (live prices have different IDs, and the live webhook has its own signing secret), storing them under Stripe (live mode). Your app then uses an
sp_live_API key. Test keys keep working against test mode, so you can keep testing safely.
What goes where in Claspine
| Console field | Value |
|---|---|
| Payments → Stripe (test/live) → SECRET OR RESTRICTED KEY | The restricted key from step 4 (rk_test_… or rk_live_…). |
| Payments → Stripe → WEBHOOK SIGNING SECRET | The signing secret from step 5 (whsec_…). |
| Payments → What you sell | Your own short name (e.g. pro-monthly) and the price ID (price_…). |
| Payments → Where customers return | Your app’s domains, e.g. app.example.com. |
Keep it safe
- Requests made with sp_test_ API keys can only use your test keys, so a test build can never charge a real card.
- Use the restricted key, not your account’s full secret key. If it leaks, it can only do what you ticked.
- Claspine checks Stripe’s signature on every webhook and re-reads the details from Stripe, so a fake message cannot unlock a paid plan.
Claspine stores the values encrypted, never shows them again in full, and never sends them to your app or SDK.
If something goes wrong
- Saving the key in the vault says it does not match the mode.
- Test keys start with rk_test_ or sk_test_; live keys with rk_live_ or sk_live_. Store each under the matching “Stripe (test/live mode)” card.
- Checkout fails with “Return URL must be https on a host allowed for this product”.
- Add your app’s domain under Payments → Where customers return. Plain http only works for localhost with test keys.
- Checkout says the price is not in the catalogue.
- The price name your code sends must match a name under Payments → What you sell, for the same mode (test or live).
- Payments succeed in Stripe but your app never hears about it.
- Check the webhook destination in Stripe shows successful deliveries, and that the signing secret in Claspine is the one from that destination.