Payment Integration Mastery
Production-proven multi-provider payment processing with Stripe, Paddle, SePay, Polar, and Creem.io.
Platform Selection
| Platform |
Best For |
Tax Handling |
Pricing |
| Stripe |
Enterprise, custom flows, Connect platforms |
You handle tax |
2.9% + 30¢ |
| Paddle |
SaaS subscriptions, global sales |
MoR (they handle tax) |
5% + 50¢ |
| SePay |
Vietnam market, VND, bank transfers |
You handle |
Low fees |
| Polar |
Open-source SaaS, subscriptions |
MoR |
5% |
| Creem.io |
MoR + software licensing |
MoR |
Varies |
Implementation Flow (All Providers)
1. Auth (API keys, secrets)
2. Create Products/Prices
3. Implement Checkout
4. Handle Webhooks
5. Manage Subscriptions
6. Monitor & Reconcile
Reference Navigation
Stripe
- Stripe Integration — Checkout Sessions, Payment Element, Billing Portal, Connect
- Stripe Webhooks — Event handling, signature verification, idempotency
Paddle
- Paddle Integration — MoR model, overlay/inline checkout, subscription lifecycle
- Paddle Webhooks — SHA256 verification, event types, Retain
Vietnam & Others
- SePay VietQR — Vietnamese bank integration, QR code payments, webhook setup
- Polar & Creem — Global SaaS billing, software licensing, benefits delivery
Architecture
- Multi-Provider Patterns — Unified order management, provider abstraction, currency handling
Quick Start (Stripe)
// Server: Create checkout session
import Stripe from 'stripe'
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!)
const session = await stripe.checkout.sessions.create({
line_items: [{
price: 'price_xxx',
quantity: 1
}],
mode: 'subscription',
success_url: 'https://myapp.com/success?session_id={CHECKOUT_SESSION_ID}',
cancel_url: 'https://myapp.com/cancel'
})
// Redirect to session.url
// Webhook handler
import { buffer } from 'micro'
export async function POST(req: Request) {
const body = await req.text()
const sig = req.headers.get('stripe-signature')!
const event = stripe.webhooks.constructEvent(body, sig, process.env.STRIPE_WEBHOOK_SECRET!)
switch (event.type) {
case 'checkout.session.completed':
await handleCheckoutComplete(event.data.object)
break
case 'invoice.payment_succeeded':
await handlePaymentSuccess(event.data.object)
break
case 'customer.subscription.deleted':
await handleSubscriptionCancelled(event.data.object)
break
}
return new Response('ok')
}
Best Practices
- Always verify webhook signatures — Never trust unverified webhooks
- Idempotent webhook handlers — Process each event exactly once
- Store provider IDs — Map Stripe/Paddle IDs to your internal IDs
- Handle edge cases — Failed payments, disputed charges, refunds
- Test with CLI tools —
stripe listen --forward-to localhost:3000/webhook
- Use MoR for global — Paddle/Creem handle tax compliance for you
Related Skills
1---2name: payments3description: Multi-provider payment integration — Stripe (checkout, billing, Connect), Paddle (MoR subscriptions), SePay (VietQR, Vietnamese banks), Polar (global SaaS), Creem.io (MoR + licensing). Checkout flows, webhooks, subscriptions, QR payments, multi-provider management.4license: MIT5---67# Payment Integration Mastery89Production-proven multi-provider payment processing with Stripe, Paddle, SePay, Polar, and Creem.io.1011## Platform Selection1213| Platform | Best For | Tax Handling | Pricing |14|----------|----------|-------------|---------|15| **Stripe** | Enterprise, custom flows, Connect platforms | You handle tax | 2.9% + 30¢ |16| **Paddle** | SaaS subscriptions, global sales | MoR (they handle tax) | 5% + 50¢ |17| **SePay** | Vietnam market, VND, bank transfers | You handle | Low fees |18| **Polar** | Open-source SaaS, subscriptions | MoR | 5% |19| **Creem.io** | MoR + software licensing | MoR | Varies |2021## Implementation Flow (All Providers)22```231. Auth (API keys, secrets)242. Create Products/Prices253. Implement Checkout264. Handle Webhooks275. Manage Subscriptions286. Monitor & Reconcile29```3031## Reference Navigation3233### Stripe34- **[Stripe Integration](references/stripe-integration.md)** — Checkout Sessions, Payment Element, Billing Portal, Connect35- **[Stripe Webhooks](references/stripe-webhooks.md)** — Event handling, signature verification, idempotency3637### Paddle38- **[Paddle Integration](references/paddle-integration.md)** — MoR model, overlay/inline checkout, subscription lifecycle39- **[Paddle Webhooks](references/paddle-webhooks.md)** — SHA256 verification, event types, Retain4041### Vietnam & Others42- **[SePay VietQR](references/sepay-vietqr.md)** — Vietnamese bank integration, QR code payments, webhook setup43- **[Polar & Creem](references/polar-creem.md)** — Global SaaS billing, software licensing, benefits delivery4445### Architecture46- **[Multi-Provider Patterns](references/multi-provider-patterns.md)** — Unified order management, provider abstraction, currency handling4748## Quick Start (Stripe)4950```typescript51// Server: Create checkout session52import Stripe from 'stripe'53const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!)5455const session = await stripe.checkout.sessions.create({56 line_items: [{57 price: 'price_xxx',58 quantity: 159 }],60 mode: 'subscription',61 success_url: 'https://myapp.com/success?session_id={CHECKOUT_SESSION_ID}',62 cancel_url: 'https://myapp.com/cancel'63})6465// Redirect to session.url66```6768```typescript69// Webhook handler70import { buffer } from 'micro'7172export async function POST(req: Request) {73 const body = await req.text()74 const sig = req.headers.get('stripe-signature')!75 76 const event = stripe.webhooks.constructEvent(body, sig, process.env.STRIPE_WEBHOOK_SECRET!)77 78 switch (event.type) {79 case 'checkout.session.completed':80 await handleCheckoutComplete(event.data.object)81 break82 case 'invoice.payment_succeeded':83 await handlePaymentSuccess(event.data.object)84 break85 case 'customer.subscription.deleted':86 await handleSubscriptionCancelled(event.data.object)87 break88 }89 90 return new Response('ok')91}92```9394## Best Practices95961. **Always verify webhook signatures** — Never trust unverified webhooks972. **Idempotent webhook handlers** — Process each event exactly once983. **Store provider IDs** — Map Stripe/Paddle IDs to your internal IDs994. **Handle edge cases** — Failed payments, disputed charges, refunds1005. **Test with CLI tools** — `stripe listen --forward-to localhost:3000/webhook`1016. **Use MoR for global** — Paddle/Creem handle tax compliance for you102103## Related Skills104105| Skill | When to Use |106|-------|-------------|107| [rust-backend-advance](../rust-backend-advance/SKILL.md) | Webhook handling, payment APIs |108| [databases](../databases/SKILL.md) | Order/payment data storage |109| [nextjs-turborepo](../nextjs-turborepo/SKILL.md) | Checkout UI, payment forms |110| [testing](../testing/SKILL.md) | Payment flow E2E testing |111| [devops](../devops/SKILL.md) | Webhook security, secrets management |