- Home
- Skills
- APIs & Backend
- Stripe Integration: Payments and Subscriptions
More screenshots
Works with the AI Agents you already use
Stripe Integration: Payments and Subscriptions
Integrate Stripe so it survives production: hosted-checkout-first flow selection, webhook-driven state, idempotent handlers, an explicit subscription lifecycle, SCA, and a test matrix.
$5
Stripe Integration: Payments and Subscriptions
Example session with this skill installed
We're adding subscriptions to our SaaS — monthly and annual plans, a 14-day trial, and we want checkout to look native in our app. What should we build, and in what order?
- Read your context and instructions
- Compiled the stripe integration
INTEGRATION PLAN — produced by applying the skill.
Flow decision: you asked for native-looking checkout, which points at embedded elements — your page, Stripe's card inputs. Recorded trade: you own the surrounding logic, which is exactly the work below. (If native look turns out to be negotiable, hosted checkout deletes most of it; "we might want flexibility later" would not justify raw Payment Intents.)
Build order, state model first:
- Webhook endpoint before any checkout UI. Signature verification against the raw body — route it around your framework's JSON parser, which is the classic reason verification fails in production. Handlers idempotent on event ID behind a unique constraint; unknown event types logged, never dropped.
- Subscription state machine in your database: trialing, active, past_due, canceled, with transitions driven only by webhook events. Every access check reads this state. No isPro boolean — it goes stale at the first failed renewal.
- Boundary decisions, encoded now: trial ends with no card → downgrade to free tier at trial end, no grace (your call, but make it now); first renewal charge fails → past_due, dunning emails, access continues through Stripe's retry window, cancels when retries exhaust.
- Embedded checkout on top, creating the subscription in trialing. The success page is a courtesy screen only — it confirms nothing; the webhook does.
- SCA path: expect authentication-required as a pause-and-resume, tested explicitly, or your European signups fail silently.
- Nightly reconciliation job diffing your subscription table against Stripe's, alerting on drift.
Test matrix before launch (scripted, not clicked): happy path, hard decline (no order created), authentication-required completes, insufficient funds → past_due → retry succeeds, same webhook fired twice changes nothing, subscription.updated arriving before its invoice.paid leaves consistent state, full lifecycle trial → active → past_due → canceled.
Connects securely to your tools. The creator never sees your data.
About this skill
Most Stripe integrations work in the demo and break in production — and the breakage is never the API. It's the state model around it: duplicate webhooks, payments that succeeded at Stripe but never recorded locally, subscriptions that drift from the dashboard until a customer complains. This skill builds the integration around those failure modes from the start. It opens with a flow-selection decision table keyed to who owns the UI — hosted checkout by default (smallest PCI and maintenance burden), embedded elements when design demands it, raw Payment Intents only for genuinely custom money movement — with a decision point that calls out "flexibility we might need later" as a non-reason. Then the core discipline: webhooks are the source of truth, not the redirect. The handler protocol covers signature verification against the raw body (and the framework body-parsing trap that breaks it), idempotency keyed on event IDs behind a uniqueness constraint, loose ordering with tolerance for out-of-order events, logging unknown event types instead of dropping them, and a nightly reconciliation job that diffs local subscription state against Stripe's — because webhooks give eventual correctness and reconciliation makes it guaranteed. Subscriptions get modeled as a state machine (trialing, active, past_due, canceled) instead of a cached isPro boolean, with a boundary-decisions table forcing the product calls — trial ends with no card, downgrade mid-cycle, retries exhausted — to be encoded before launch rather than during an incident. SCA is handled as a resumable flow, not an error. The deliverables are concrete: a worked webhook handler in pseudocode with an incident walkthrough showing the pieces interlocking, a scripted eight-case test matrix (including duplicate delivery and out-of-order events), an edge-cases section, anti-patterns, and a launch checklist as the quality gate.
- It covers the card-payments and subscriptions core. Marketplace payouts (Connect), metered usage at high volume, and tax filing each add their own models on top of this foundation.
- Boundary decisions (grace periods, proration, revocation timing) are product and policy calls — the skill forces them to be made explicitly but cannot make them for you.
- Stripe's API and event set evolve; the protocol (verify, idempotency, reconcile) is stable, but event names should be confirmed against the current docs for your API version.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 24 days ago
Permissions
No special permissions declared or detected