Reputation: 11
I have the following issue with Paypal and ApplePay. I need to add possibility to pay with credit card and PayPal and Apple Pay on my website.
I'm using paypal.Buttons(buttonsConfig).render('myDivId')
function to show PayPal and Pay with Credit card buttons. That all works like a charm.
Issue starts when I want to add possibility to use ApplePay. I was following the docs, added &components=applepay
to the PayPal script src, also added a new button once I have an ApplePay Session.
And I added &components=applepay
only if the target device is iOS device.
Testing on a Mac, I can use the Apple Pay button and it also works without issues.
But, I'm getting issue initializing my other buttons, which is PayPal and 'Debit or Credit Card' button. . Console error says:
TypeError: paypal.Buttons is not a function. (In 'paypal.Buttons(a)', 'paypal.Buttons' is undefined)
That started happening after adding &components=applepay
to the PpayPal script src.
I even tried using 2 paypal scripts on the iOS device. One with and one without &components=applepay. Buttons showed up, but when clicked on 'Debit or Credit Card' button, I'm getting HTTP 400 from card-fields request.
Just one note on ApplePay. From ApplePay I'm retrieving token, that I'm later sending to paypal confirmOrder. Exactly as on their examples.
Upvotes: 1
Views: 362
Reputation: 30379
&components=applepay
will exclusively load that component
For usual buttons you need to specify the (otherwise default) "buttons" component as well, using &components=buttons,applepay
Upvotes: 1