Apple 在 Cordova 中使用 stripe 支付未完成付款
Apple pay with stripe in Cordova is getting payment not complete
这是我的代码,我收到的错误付款未完成。我在 Condova 中使用带有条纹的苹果支付。
这两个插件我都用过,但报错了。还请说明我如何获得条带令牌。
ApplePay.makePaymentRequest($scope.order).then((paymentResponse) passing $scope not getting paymentResponse
ApplePay.canMakePayments({
// supportedNetworks should not be an empty array. The supported networks currently are: amex, discover, masterCard, visa
supportedNetworks: ['visa', 'amex', 'masterCard', 'discover'],
// when merchantCapabilities is passed in, supportedNetworks must also be provided. Valid values: 3ds, debit, credit, emv
merchantCapabilities: ['3DS', 'debit', 'credit', 'emv']
}).then((message) => {
alert(message);
$scope.order = {};
$scope.order.items = [{
label: 'Subscription Charge',
amount: 1.00
}];
$scope.order.shippingMethods = [
{
"label": "Free Shipping",
"detail": "Subscription plan",
"amount": "0.00",
"identifier": "FreeShip"
}
];
$scope.order.supportedNetworks = ['visa', 'masterCard','discover'];
$scope.order.merchantCapabilities = ['3DS', 'debit', 'credit'];
$scope.order.merchantIdentifier = "merchant.com.appguys.foodroamer";
$scope.order.currencyCode = 'USD';
$scope.order.countryCode = 'US';
$scope.order.billingAddressRequirement = 'none';
$scope.order.shippingAddressRequirement = 'none';
$scope.order.shippingType = 'service';
ApplePay.makePaymentRequest($scope.order).then((paymentResponse) => {
alert(JSON.stringify(paymentResponse));
alert("Token Here",paymentResponse.paymentData);
httpService.userPost($scope.base_url+'domakeTestPayment',{'token':paymentResponse.paymentData}).then(function(paymentResponse){
alert(JSON.stringify(paymentResponse));
});
}).catch((e) => {
alert(4);
alert(e);
// Failed to open the Apple Pay sheet, or the user cancelled the payment.
})
}).catch((message) => {
alert(2);
alert(message);
console.log(message);
// There is an issue, examine the message to see the details, will be:
// 'This device cannot make payments.''
// 'This device can make payments but has no supported cards'
});
<plugin name="cordova-plugin-stripe-apple-pay" spec="https://github.com/asangadev/cordova-plugin-stripe-apple-pay">
<variable name="STRIPE_LIVE_PUBLISHABLE_KEY" value="xxxxxxxxxxx" />
<variable name="STRIPE_TEST_PUBLISHABLE_KEY" value="xxxxxxxx" />
<variable name="APPLE_MERCHANT_IDENTIFIER" value="xxxxxxxxxxx" />
</plugin>
我用的是 Braintree 而不是 stripe。请记住,我还在 Apple id 中将国家/地区更改为美国,在沙箱中也是如此
这是我的代码,我收到的错误付款未完成。我在 Condova 中使用带有条纹的苹果支付。
这两个插件我都用过,但报错了。还请说明我如何获得条带令牌。
ApplePay.makePaymentRequest($scope.order).then((paymentResponse) passing $scope not getting paymentResponse
ApplePay.canMakePayments({
// supportedNetworks should not be an empty array. The supported networks currently are: amex, discover, masterCard, visa
supportedNetworks: ['visa', 'amex', 'masterCard', 'discover'],
// when merchantCapabilities is passed in, supportedNetworks must also be provided. Valid values: 3ds, debit, credit, emv
merchantCapabilities: ['3DS', 'debit', 'credit', 'emv']
}).then((message) => {
alert(message);
$scope.order = {};
$scope.order.items = [{
label: 'Subscription Charge',
amount: 1.00
}];
$scope.order.shippingMethods = [
{
"label": "Free Shipping",
"detail": "Subscription plan",
"amount": "0.00",
"identifier": "FreeShip"
}
];
$scope.order.supportedNetworks = ['visa', 'masterCard','discover'];
$scope.order.merchantCapabilities = ['3DS', 'debit', 'credit'];
$scope.order.merchantIdentifier = "merchant.com.appguys.foodroamer";
$scope.order.currencyCode = 'USD';
$scope.order.countryCode = 'US';
$scope.order.billingAddressRequirement = 'none';
$scope.order.shippingAddressRequirement = 'none';
$scope.order.shippingType = 'service';
ApplePay.makePaymentRequest($scope.order).then((paymentResponse) => {
alert(JSON.stringify(paymentResponse));
alert("Token Here",paymentResponse.paymentData);
httpService.userPost($scope.base_url+'domakeTestPayment',{'token':paymentResponse.paymentData}).then(function(paymentResponse){
alert(JSON.stringify(paymentResponse));
});
}).catch((e) => {
alert(4);
alert(e);
// Failed to open the Apple Pay sheet, or the user cancelled the payment.
})
}).catch((message) => {
alert(2);
alert(message);
console.log(message);
// There is an issue, examine the message to see the details, will be:
// 'This device cannot make payments.''
// 'This device can make payments but has no supported cards'
});
<plugin name="cordova-plugin-stripe-apple-pay" spec="https://github.com/asangadev/cordova-plugin-stripe-apple-pay">
<variable name="STRIPE_LIVE_PUBLISHABLE_KEY" value="xxxxxxxxxxx" />
<variable name="STRIPE_TEST_PUBLISHABLE_KEY" value="xxxxxxxx" />
<variable name="APPLE_MERCHANT_IDENTIFIER" value="xxxxxxxxxxx" />
</plugin>
我用的是 Braintree 而不是 stripe。请记住,我还在 Apple id 中将国家/地区更改为美国,在沙箱中也是如此