checkout / checkout-magento2-plugin

Checkout.com Magento 2 official extension
MIT License
33 stars 33 forks source link

Cannot Checkout using Apple Pay #492

Open tony-xavier opened 3 years ago

tony-xavier commented 3 years ago

Module - v2.3.1

Issue: Attempted to checkout using ApplePay, and although it states it's available, it says not active applepay

Note: ApplePay is working for most of the customers and getting this warning message only for some customers.

usmanbashir1 commented 3 years ago

Hi @tony-xavier

You need to provide the absolute path to overcome this issue .

Let suoopser you upload the certificate at {BaseUrl}/pub/certificate.pem

you need to add the absolute path in backend configuration like this /var/www/html/installation_folder_name/pub/certificate.pem

tony-xavier commented 3 years ago

@usmanbashir1 Certificates are already configured and the ApplePay is working for most of the customers. The above warning message is only for some customers. FYI: We will get the same error if the customer doesn't have a valid payment card setup. But we are getting the same issue for valid users (users have valid payment card setup) also.

JamesFX2 commented 3 years ago

I think the issue is caused by this https://github.com/checkout/checkout-magento2-plugin/commit/e82d4792717d859bd8e63d0e47e45f093e63d341#diff-3bf05ed19b66e6338063bab879891ccbe11ba078352dec2a9ec57ec37bff15bb

You made merchantId a hidden field so it's not exposed in window.checkoutConfig.payment["checkoutcom_magento2"].checkoutcom_apple_pay.merchant_id so

https://github.com/checkout/checkout-magento2-plugin/blob/master/view/frontend/web/js/view/payment/method-renderer/checkoutcom_apple_pay.js#L187-L191

                    if (window.ApplePaySession) {
                        var merchantIdentifier = self.getValue('merchant_id');
                        var promise = ApplePaySession.canMakePaymentsWithActiveCard(merchantIdentifier);
                        promise.then(
                            function (canMakePayments) {

getValue for the merchant id returns null so ApplePaySession.canMakePaymentsWithActiveCard(null) is returning false in the promise.

I've tested using pages like https://developer.apple.com/forums/thread/60303 and when it's null, they get false. When it's the appropriate merchant ID, it returns true (in the Promise).

bakshivarun commented 3 years ago

Hi Tony & others,

This is an issue we have taken stock of and will be fixed in the upcoming Magento 2 version release before the end of the month.

Best, Varun

JamesFX2 commented 2 years ago

@bakshivarun shouldn't https://github.com/checkout/checkout-magento2-plugin/blob/master/view/frontend/web/js/view/payment/method-renderer/checkoutcom_apple_pay.js#L93 be this.getValue not getValue - getting a reference error in JS Error logs.