Stripe
Connect your own Stripe account so customers can add credit and subscribe by card. Payments go straight to your Stripe account. MicroAuth listens to Stripe's webhooks and updates balances and plans for you.
Stripe lives under Pricing. Open it from the Stripe line at the top of the Pricing page, or from Connect Stripe when the dashboard asks for it.
You only need Stripe if you charge money. Free APIs, and APIs you bill some other way, can skip this page. See external credits for the second case.
Connect in two steps
1. Copy your API keys
Open Stripe API keys and paste:
| Field | Value |
|---|---|
| Secret key | Starts with sk_live_ or sk_test_. A restricted key (rk_...) works too |
| Publishable key | Optional. Starts with pk_live_ or pk_test_, in the same mode as the secret key |
Start with test keys while you try things out. In test mode, payments use Stripe's test cards and no real money moves. Switch to live keys with Replace keys when you are ready.
Keys are encrypted at rest and never shown again.
2. Add a webhook endpoint
Open Stripe webhooks and create an endpoint:
- Endpoint URL: copy it from the Stripe page in the dashboard. It looks like
https://api.microauth.com/webhooks/stripe/<your API ID>. - Events: select every event below. Copy all on the Stripe page puts the full list on your clipboard, and Show events lists them there.
- Signing secret: after you create the endpoint, reveal its signing secret (
whsec_...) and paste it into the dashboard.
| Event | Why MicroAuth needs it |
|---|---|
checkout.session.completed | Credit top-ups and new subscriptions |
checkout.session.async_payment_succeeded | Bank payments that clear later |
checkout.session.expired | Closes abandoned checkouts |
customer.subscription.created | New subscriptions |
customer.subscription.updated | Plan changes |
customer.subscription.deleted | Cancellations |
invoice.paid | Adds plan credit each billing cycle |
invoice.payment_failed | Starts the payment grace period |
refund.created | Removes refunded credit |
refund.updated | Refund status changes |
refund.failed | Gives credit back when a refund fails |
charge.dispute.created | Removes disputed credit |
charge.dispute.updated | Dispute status changes |
charge.dispute.closed | Gives credit back when you win a dispute |
Select all fourteen
Stripe only sends the events you select. Without the refund and dispute events, money you refund stays on the customer's balance as credit.
Click Connect Stripe. Your monthly plans are created in Stripe automatically.
What customers see
Once Stripe is connected, your portal's Billing page lets customers:
- Add prepaid credit through Stripe Checkout.
- Subscribe to, or switch between, your public plans and any private plans assigned to them.
- Open Stripe's billing portal to update a card or manage their subscription.
Credit appears on the balance as soon as Stripe confirms the payment, usually within seconds.
Failed payments
When a subscription payment fails, the customer gets a 7-day grace period and an email. Their plan keeps working while they update their card. If the grace period runs out, the customer is suspended for billing until a payment succeeds. Nothing is deleted. See subscription payment grace.
Replace or disconnect
- Replace keys swaps in new keys and a signing secret. To move from test mode to live mode, create the webhook endpoint again in live mode (Stripe keeps test and live endpoints apart), then paste the live keys and the new signing secret.
- Disconnect removes the keys. Customers can no longer add credit or subscribe until you connect again. Existing balances stay as they are.
Troubleshooting
| Symptom | Likely cause |
|---|---|
| A customer paid, but the balance did not change | The endpoint is missing checkout.session.completed, or the signing secret belongs to a different endpoint |
| Plan credit is not added each month | invoice.paid is not selected |
| A refund did not reduce the balance | The refund.* events are not selected |
Stripe shows failed deliveries with status 400 | The signing secret in the dashboard does not match this endpoint. Paste it again with Replace keys |