capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor
https://capacitor-community-stripe.netlify.app/
MIT License
196 stars 77 forks source link

createPaymentFlow does not work without defining a customerId #162

Closed tanrax closed 2 years ago

tanrax commented 2 years ago

If customerId is null or not present, it does not work. However, if an empty string is assigned, it works again.

Does not work

const results = await Stripe.createPaymentFlow({
  paymentIntentClientSecret: paymentIntent.client_secret,
  customerEphemeralKeySecret: paymentIntent.id
});
await Stripe.presentPaymentFlow();

Work.

const results = await Stripe.createPaymentFlow({
  paymentIntentClientSecret: paymentIntent.client_secret,
  customerEphemeralKeySecret: paymentIntent.id,
  customerId: ''
});
await Stripe.presentPaymentFlow();
rdlabo commented 2 years ago

Thanks for issue. I did not envision a case where customerEphemeralKeySecret was available and customerId could not be obtained. Only a simple check is performed here.

iOS: https://github.com/capacitor-community/stripe/blob/master/ios/Plugin/PaymentFlow/PaymentFlowExecutor.swift#L16-L19 Android: https://github.com/capacitor-community/stripe/blob/master/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.java#L43

What is the specific use case where customerId does not exist?

tanrax commented 2 years ago

According to the documentation, the customer is optional with the following description:

customer optional

ID of the Customer this PaymentIntent belongs to, if one exists.
Payment methods attached to other Customers cannot be used with this PaymentIntent.

I assume, and correct me if I am wrong, that a payment can be made without a customer.

rdlabo commented 2 years ago

@tanrax Oh, you are right. PaymentSheet and PaymentFlow must customer optional. I will fix as soon as possible.

rdlabo commented 2 years ago

@tanrax I released v3.6.0-0. Please try this.

npm i @capacitor-community/stripe@3.6.0-0

Thanks.

tanrax commented 2 years ago

Thanks to you for such speed and professional workflow :)

rdlabo commented 2 years ago

@tanrax Hi, thanks for quick response! Did you use this plugin for production? If yes, please tell us what app. This help development this plugin.

👉 https://github.com/capacitor-community/stripe/issues/145

Thanks.

tanrax commented 2 years ago

Not at the moment, we won't release the first beta for another month. In any case, I will keep you informed. Thank you very much, from the bottom of my heart, for the good support.

rdlabo commented 2 years ago

@tanrax I can't wait for your app to be released and used by the masses! I'm looking forward to hearing from you.