ezet / stripe-sdk

A simple and flexible Stripe library for Flutter with complete support for SCA and PSD2.
https://pub.dev/packages/stripe_sdk
Other
137 stars 137 forks source link

What's with all this code? #82

Closed EightRice closed 4 years ago

EightRice commented 4 years ago

The only thing I need is to set up my Stripe API key and secret, send the payment details to the server and receive back an error or a confirmation. Can you please make a simple example that includes comments and shows how to do that? I tried using the example you have on pub.dev and it doesn't resolve any of the custom objects you have in this library. Then I tried running this project as is, and I get errors regarding ephemeral keys. But I don't even know what those buttons are supposed to be (pm_card_Authentication...). If I try to add a payment method I get

" Cannot read property 'app' of undefined at Object.app$ [as app] (http://localhost:52993/packages/firebase/src/top_level.dart.lib.js:78:56) at cloud_functions_web.CloudFunctionsWeb.new.callCloudFunction (http://localhost:52993/packages/cloud_functions_web/cloud_functions_web.dart.lib.js:28:27)"

Am I supposed to be using this in conjunction with cloud functions?

LATER EDIT: ok, I see that the Stripe credentials are actually stored in cloud functions, and I saw your "demo api" project that contains the cloud functions, which is also very large and difficult to understand. I mean.. is there no simpler way ? I feel like I need to study for a few years just to be able to accept a simple one-time charge in my webapp... Where do I even configure the url of the cloud function?

ezet commented 4 years ago

This is a low-level client for the Stripe API, with a slightly more advanced client on top. It is pretty close to the official android and iOS SDKs from Stripe, and there is no way around requiring at least some sort of backend in order to handle payments. Whether you use cloud functions or another backend is up to you, the cloud functions are simply there as an example. You basically need to read and understand the official stripe documentation in order to make sense/use of this library.