payment-integration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Payment Integration

支付集成

Implement payment processing with SePay (Vietnamese payments) and Polar (global SaaS monetization).
实现与SePay(越南支付服务)和Polar(全球SaaS变现平台)的支付处理集成。

When to Use

适用场景

Use when implementing:
  • Payment gateway integration (checkout, processing)
  • Subscription management (trials, upgrades, billing)
  • Webhook handling (payment notifications)
  • QR code payments (VietQR, NAPAS)
  • Usage-based billing (metering, credits)
  • Automated benefit delivery (licenses, GitHub access, Discord roles)
  • Customer portals (self-service management)
  • Bank transfer automation (Vietnamese banks)
  • Product catalogs with pricing
适用于以下场景的开发:
  • 支付网关集成(结账、交易处理)
  • 订阅管理(试用、升级、计费)
  • Webhook处理(支付通知)
  • 二维码支付(VietQR、NAPAS)
  • 基于使用量的计费(计量、额度)
  • 自动化权益发放(许可证、GitHub权限、Discord角色)
  • 客户门户(自助管理)
  • 银行转账自动化(越南本土银行)
  • 带定价的产品目录

Platform Selection

平台选择

Choose SePay for:
  • Vietnamese market (VND currency)
  • Bank transfer automation
  • VietQR/NAPAS payments
  • Local payment methods
  • Direct bank account monitoring
Choose Polar for:
  • Global SaaS products
  • Subscription management
  • Usage-based billing
  • Automated benefits (GitHub, Discord, licenses)
  • Merchant of Record (tax compliance)
  • Digital product sales
选择SePay的场景:
  • 越南市场(越南盾VND结算)
  • 银行转账自动化
  • VietQR/NAPAS支付
  • 本土支付方式
  • 银行账户直接监控
选择Polar的场景:
  • 全球SaaS产品
  • 订阅管理
  • 基于使用量的计费
  • 自动化权益发放(GitHub、Discord、许可证)
  • 收款方(MoR,税务合规)
  • 数字产品销售

Quick Reference

快速参考

SePay Integration

SePay集成

  • Overview & Auth:
    references/sepay/overview.md
    - Platform capabilities, API/OAuth2 auth, supported banks
  • API Reference:
    references/sepay/api.md
    - Endpoints, transactions, bank accounts, virtual accounts
  • Webhooks:
    references/sepay/webhooks.md
    - Setup, payload structure, verification, retry logic
  • SDK Usage:
    references/sepay/sdk.md
    - Node.js, PHP, Laravel implementations
  • QR Codes:
    references/sepay/qr-codes.md
    - VietQR generation, templates, integration
  • Best Practices:
    references/sepay/best-practices.md
    - Security, patterns, monitoring
  • 概述与身份验证
    references/sepay/overview.md
    - 平台功能、API/OAuth2身份验证、支持的银行
  • API参考
    references/sepay/api.md
    - 接口端点、交易、银行账户、虚拟账户
  • Webhook
    references/sepay/webhooks.md
    - 配置、负载结构、验证、重试逻辑
  • SDK使用
    references/sepay/sdk.md
    - Node.js、PHP、Laravel实现示例
  • 二维码
    references/sepay/qr-codes.md
    - VietQR生成、模板、集成方式
  • 最佳实践
    references/sepay/best-practices.md
    - 安全、模式、监控

Polar Integration

Polar集成

  • Overview & Auth:
    references/polar/overview.md
    - Platform capabilities, authentication methods, MoR concept
  • Products & Pricing:
    references/polar/products.md
    - Product types, pricing models, usage-based billing
  • Checkouts:
    references/polar/checkouts.md
    - Checkout flows, embedded checkout, links
  • Subscriptions:
    references/polar/subscriptions.md
    - Lifecycle, upgrades, downgrades, trials
  • Webhooks:
    references/polar/webhooks.md
    - Event types, signature verification, monitoring
  • Benefits:
    references/polar/benefits.md
    - Automated delivery (GitHub, Discord, licenses, files)
  • SDK Usage:
    references/polar/sdk.md
    - TypeScript, Python, PHP, Go, framework adapters
  • Best Practices:
    references/polar/best-practices.md
    - Security, patterns, monitoring
  • 概述与身份验证
    references/polar/overview.md
    - 平台功能、身份验证方式、MoR概念
  • 产品与定价
    references/polar/products.md
    - 产品类型、定价模型、基于使用量的计费
  • 结账流程
    references/polar/checkouts.md
    - 结账流程、嵌入式结账、结账链接
  • 订阅管理
    references/polar/subscriptions.md
    - 订阅生命周期、升级、降级、试用
  • Webhook
    references/polar/webhooks.md
    - 事件类型、签名验证、监控
  • 权益发放
    references/polar/benefits.md
    - 自动化发放(GitHub、Discord、许可证、文件)
  • SDK使用
    references/polar/sdk.md
    - TypeScript、Python、PHP、Go、框架适配
  • 最佳实践
    references/polar/best-practices.md
    - 安全、模式、监控

