stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

Big size of Pod Dependencies for AppClip - any way to reduce it?

Open dawidzawada opened this issue 2 years ago • 28 comments

Is your feature request related to a problem? Please describe. I'm developing an App with shared code for AppClip - I need payments in both app versions. Unfortunately size of stripe-react-native Pod Dependencies exceeds 6MB. Apple AppClip's size limit is 10MB, my app current size is around 12MB with stripe-react-native package added. Is there's any way with a current package version to reduce size of the Pods? During installation of the pods I've noticed that i'm downloading quite a few packages:

pod install

Installing Stripe (21.12.0)
Installing StripeApplePay (21.12.0)
Installing StripeCore (21.12.0)
Installing StripeUICore (21.12.0)
Installing stripe-react-native (0.3.0) 

I'm wondering if i need all of the stripe's Pods - my project is using only these imports:

import { useApplePay, useStripe, useGooglePay } from '@stripe/stripe-react-native';
import { StripeProvider } from '@stripe/stripe-react-native';
import { CardFieldInput, initPaymentSheet, presentPaymentSheet } from '@stripe/stripe-react-native';

Describe the solution you'd like For now, just some "hacky" way to reduce the stripe pods size, a future solution - way to use a part of big Stripe native code, for example - importing with manual linking.

dawidzawada avatar May 19 '22 14:05 dawidzawada

Hi! Yes, this is a great ask. It's in our roadmap to explore this- it's possible that what this would mean is separating out stripe-react-native into a couple of smaller, modular libraries.

charliecruzan-stripe avatar May 19 '22 14:05 charliecruzan-stripe

Is there any way to achieve something like that now? I would like to have shared payments code with my main app on my appclip but Stripe pods are too big to fit in Apple 10 MB size limit. I was also considering moving app clips's payment code to some separated website - and embedding it inside the app with the webview - but that’s more radical way to fix this size issue.

dawidzawada avatar May 20 '22 06:05 dawidzawada

Hm, you could manually go in and edit the native code and dependencies, but that would be pretty rough imo, and not all of the native libraries are split out yet.

I was also considering moving app clips's payment code to some separated website - and embedding it inside the app with the webview - but that’s more radical way to fix this size issue.

Honestly, for the time being, this might not be a bad idea if you're using something like payment links

charliecruzan-stripe avatar May 20 '22 13:05 charliecruzan-stripe

Hi, right now I'm facing the same problem, unfortunately stripe-react-native is way too big for us. This is a very interesting concern because it defeats the app clip idea of doing something fast and pay for the services with apple pay, like for parking, renting a bike, pay for food.

Do you have any workarounds that we may use before separating the library in multiple modules.

Edit: From my tests there is ~6,6MB extra added to our app clip when using stripe-react-native

tux2nicolae avatar May 27 '22 20:05 tux2nicolae

I'm still in the research phase of using stripe payment logic inside of an app - separating is a really radical way for us. I'm after deleting quite a lot pods - our appclip size was over 12 MB - I've found this library - https://github.com/ivanmoskalev/react-native-compressed-jsbundle/ - and that is a really big step forward. Basically, this lib is compressing jsbundle of react native app. It might be helpfull in your case too. These are compression results:

Original size: 2684.33 KB
Compressed size: 449.661 KB

With that we've got closer to fitting the appclip size limit - the size after compression was over 10MB - right now the goal is to gain around 1MB - some pods need to be added, unfortunately.

dawidzawada avatar May 28 '22 11:05 dawidzawada

Hi, right now I'm facing the same problem, unfortunately stripe-react-native is way too big for us. This is a very interesting concern because it defeats the app clip idea of doing something fast and pay for the services with apple pay, like for parking, renting a bike, pay for food.

Do you have any workarounds that we may use before separating the library in multiple modules.

Edit:

From my tests there is ~6,6MB extra added to our app clip when using stripe-react-native

Hello. Did you happen to find a solution that works for you?

aaronfisher avatar Jun 20 '22 22:06 aaronfisher

Bumping this up :)

Is there a timeline for splitting up the sdk in react native?

aaronfisher avatar Jun 21 '22 15:06 aaronfisher

@aaronfisher unfortunately we didn't find a solution acceptable for us beside modifying this library, which is a little too much for us in development effort. Because of this we postponed the payment processing feature for a few months.

If you find a solution that works well for you (and if you can) please share it with us here.

tux2nicolae avatar Jun 22 '22 12:06 tux2nicolae

Timeline isn't set in stone yet, but planning has already started. What would be useful on this issue would be to match @dawidzawada 's original post and show what imports you use, so we can ensure that how we modularize meshes well with your expectations 😄

