实现Apple应用内购支付功能,包括: 1. 新增AppleIAP和ApplePay支付平台枚举 2. 添加IAP验证接口/v1/public/iap/verify处理初购验证 3. 实现Apple服务器通知处理逻辑/v1/iap/notifications 4. 新增JWS验签和JWKS公钥缓存功能 5. 复用现有订单系统处理IAP支付订单 相关文档已更新,包含接入方案和实现细节
This commit is contained in:
@@ -86,7 +86,18 @@ func (l *PurchaseCheckoutLogic) PurchaseCheckout(req *types.CheckoutOrderRequest
|
||||
|
||||
case paymentPlatform.Stripe:
|
||||
// Process Stripe payment - creates payment sheet for client-side processing
|
||||
stripePayment, err := l.stripePayment(paymentConfig.Config, orderInfo, "")
|
||||
stripePayment, err := l.stripePayment(paymentConfig.Config, orderInfo, "", "")
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.ERROR), "stripePayment error: %v", err.Error())
|
||||
}
|
||||
resp = &types.CheckoutOrderResponse{
|
||||
Type: "stripe", // Client should use Stripe SDK
|
||||
Stripe: stripePayment,
|
||||
}
|
||||
|
||||
case paymentPlatform.ApplePay:
|
||||
// Process Apple Pay payment - uses Stripe with 'card' method
|
||||
stripePayment, err := l.stripePayment(paymentConfig.Config, orderInfo, "", "card")
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.ERROR), "stripePayment error: %v", err.Error())
|
||||
}
|
||||
@@ -208,7 +219,7 @@ func (l *PurchaseCheckoutLogic) alipayF2fPayment(pay *payment.Payment, info *ord
|
||||
|
||||
// stripePayment processes Stripe payment by creating a payment sheet
|
||||
// It supports various payment methods including WeChat Pay and Alipay through Stripe
|
||||
func (l *PurchaseCheckoutLogic) stripePayment(config string, info *order.Order, identifier string) (*types.StripePayment, error) {
|
||||
func (l *PurchaseCheckoutLogic) stripePayment(config string, info *order.Order, identifier string, forceMethod string) (*types.StripePayment, error) {
|
||||
// Parse Stripe configuration from payment settings
|
||||
stripeConfig := &payment.StripeConfig{}
|
||||
|
||||
@@ -217,6 +228,10 @@ func (l *PurchaseCheckoutLogic) stripePayment(config string, info *order.Order,
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.ERROR), "Unmarshal error: %s", err.Error())
|
||||
}
|
||||
|
||||
if forceMethod != "" {
|
||||
stripeConfig.Payment = forceMethod
|
||||
}
|
||||
|
||||
// Initialize Stripe client with API credentials
|
||||
client := stripe.NewClient(stripe.Config{
|
||||
SecretKey: stripeConfig.SecretKey,
|
||||
|
||||
Reference in New Issue
Block a user