naoufal / react-native-payments

Accept Payments with Apple Pay and Android Pay using the Payment Request API.
https://www.npmjs.com/package/react-native-payments
1.59k stars 413 forks source link

Tokenizing Apple Pay #288

Open GFean opened 3 years ago

GFean commented 3 years ago

Hi there, I couldn't find a correct way to tokenize my apple pay payment, so I can get the payment nonce in the end. If I pass 'braintree' as gateaway, it says that it's not supported. Any help please ?

kowalski commented 3 years ago

I didn't try with braintree but I just got it working with Stripe. And initially I had same problem - message saying its not linked.

The trick is that it only works with the gateway if it can resolve in objective c import <Stripe/Stripe.h> (and analogically for Braintree) so you need to take care that that library is installed and importable.

Actually the podspec of this package lists Stripe and Braintree as dependencies so you'd think it ought to work. However problem with Stripe is that it's newest version is for swift only and doesnt seem to offer header files for objective c. The fix was to force older version of Stripe pod in Podfile of my project. I used the latest from major 19 and it worked.

Similar issue may be true for Braintree. Try forcing an older version of Braintree. You can browse on ios/Pods/Braintree to see if it ships with swift files or objective c files.

Good luck and please pay it forward!

GFean commented 3 years ago

Hi there, sorry I didn't notice your answer. Thanks a lot for your attention ! I've fixed this issue by sharing the same interface from react-native-dropin-ui, since I'm also using this package I've included braintree module from there in gatewaymanager and made some other modifications and it has worked for me. If someone's interested, you can check my forked version of this package on my Github Page.

nabilfreeman commented 3 years ago

Hi both, just seen this discussion. Really helpful to know that Stripe has to be locked to a specific version. I'll fix this in the podspec 👍