cordova - 在cordova项目中集成了cordova-plugin-applepay,但付款没有成功,使用了cordova的相同代码
问题描述
在 Cordova 项目中实施 ApplePay 时遇到问题。安装插件“cordova-plugin-applepay”并按照相同的说明进行测试付款在模拟器上运行时付款失败并收到“'我的时装公司'无法完成付款。请重试”
使用以下插件:https ://www.npmjs.com/package/cordova-plugin-applepay并按照此插件网站中的说明更改配置,然后使用示例代码(在上述网站上)进行测试付款。
我已经在苹果开发者和证书配置上创建了商家 ID。
我实施了以下代码以使用 Apple Pay 付款:
ApplePay.makePaymentRequest(
{
items: [
{
label: '3 x Basket Items',
amount: 49.99
},
{
label: 'Next Day Delivery',
amount: 3.99
},
{
label: 'My Fashion Company',
amount: 53.98
}
],
shippingMethods: [
{
identifier: 'NextDay',
label: 'NextDay',
detail: 'Arrives tomorrow by 5pm.',
amount: 3.99
},
{
identifier: 'Standard',
label: 'Standard',
detail: 'Arrive by Friday.',
amount: 4.99
},
{
identifier: 'SaturdayDelivery',
label: 'Saturday',
detail: 'Arrive by 5pm this Saturday.',
amount: 6.99
}
],
supportedNetworks: ['visa', 'masterCard', 'discover'],
merchantCapabilities: ['3ds', 'debit', 'credit'],
merchantIdentifier: 'using my merchant Id',
currencyCode: 'GBP',
countryCode: 'GB',
billingAddressRequirement: 'none',
shippingAddressRequirement: 'none',
shippingType: 'shipping'
}).then((paymentResponse) => {
// The user has authorized the payment.
// Handle the token, asynchronously, i.e. pass to your merchant bank to
// action the payment, then once finished, depending on the outcome:
// Here is an example implementation:
// MyPaymentProvider.authorizeApplePayToken(token.paymentData)
// .then((captureStatus) => {
// // Displays the 'done' green tick and closes the sheet.
// ApplePay.completeLastTransaction('success');
// })
// .catch((err) => {
// // Displays the 'failed' red cross.
// ApplePay.completeLastTransaction('failure');
// });
}).catch((e) => {
// Failed to open the Apple Pay sheet, or the user cancelled the payment.`enter code here`
})
付款后,它应该完成付款。我在这里错过了什么吗?
解决方案
推荐阅读
- java - 标记 CSV 行转义双引号
- javascript - TypeScript:TypeError:无法设置未定义的属性“测试”
- java - Picocli:为具有 Map 类型的选项指定默认值
- python - 为什么python会像这样自动对我的字典进行排序?
- swift - 地图中的 SF 符号不会应用颜色
- c# - 如何将 WPF ItemsControl 源绑定到列表段
- c# - 我应该如何处理在集线器中调用相同方法的多个客户端?
- html - How to insert text into a text file on a specific line or after a specific word?
- javascript - 表单 onSubmit={handleSubmit} 通过任何具有 type="submit" 或未指定的按钮或在文本框上输入后触发
- javascript - 我的解决方案有什么问题,加入数组元素?