charliecruzan-stripe avatar Jun 22 '22 20:06 charliecruzan-stripe

what imports you use, so we can ensure that how we modularize meshes well with your expectations

Little update from my side. These are my current imports:

import { StripeProvider } from '@stripe/stripe-react-native';

import { useApplePay, useGooglePay, useStripe } from '@stripe/stripe-react-native';

import { initPaymentSheet, presentPaymentSheet } from '@stripe/stripe-react-native';

In my opinion, it would be really helpful for appclips & instant apps to split stripe package with smallest pods/packages possible. For example ApplePay, GooglePay, should have separated pods/packages - for iOS app clips only ApplePay would be imported. For android's instant apps - we would switch to GooglePay import. Also cards payment sheet should be separated, same goes with the rest of the stripe package. With that, even if some appclip is on the edge of the limit and for example it would use ApplePay & Cards Sheet - size would be easier to maintain, some functionalities could be dropped e.g. Cards might be removed but Apple Pay would be still available.

dawidzawada avatar Jul 04 '22 07:07 dawidzawada

Do you have any updates on this?

tux2nicolae avatar Jul 26 '22 12:07 tux2nicolae

@charliecruzan-stripe Any updates on this?

maxrodrigo avatar Oct 24 '22 07:10 maxrodrigo

The iOS SDK has recently been split into modules. Can we expect this modularization in the react native SDK anywhere soon? This is a major blocker for using RN + stripe at the moment.

JeroenJochems avatar Dec 13 '22 10:12 JeroenJochems

@dawidzawada did you manage to find a solution on this?

tux2nicolae avatar Jan 21 '23 10:01 tux2nicolae

It's even worse now than when this issue was created.

Just tried again with the latest version and and our app clip increases in size to 18,4 MB uncompressed from 9,6 MB uncompressed an addition of 8,8 MB, this seems unreal, how does this library get to 8,8 MB when we have an entire app fit in 9,6 MB including react native framework, navigation, notifications, animations, localization, camera, permissions, UI library (react-native-paper), icons, and a few more.

tux2nicolae avatar Jan 21 '23 11:01 tux2nicolae

Yes, now that the iOS SDK has been split into modules, we are unblocked to start this work. We don't have a defined date yet, but as soon as we do I'll update here

charliecruzan-stripe avatar Jan 25 '23 21:01 charliecruzan-stripe

It's been a few months now, I get that you might not have a definitive timeline but there must be some sort of a roadmap we can expect from the react-native SDK, otherwise it's not a complete product vs the other SDKs being offered by stripe

martimarkov avatar Jun 16 '23 19:06 martimarkov

Indeed, unfortunately I given up on using stripe in the app clip, we still are using it in the main app, and would be nice if we could have the same implementation and be able to use it.

tux2nicolae avatar Jun 17 '23 07:06 tux2nicolae

I’m looking into Adyen as an alternative and will post my findings here. It might have a smaller footprint which would be very useful for the main app as well.

The lack of support from Stripe on their official React-Native SDK is a bit much. It feels like a second class citizen in their offering.

martimarkov avatar Jun 17 '23 13:06 martimarkov

Sorry folks, I understand that this is an important change to make but we unfortunately just haven't been able to prioritize it recently. My hope is that we will be able to give you a more definitive timeline soon. It is on our radar and I'm aware how important this is

edit: woops! didn't mean to close the issue, re-opening

charliecruzan-stripe avatar Jun 28 '23 23:06 charliecruzan-stripe

Related Stackoverflow question

https://stackoverflow.com/questions/77158898/app-clip-and-instant-app-with-stripe-payments-using-react-native

tux2nicolae avatar Oct 18 '23 09:10 tux2nicolae

Ad: I have created an early version of a wrapper for StripeApplePay. https://github.com/RobertSasak/react-native-stripe-apple-pay With this post I am looking for contributors.

For motivation here is how my app size reduced.

+App size: 6,4 MB compressed, 17 MB uncompressed
+Bundle is 3.13 MB
-App size: 2,6 MB compressed, 8,2 MB uncompressed
-Bundle is 3.08 MB

RobertSasak avatar Nov 16 '23 23:11 RobertSasak

Hello there everyone, is there any updates on this just to know if it's still a thing that needs to be developed

Timeline isn't set in stone yet, but planning has already started. What would be useful on this issue would be to match @dawidzawada 's original post and show what imports you use, so we can ensure that how we modularize meshes well with your expectations 😄

is there any update over this?

Fannolo avatar Jan 28 '24 22:01 Fannolo

Are there any updates on this? We are waiting for more than I year on this issue :(

tux2nicolae avatar Mar 02 '24 14:03 tux2nicolae