- Home
- Skills
- APIs & Backend
- Payment Integration Skill — Stripe, Webhooks, Subs
Payment Integration Skill — Stripe, Webhooks, Subs
Secure Stripe integration for Checkout and Subscriptions with verified webhooks and dunning management.
$39
Payment Integration Skill — Stripe, Webhooks, Subs
Example session with this skill installed
I need to add a subscription checkout to my Node/Express app. Ensure it handles the webhook fulfillment for a 'pro' plan and uses a trial.
- Read your context and instructions
- Compiled the payment integration
I have generated the Stripe integration logic for your Node.js application. This setup uses
Hosted Checkout to minimize PCI scope and includes a signature-verified webhook handler for secure fulfillment.
Stripe Subscription Integration
// 1. Server-side Checkout Session Creation
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
app.post('/create-checkout-session', async (req, res) => {
const { userId } = req.body; // Use authenticated user ID
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
payment_method_collection: 'always',
line_items: [{
price: process.env.PRO_PLAN_PRICE_ID,
quantity: 1,
}],
subscription_data: {
trial_period_days: 14,
metadata: { user_id: userId }
},
success_url: `${process.env.APP_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${process.env.APP_URL}/pricing`,
client_reference_id: userId,
}, {
idempotencyKey: `sub_create_${userId}`,
});
res.redirect(303, session.url);
});
// 2. Verified Webhook Handler
app.post('/webhook', express.raw({type: 'application/json'}), async (req, res) => {
const sig = req.headers['stripe-signature'];
let event;
try {
event = stripe.webhooks.constructEvent(req.body, sig, process.env.STRIPE_WEBHOOK_SECRET);
} catch (err) {
return res.status(400).send(`Webhook Error: ${err.message}`);
}
// Handle fulfillment
if (event.type === 'checkout.session.completed') {
const session = event.data.object;
await fulfillOrder(session); // Implement exactly-once logic here
}
res.json({ received: true });
});
Next steps
- Set
PRO_PLAN_PRICE_IDandSTRIPE_WEBHOOK_SECRETin your.envfile. - Start the Stripe CLI using
stripe listen --forward-to localhost:3000/webhookto get your local signing secret. - Implement the
fulfillOrderfunction with a database check to prevent duplicate provisioning.
Connects securely to your tools. The creator never sees your data.
About this skill
Install it and your AI wires your product to a working payment channel: checkout, verified webhooks, subscriptions with trials and failed-payment recovery, and a 10-point go-live gate — then hands you back a channel that actually takes money. Built around the failure modes that cost real money: forged webhooks, duplicate fulfillment, async payments marked paid too early, prices tampered on the client. Cold-tested on three scenarios including an adversarial one — forged webhook, out-of-order events, tampered amount — all handled correctly. Includes the rails appendix Stripe will never write: merchant-of-record platforms, USDC payouts and per-call payments for sellers who can't open Stripe directly. Deep-processed from an open-source skeleton (MIT); the decision tree, debugging tables, checklist and appendix were rebuilt by Beauty Script Lab. General information, not legal or financial advice.
No support for Stripe Connect or marketplace payouts. Does not provide raw-card PCI-DSS Level 1 designs. Restricted to Web-based integration patterns.
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 buying a skill.
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 3 days ago
Permissions
What's inside
Frequently Asked Questions
New in APIs & Backend
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.