gpt4 book ai didi

react-native - 在 Android Pay 流程 (getPaymentToken) 之后,支付 token 变得未定义

转载 作者:行者123 更新时间:2023-12-03 15:21:40 30 4
gpt4 key购买 nike

我已经提到了这个 - https://github.com/naoufal/react-native-payments#readme

这是我的代码(已编辑):>

           const METHOD_DATA = [{
supportedMethods: ['android-pay'],
data: {
merchantIdentifier: 'merchant.co.guru.media',
supportedNetworks: ['visa', 'mastercard', 'amex'],
countryCode: 'US',
currencyCode: 'USD',
environment: PaymentMethodKeys.environment,
merchantInfo: {
// A merchant ID is available after approval by Google.
// @see {@link https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist}
merchantId: '0xxxxxxxxxxx6',
merchantName: 'Application_Merchant'
},
paymentMethodTokenizationParameters: {
tokenizationType: 'GATEWAY_TOKEN',
parameters: {
gateway: 'braintree',
"braintree:apiVersion": "v1",
"braintree:sdkVersion": '2.4.0',
"braintree:merchantId": "jxxxxxxxxxxxxt5",
"braintree:clientKey": "03xxxxxxxxxxxxxxe99",
'braintree:tokenizationKey': 'production_xqs_jbxxxxxxbx8249xxxxxx5',
publicKey: 'jxxxxxxxxxxxxxxxqt',
}
}
}
}];

const DETAILS = {
id: 'demo',
displayItems: [
{
label: 'Movie Ticket',
amount: { currency: 'USD', value: '15.00' }
},
{
label: 'Shipping',
amount: { currency: 'USD', value: '0.00' }
}
],
total: {
label: 'Merchant Name',
amount: { currency: 'USD', value: '15.00' }
},
shippingOptions: [
{
id: 'economy',
label: 'Economy Shipping',
amount: { currency: 'USD', value: '0.00' },
detail: 'Arrives in 3-5 days',
selected: true
},
{
id: 'express',
label: 'Express Shipping',
amount: { currency: 'USD', value: '5.00' },
detail: 'Arrives tomorrow'
}
]
};

const OPTIONS = {
requestPayerName: true,
requestPayerPhone: true,
requestPayerEmail: true,
requestShipping: true
};

const paymentRequest = new PaymentRequest(METHOD_DATA, DETAILS, OPTIONS);
paymentRequest.show()
.then(paymentResponse => {
const { getPaymentToken } = paymentResponse.details;
console.log('paymentResponse', JSON.stringify(getPaymentToken))
console.log('paymentResponse', JSON.stringify(paymentResponse))
return getPaymentToken()
.then(paymentToken => {
console.log('paymentToken paymentResponse', JSON.stringify(paymentToken))

});
});


问题是当我尝试执行 Android Pay 时,它返回“找不到记录”

得到的响应如下

{"serializedPaymentToken":"{\"error\":{\"message\":\"Record not found\"},\"fieldErrors\":[]}","paymentToken":{"error":{"message":"Record not found"},"fieldErrors":[]},"serializedPaymenToken":"{\"error\":{\"message\":\"Record not found\"},\"fieldErrors\":[]}","paymenToken":{"error":{"message":"Record not found"},"fieldErrors":[]}}'



因此, token 变得未定义。你能告诉我问题可能隐藏在哪里吗?我应该提到我在真实设备(使用实际的谷歌支付帐户)和沙盒上尝试了这段代码,但在所有情况下它都失败了。

提前致谢。

最佳答案

使用https://google.com/paysupportedMethods 下而不是 android-pay以便通过 Payment Request API 使用 Google Pay。

查看这两个示例以供进一步引用:official docs , sample from the Chrome team .

关于react-native - 在 Android Pay 流程 (getPaymentToken) 之后,支付 token 变得未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53852921/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com