支付域统一了 5 家供应商的下单、查询、关单、退款与回调验签能力。所有供应商实现同一个 IPaymentProvider 接口,鉴权机制差异显著:国内支付用 RSA 签名(支付宝 RSA2、微信 RSA-SHA256、银联证书签名),国际支付用 Bearer 或 OAuth2。
统一接口(5 方法)
IPaymentProvider 围绕支付订单生命周期组织,共 5 个成员:
| 分类 | 方法 | 说明 |
|---|---|---|
| 属性 | Code | 供应商编码 |
| 订单管理 | CreateOrderAsync | 创建支付订单(按场景自动路由 App/Web/H5/Code) |
| 订单管理 | QueryStatusAsync | 查询支付状态 |
| 订单管理 | CloseOrderAsync | 关闭订单 |
| 退款 | RefundAsync | 申请退款(支持全额与部分退款) |
| 回调 | VerifyCallbackAsync | 验证支付回调签名并解析回调内容 |
鉴权方式对比
| 供应商 | 鉴权机制 | 密钥字段 | 回调验签 |
|---|---|---|---|
| 支付宝 | RSA2(SHA256WithRSA) | AppPrivateKey / AlipayPublicKey | RSA2 验签 |
| 微信支付 | HMAC-SHA256 / RSA-SHA256 | PrivateKey / WeChatPayPublicKey | AES-256-GCM 解密 + RSA 验签 |
| Stripe | Bearer API Key | SecretKey | HMAC-SHA256 Webhook 签名 |
| PayPal | OAuth2 client_credentials | ClientId / ClientSecret | VERIFY-WEBHOOK-SIGNATURE |
| 银联 | RSA SHA256 证书签名 | CertPath / CertPassword | RSA SHA256 验签 |
供应商清单
| 供应商 | Provider ID | API 基地址 | NuGet 包 |
|---|---|---|---|
| 支付宝 | alipay | openapi.alipay.com | Bitzsoft.Integrations.Payment.Alipay |
| 微信支付 | wechatpay | api.mch.weixin.qq.com | Bitzsoft.Integrations.Payment.WeChatPay |
| Stripe | stripe | api.stripe.com | Bitzsoft.Integrations.Payment.Stripe |
| PayPal | paypal | api-m.paypal.com | Bitzsoft.Integrations.Payment.PayPal |
| 银联 | unionpay | gateway.95516.com | Bitzsoft.Integrations.Payment.UnionPay |