Home > Mobile >  Flutter firebase stripe
Flutter firebase stripe

Time:12-13

I am a newby about stripe an its integration in a flutter app.

I am using firebase for my backend (not really anything to complex, just some event functions) and as I said, flutter for my app (for android an iOS) and I am totally lost with how to proceed.

I have found a plugin for firebase (https://firebase.google.com/products/extensions/stripe-firestore-stripe-payments) and also a library for flutter for stripe (https://pub.dev/packages/flutter_stripe) but I am not sure if I have to use one of those and do the other part by myself, if using one will be redundant with the other or if I should use both and integrate them together.

Extra info: payments will be one off each month (not a subscription, every month will be a different amount) and the will be stored in a firestore collection.

So... Any clear resource or documentation will be appreciated!

CodePudding user response:

The Stripe Extensions for Firebase are based on Cloud Functions and Firestore. This means that to initiate an action with Stripe, you write something to a document in Firestore, and to get a response or respond to an event on Stripe, you'l listen to/read from Firestore.

There is a client-side SDK for this extension for JavaScript, but not for other platforms/languages yet. To learn how to interact with Stripe through the Extension on other platforms, consider starting with this codelab, which covers use-cases such as reading product and pricing data and render it to the page, creating a subscription for your customer, and showing the active subscription once created.

From the documentation page you linked comes this on its recommended usage:

If you're building on the web platform, you can use this extension for any of your payment use cases.

If you're developing native mobile applications and you're selling digital products or services within your app, (e.g. subscriptions, in-game currencies, game levels, access to premium content, or unlocking a full version), you must use the app store's in-app purchase APIs. See Apple's and Google's guidelines for more information.

For all other scenarios you can use the stripe-android, stripe-ios, stripe-react-native, or flutter_stripe SDKs.

So that last line links to the flutter_stripe SDK you also mention, and recommends using that for use-cases not met by the Stripe Extension for Firebase.

  • Related