Apple在Cordova中使用带条纹的付款方式无法完成付款

时间:2020-02-18 06:35:22

标签: cordova stripe-payments phonegap-plugins phonegap applepay

这是我的代码,我收到的错误付款未完成。我在Condova中使用带条纹的Apple Pay。

我都使用了两个插件,但给了我错误。还请说明如何获得条纹令牌。

ApplePay.makePaymentRequest($ scope.order).then((paymentResponse)传递$ scope却未获得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>

1 个答案:

答案 0 :(得分:0)

我使用Braintree而不是条纹。记住,我也将Apple ID和沙箱中的国家/地区也更改为美国