braintree - GooglePay DEVELOPER_ERROR "PaymentDataRequest.merchantId does not exist"

标签 braintree google-pay

获得 Google Pay merchantId 批准后,我在尝试打开付款表时收到以下错误。

{ statusCode: "DEVELOPER_ERROR", errorCode: 2, 
  statusMessage: "PaymentDataRequest.merchantId does not exist." }

我正在使用 Braintree Payments,但这与最终消息无关。

   var paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({

            merchantId: environment.payment.googlePayMerchantId,

            merchantInfo: {
                merchantId: environment.payment.googlePayMerchantId
            },

            transactionInfo: {
                currencyCode: 'USD',
                totalPriceStatus: 'ESTIMATED',
                totalPrice: this.priceEstimate.toFixed(2)
            },

            shippingAddressRequired: true,

            emailRequired: true,

            shippingAddressParameters: {
                allowedCountryCodes: data.countryCodes.map(c => c.code)
            }

            // cardRequirements: {
            //   // We recommend collecting billing address information, at minimum
            //   // billing postal code, and passing that billing postal code with all
            //   // Google Pay transactions as a best practice.
            //   billingAddressRequired: true
            // }
        });

谷歌告诉我他们的结局一切看起来都很好。

最佳答案

事实证明,除了 merchantInfo 之外传递额外 merchantId 参数也会导致这种情况。

所以修复就是这样:

  // merchantId: environment.payment.googlePayMerchantId

但是,如果您在首次创建 Braintree 客户端时正确提供了 merchantId,则不需要 createPaymentDataRequest 中的 merchantInfobraintree.googlePayment.create(...) 中。

因此,上述代码中的最终修复是删除 merchantIdmerchantInfo

我不记得这只是一个错误还是旧版本 API 中的过时参数。无论哪种情况,这都是一个非常误导性的错误,因为该错误表明它丢失了,但它实际上是一个额外的参数。

关于braintree - GooglePay DEVELOPER_ERROR "PaymentDataRequest.merchantId does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57015699/

相关文章:

credit-card - 现代信用卡处理系统是否允许在持卡人姓名中使用变音符号?

braintree - 单元测试 3dSecure

php - Braintree dropin UI : validate billing address custom fields before form submit

java - AndroidAsyncHttp 错误

ReactJS:Stripe Google 和 Apple Pay

android - java.lang.ClassNotFoundException : android. 支持.v7.app.AppCompatViewInflater

android - 将信用卡保存到 Google Pay

google-console-developer - 在 Google Developers 控制台中找不到 NBU Payments API

android - 使用 Braintree Drop-In UI 集成 Google Pay

javascript - 使用 Google Pay JavaScript API 时防止客户端篡改