payment-gateway-integration · secondsky — Claude Code skill: take payments
A skill for wiring Stripe, PayPal or Square into your app: payment intents, subscriptions, webhooks and refunds. Useful when you build checkout or billing.
npx skills add secondsky/claude-skills --skill payment-gateway-integration -a claude-codeWhat payment-gateway-integration does
The skill hands your agent ready-made patterns for payment providers. It ships a Node.js PaymentService class for Stripe: creating a payment intent with the amount converted to cents, starting a subscription from a priceId, and refunding a payment_intent. A separate section covers webhooks — the signature goes through stripe.webhooks.constructEvent, and events like payment_intent.succeeded and invoice.payment_failed branch into their own handlers.
PayPal lives in references/paypal-integration.md: order creation and capture, refunds, webhooks, frontend SDK wiring, success and cancel callbacks. There is also a security checklist — official SDK only, verified webhook signatures, HTTPS on every payment route, idempotency keys, retry logic.
Stripe keys come from environment variables, STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET. Hardcode them and webhook signature verification stops meaning anything, so move the secrets out before the first run. Test keys in production break things just as fast.
What it helps with
- create a payment intent and convert the amount to cents
- start a subscription with an incomplete first payment
- verify an incoming Stripe webhook signature
- refund a payment intent in full or in part
- route succeeded and failed payment events to separate handlers
Example prompts for the agent
- Add Stripe checkout to this project: payment intent, subscription and refund
- Set up the
/webhooks/striperoute with signature verification and apayment_intent.succeededhandler - Walk me through the PayPal setup in
references/paypal-integration.md
How to install payment-gateway-integration
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill payment-gateway-integration -a claude-code2Manually: put the files in place
~/.claude/skills/payment-gateway-integration/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/payment-gateway-integration/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill payment-gateway-integration -a codex2Manually: put the files in place
.agents/skills/payment-gateway-integration/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill payment-gateway-integration -a cursor2Manually: put the files in place
.cursor/skills/payment-gateway-integration/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install secondsky/claude-skills payment-gateway-integration2Manually: put the files in place
.github/skills/payment-gateway-integration/SKILL.md1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill payment-gateway-integration -a gemini-cli2Platform CLI
gemini skills install https://github.com/secondsky/claude-skills --path plugins/payment-gateway-integration/skills/payment-gateway-integrationManually: put the files in place
.devin/skills/payment-gateway-integration/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill payment-gateway-integration -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about payment-gateway-integration
How do I install payment-gateway-integration in Claude?
Run npx skills add secondsky/claude-skills --skill payment-gateway-integration -a claude-code. The skill lands in ~/.claude/skills/payment-gateway-integration/SKILL.md.
What does payment-gateway-integration do?
It integrates payment processing through Stripe, PayPal or Square: checkout flows, recurring billing, webhooks, refunds and disputes. It also covers PCI compliance and safe handling of card data.
Which keys does it need?
The Stripe code reads STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET from the environment. Without the webhook secret, signature verification fails.
Source text
SKILL.md · MIT
---
name: payment-gateway-integration
description: Integrates payment processing with Stripe, PayPal, or Square including subscriptions, webhooks, and PCI compliance. Use when implementing checkout flows, recurring billing, or handling refunds and disputes.
license: MIT
---
# Payment Gateway Integration
Integrate secure payment processing with proper error handling and compliance.
## Stripe Integration (Node.js)
```javascript
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
class PaymentService {
async createPaymentIntent(amount, currency, customerId) {
return stripe.paymentIntents.create({
amount: Math.round(amount * 100), // Convert to cents
currency,
customer: customerId,
automatic_payment_methods: { enabled: true }
});
}
async createSubscription(customerId, priceId) {
return stripe.subscriptions.create({
customer: customerId,
items: [{ price: priceId }],
payment_behavior: 'default_incomplete',
expand: ['latest_invoice.payment_intent']
});
}
async refund(paymentIntentId, amount = null) {
const params = { payment_intent: paymentIntentId };
if (amount) params.amount = Math.round(amount * 100);
return stripe.refunds.create(params);
}
}
```
## Webhook Handling
```javascript
app.post('/webhooks/stripe', express.raw({ type: 'application/json' }), (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}`);
}
switch (event.type) {
case 'payment_intent.succeeded':
await handlePaymentSuccess(event.data.object);
break;
case 'invoice.payment_failed':
await handlePaymentFailed(event.data.object);
break;
}
res.json({ received: true });
});
```
## PayPal Integration
See [references/paypal-integration.md](references/paypal-integration.md) for complete PayPal implementation with:
- Order creation and capture
- Refund processing
- Webhook handling
- Frontend SDK integration
- Success/cancel callbacks
## Security Checklist
- [ ] Use official SDK only
- [ ] Verify webhook signatures
- [ ] Never log full card numbers
- [ ] Store minimal payment data
- [ ] Test in sandbox first
- [ ] HTTPS for all payment routes
- [ ] Handle all error cases
- [ ] Use idempotency keys
- [ ] Implement retry logic
## Best Practices
**Do:**
- Use official SDK libraries
- Verify all webhook signatures
- Log transaction IDs (not card data)
- Test in sandbox environment
- Handle all payment states
- Implement proper error messages
**Don't:**
- Process raw card data directly
- Store sensitive payment info
- Hardcode API keys
- Skip webhook signature validation
- Ignore failed payment events
- Use test keys in production
© secondsky · MIT · secondsky/claude-skills
Similar skills
Everything for Backend and APIs →payment-gateway-integration by other authors comes first.