AgentSkillsCN

payments

多支付服务商集成——Stripe(Checkout、Billing、Connect)、Paddle(MoR 订阅)、SePay(VietQR、越南各银行)、Polar(全球 SaaS)、Creem.io(MoR + 授权许可)。涵盖 Checkout 流程、Webhook、订阅服务、二维码支付,以及多支付服务商的统一管理。

SKILL.md
--- frontmatter
name: payments
description: 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.
license: MIT

Payment Integration Mastery

Production-proven multi-provider payment processing with Stripe, Paddle, SePay, Polar, and Creem.io.

Platform Selection

PlatformBest ForTax HandlingPricing
StripeEnterprise, custom flows, Connect platformsYou handle tax2.9% + 30¢
PaddleSaaS subscriptions, global salesMoR (they handle tax)5% + 50¢
SePayVietnam market, VND, bank transfersYou handleLow fees
PolarOpen-source SaaS, subscriptionsMoR5%
Creem.ioMoR + software licensingMoRVaries

Implementation Flow (All Providers)

code
1. Auth (API keys, secrets)
2. Create Products/Prices
3. Implement Checkout
4. Handle Webhooks
5. Manage Subscriptions
6. Monitor & Reconcile

Reference Navigation

Stripe

Paddle

Vietnam & Others

  • SePay VietQR — Vietnamese bank integration, QR code payments, webhook setup
  • Polar & Creem — Global SaaS billing, software licensing, benefits delivery

Architecture

Quick Start (Stripe)

typescript
// 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
typescript
// 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

  1. Always verify webhook signatures — Never trust unverified webhooks
  2. Idempotent webhook handlers — Process each event exactly once
  3. Store provider IDs — Map Stripe/Paddle IDs to your internal IDs
  4. Handle edge cases — Failed payments, disputed charges, refunds
  5. Test with CLI toolsstripe listen --forward-to localhost:3000/webhook
  6. Use MoR for global — Paddle/Creem handle tax compliance for you

Related Skills

SkillWhen to Use
rust-backend-advanceWebhook handling, payment APIs
databasesOrder/payment data storage
nextjs-turborepoCheckout UI, payment forms
testingPayment flow E2E testing
devopsWebhook security, secrets management