jonasbark / flutter_stripe_payment

[DISCONTINUED] A flutter plugin with stripe payment plugin integration
MIT License
308 stars 244 forks source link

Full example on how to use this plugin #123

Open macmatrix opened 4 years ago

macmatrix commented 4 years ago

Hello

I have just created an article on how to use this amazing plugin using Firebase as a server. Check it out

https://medium.com/flutter-community/build-a-marketplace-in-your-flutter-app-and-accept-payments-using-stripe-and-firebase-72f3f7228625

Thank you @jonasbark and @nicowernli for making the plugin available to use!

Yuanyoo commented 4 years ago

Thank you! and thanks @jonasbark and @nicowernli. I will try this :)

deimantasa commented 4 years ago

Great tutorial, @macmatrix . I was wondering, while handling this part

 PaymentMethod paymentMethod = PaymentMethod();
  paymentMethod = await StripePayment.paymentRequestWithCardForm(
    CardFormPaymentRequest(),
  ).then((PaymentMethod paymentMethod) {
    return paymentMethod;
  }).catchError((e) {
    print('Errore Card: ${e.toString()}');
  });

When do you receive an error? As I can add any number of the credit card - all the time it goes through. Any advice on that?

macmatrix commented 4 years ago

If you put an invalid card number you cannot move ahead. This is built in in the stripe sheet.

Screenshot 2020-03-06 at 09 00 32

Also if you put a valid credit card but your are not able to get a payment method from stripe you are going to have alert pop up.

Untitled 2

You can test all scenario with some test credit card made available from Stripe: https://stripe.com/docs/testing

deimantasa commented 4 years ago

Yes, I'm aware about testing specific cards. That's why Im curious. For me, catchError never gets triggered. I always receive paymentMethod object. Just tried with 4000 0000 0000 9987, 12/23, 123. image

image

macmatrix commented 4 years ago

Understood. So then stripe send a PM always and we can remove the catch error routine since we have other checked later on

deimantasa commented 4 years ago

Hey @macmatrix , have you tried plugging it in to GPay production? As I do have one issue - was wondering if you faced it before - https://github.com/jonasbark/flutter_stripe_payment/issues/127

macmatrix commented 4 years ago

Hi, no I did not try a real production transaction. Which error did you experienced?

deimantasa commented 4 years ago

Full issue here - https://github.com/jonasbark/flutter_stripe_payment/issues/127

I have a feeling, no-one tried to proceed with production Google Pay variation. I'm reaching out GPay and Stripe staff - both are very confused. Stripe is looking into it.

GPay Test env - works fine. Production - doesn't.

macmatrix commented 4 years ago

Ok thanks for exploring this. Stripe has a great support team in freenode. Good to ask there

IRC: Technical Help For Developers If you have technical questions, chat live with our developers in #stripe on freenode.

macmatrix commented 4 years ago

@zeromaro did you manage to find a way to make a real payment?

deimantasa commented 4 years ago

No, Google support seems to be completely off the ground - extremely slow and not really helpful. Got in touch with Stripe - much more helpful, but they don't officially support Flutter for now therefore as well, not much in depth suggestions. Therefore I just scrapped GPay from my app..

macmatrix commented 4 years ago

mmm that's not a good news. Does it work with Apple Pay? and with credit card?

deimantasa commented 4 years ago

Yes, ApplePay works perfectly. Credit Card too - however with credit card, there needs to be done extensive logic in the backend, because as I mentioned earlier - Stripe lib. doesn't detect immediately if CC is valid or not (only the basic identification). So in the backend you'll have to make some calls to understand if CC is correct and it can be charged, otherwise return an error to the user.

JoeHsiao commented 4 years ago

ApplePay sheet pops up in iOS Simulator but not on my real iPhone. Any idea?

Instead credit card form shows up in both places.

macmatrix commented 4 years ago

@JoeHsiao is Apple Pay enabled in your real iPhone?

Write this code when you try to make the payment and let me know what do you get

bool deviceSupportNativePay = await StripePayment.deviceSupportsNativePay();
bool isNativeReady = await StripePayment.canMakeNativePayPayments( ['american_express', 'visa', 'maestro', 'master_card']);
print(deviceSupportNativePay); print(isNativeReady);

JoeHsiao commented 4 years ago

@macmatrix

It was my mistake. I hadmerchantId in initState() in a wrong format. It was merchant.merchant.appname, and it should be merchant.appname. After correction, the ApplePay sheet shows up fine on my iPhone!

macmatrix commented 4 years ago

@zeromaro I have tested in production and it works fine with me for both Android and Apple, so you must have some bug somewhere maybe in the google payment set up

JoeHsiao commented 4 years ago

@macmatrix, is it a must to have a standard Stripe account as mentioned in the tutorial? I didn't do any of those because those platform terms are very confusing to me, and I still get a vendor account from Stripe that I can use in the javascript code.

My server is having trouble creating a payment intent, and I am wondering what the cause could be.

macmatrix commented 4 years ago

@JoeHsiao yes you need a standard account first of all because the stripe fee are much lower than a custom account and then because it simplify a lot your work: with a standard account you need to do basically nothing for the user onboarding. Lastly if you use a standard account you are not responsible for the transaction so you are limiting your responsabilies a lot

JoeHsiao commented 4 years ago

This is more a Stripe question, and the more I read the more I am lost. So what you suggest is I will use my existing Stripe account as a "marketplace", and I will create another Stripe account as "seller" in the marketplace, and set up the seller account in Connect, and in my app I will charge to the "seller" account?

macmatrix commented 4 years ago

@JoeHsiao if you want to sell services then you do not need a marketplace. you can simply create a stripe account and use it straight away. a marketplace is something like eBay. You Would act as eBay (the platform) and there would be different sellers selling their products and you would get a commission for every sales