如何在 swift 中实现 live stripe apple pay? Stripe 测试密钥工作正常但不可用,我该如何解决?

How can implement live stripe apple pay in swift? Stripe test key is working fine but not live, how can I fix it?

我正在使用 stripe apple pay 付款。我已经集成了 stripe apple pay,并且它与 test stripe key 一起工作正常。但是当我使用 live stripe key 时它显示错误:

Apple pay not completed "total" was not able to complete the payment.

我正在关注 stripe doc and this blog 以整合 Apple Pay。完成这些步骤:

1: Register for an Apple Merchant ID

2: Create a new Apple Pay certificate

3: Integrate with Xcode

当点击 apple pay 按钮时,此代码将 运行:

let paymentNetworks:[PKPaymentNetwork] = [.amex, .discover, .masterCard, .visa]

        if PKPaymentAuthorizationViewController.canMakePayments(usingNetworks: paymentNetworks) {
            let request = PKPaymentRequest()

            request.merchantIdentifier = constants.merchantIdentifier
            //request.supportedCountries = ["GB"]
            request.countryCode = "GB"
            request.currencyCode = "GBP"
            request.supportedNetworks = paymentNetworks
            //request.requiredShippingContactFields = [.name, .postalAddress]
            // This is based on using Stripe
            request.merchantCapabilities = .capability3DS

            let total = PKPaymentSummaryItem(label: "Total", amount: NSDecimalNumber(decimal: Decimal(floatLiteral: Double(totalWithDeliveryCharges))), type: .final)
            request.paymentSummaryItems = [total]

            let authorizationViewController = PKPaymentAuthorizationViewController(paymentRequest: request)

            if let viewController = authorizationViewController {
                viewController.delegate = self

                present(viewController, animated: true, completion: nil)
            }
        }
        else {
            self.showAlert("Alert", "Device does not support apple pay.")
        }

我的输出是:-

Apple pay not completed "total" was not able to complete the payment.

但实际输出是

Processing complete

完成。 I forget to refresh apple pay merchant id in XCode after stripe apple pay certificate added.

按照图片,只需点击刷新商家 ID 按钮即可消除此错误。 请确保您已按照此 step.

添加了 stripe apple pay 证书