Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement stripe with react-native using expo? [closed]

I have been searching a lot and seen a lot of similar questions but non of them fits in my requirements.

I need to implement Stripe in react-native built using expo XDE. As mentioned in expo docs here: https://docs.expo.io/versions/latest/sdk/payments.html#importing-payments, I will have to detach my project to implement payment but I don't want to do that. Is there any alternative? Also other wrappers available on GitHub doesn't facilitates projects built with expo completely. I am unable to find any complete wrapper or at least a guide to build my own.

I am looking for a solution for subscription based model, I need to charge my customers recursively and allow them to upgrade/downgrade their packages during an on going paid/trial period. I don't want to hold credit card information and allow customers to update their billing information whenever needed. Implement refund policies as well.

like image 902
Affan Shahab Avatar asked Jan 28 '23 23:01

Affan Shahab


2 Answers

I recently faced the same issue, this is the conclusion:

Short version: You'll need to detach if you need payments (Stripe) on iOS. (If you don't, juse use the Payments module from Expo - it is not obvious right away, but they do state in the docs that it is based on tipsi-stripe).

Explanation: The Expo SDK used to contain a payments module for both Android & iOS. For the last 3-4 versions of Expo, Payments has been removed from the iOS SDK because "Apple sometimes rejects apps which contain the Stripe SDK but don’t offer anything for sale.".

Reference: https://docs.expo.io/versions/latest/sdk/payments.html

Solution: detach to ExpoKit, and then add the Payments module manually. I can say from experience this is not a nice or straightforward process, as it first introduced the concept of manually building your app using MacOS/Xcode which is a pain to say the least for a Win user.

If you do not want to detach, it means you will have to implement your own, custom way of communicating with Stripe and not than their official SDK, which will imply PCI compliance issues.

like image 22
iuliu.net Avatar answered Jan 31 '23 17:01

iuliu.net


If you don't want to eject from Expo, you can use StripeCheckout component from expo-stripe-checkout on iOS and Android (though on Android you can still use the Payments module). Here's the link to the repo with further instructions: https://github.com/briansztamfater/expo-stripe-checkout

like image 69
Brian Sztamfater Avatar answered Jan 31 '23 17:01

Brian Sztamfater