Integration Scripts

集成脚本

  • SePay Webhook Verification:
    scripts/sepay-webhook-verify.js
    - Verify SePay webhook authenticity
  • Polar Webhook Verification:
    scripts/polar-webhook-verify.js
    - Verify Polar webhook signatures
  • Checkout Helper:
    scripts/checkout-helper.js
    - Generate checkout sessions for both platforms
  • SePay Webhook验证
    scripts/sepay-webhook-verify.js
    - 验证SePay Webhook的真实性
  • Polar Webhook验证
    scripts/polar-webhook-verify.js
    - 验证Polar Webhook签名
  • 结账辅助工具
    scripts/checkout-helper.js
    - 为两个平台生成结账会话

Implementation Workflow

实施流程

SePay Implementation

SePay实施步骤

  1. Load
    references/sepay/overview.md
    for auth setup
  2. Load
    references/sepay/api.md
    or
    references/sepay/sdk.md
    for integration
  3. Load
    references/sepay/webhooks.md
    for payment notifications
  4. Use
    scripts/sepay-webhook-verify.js
    for webhook verification
  5. Load
    references/sepay/best-practices.md
    for production readiness
  1. 加载
    references/sepay/overview.md
    完成身份验证配置
  2. 加载
    references/sepay/api.md
    references/sepay/sdk.md
    进行集成开发
  3. 加载
    references/sepay/webhooks.md
    配置支付通知
  4. 使用
    scripts/sepay-webhook-verify.js
    进行Webhook验证
  5. 加载
    references/sepay/best-practices.md
    确保生产环境就绪

Polar Implementation

Polar实施步骤

  1. Load
    references/polar/overview.md
    for auth and concepts
  2. Load
    references/polar/products.md
    for product setup
  3. Load
    references/polar/checkouts.md
    for payment flows
  4. Load
    references/polar/webhooks.md
    for event handling
  5. Use
    scripts/polar-webhook-verify.js
    for webhook verification
  6. Load
    references/polar/benefits.md
    if automating delivery
  7. Load
    references/polar/best-practices.md
    for production readiness
  1. 加载
    references/polar/overview.md
    了解身份验证和核心概念
  2. 加载
    references/polar/products.md
    完成产品配置
  3. 加载
    references/polar/checkouts.md
    实现支付流程
  4. 加载
    references/polar/webhooks.md
    处理事件通知
  5. 使用
    scripts/polar-webhook-verify.js
    进行Webhook验证
  6. 若需自动化权益发放,加载
    references/polar/benefits.md
  7. 加载
    references/polar/best-practices.md
    确保生产环境就绪

Key Capabilities

核心功能

SePay:
  • Payment gateway (QR, bank transfer, cards)
  • Bank account monitoring with webhooks
  • Order-based virtual accounts
  • VietQR generation API
  • 44+ Vietnamese banks supported
  • Rate limit: 2 calls/second
Polar:
  • Merchant of Record (global tax compliance)
  • Subscription lifecycle management
  • Usage-based billing (events, meters)
  • Automated benefits (GitHub, Discord, licenses)
  • Customer portal (self-service)
  • Multi-language SDKs
  • Rate limit: 300 req/min
SePay核心功能:
  • 支付网关(二维码、银行转账、银行卡)
  • 基于Webhook的银行账户监控
  • 基于订单的虚拟账户
  • VietQR生成API
  • 支持44+家越南本土银行
  • 速率限制:2次调用/秒
Polar核心功能:
  • 收款方MoR(全球税务合规)
  • 订阅生命周期管理
  • 基于使用量的计费(事件、计量)
  • 自动化权益发放(GitHub、Discord、许可证)
  • 客户门户(自助服务)
  • 多语言SDK
  • 速率限制:300次请求/分钟

Instructions

实施指南

When implementing payment integration:
  1. Identify platform based on requirements (Vietnamese vs global, payment types)
  2. Load relevant references progressively as needed
  3. Implement authentication using platform-specific methods
  4. Set up products/pricing according to business model
  5. Implement checkout flow (hosted, embedded, or API-driven)
  6. Configure webhooks with proper verification
  7. Handle payment events (success, failure, refund)
  8. Test thoroughly in sandbox before production
  9. Monitor and optimize using platform analytics
Load only the references needed for current implementation step to maintain context efficiency.
实施支付集成时:
  1. 选择平台:根据需求(越南本地/全球、支付类型)选择合适的平台
  2. 按需加载参考文档:逐步加载所需的参考文档
  3. 实现身份验证:使用平台专属的身份验证方式
  4. 配置产品与定价:根据业务模型设置产品和定价
  5. 实现结账流程(托管式、嵌入式或API驱动)
  6. 配置Webhook并设置正确的验证机制
  7. 处理支付事件(成功、失败、退款)
  8. 全面测试:在沙箱环境中完成全面测试后再上线生产环境
  9. 监控与优化:利用平台分析工具进行监控和优化
仅加载当前实施步骤所需的参考文档,以保持上下文效率。