获得 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
中的 merchantInfo
在 braintree.googlePayment.create(...)
中。
因此,上述代码中的最终修复是删除 merchantId
和 merchantInfo
。
我不记得这只是一个错误还是旧版本 API 中的过时参数。无论哪种情况,这都是一个非常误导性的错误,因为该错误表明它丢失了,但它实际上是一个额外的参数。
关于braintree - GooglePay DEVELOPER_ERROR "PaymentDataRequest.merchantId does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57015699/