Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe.presentPaymentSheet() return an error #119

Closed
loicparent opened this issue Nov 5, 2021 · 4 comments
Closed

Stripe.presentPaymentSheet() return an error #119

loicparent opened this issue Nov 5, 2021 · 4 comments

Comments

@loicparent
Copy link

Hello,

I try to setup a payment subscription using this plugin.

Description of the issue:

I retrieve correctly (from the server) the 3 keys required for the function "Stripe.createPaymentSheet".
But, when I log this function, I see nothing in the console.

const paymentSheet = await Stripe.createPaymentSheet({
  paymentIntentClientSecret: paymentIntent,
  customerEphemeralKeySecret: ephemeralKey,
  customerId: customer
});

When I call then this function "Stripe.presentPaymentSheet", I have an error returned:

Uncaught (in promise): TypeError: this.paymentSheet.present is not a function
at StripeWeb.presentPaymentSheet (web.js:37)
at index.js:196
…

Could someone helps me to understand what's wrong?

More information:

  1. Version of Ionic: 6.18.0
  2. Version of Capacitor: 3.2.5
  3. Version of the Stripe-capacitor plugin: 3.4.0
  4. Version of Stripe API: 2020-08-27
  5. Backend: WordPress and so PHP library of Stripe
  6. I need to use this plugin on: Android & IOS (it's better if I can test it on browser too)

Thanks and have a nice day
Loïc

@hideokamoto
Copy link
Contributor

Sorry to delay the reply.
Does the error occur in non-subscription payments?
Or just occur with only a subscription payment?

Thanks.

@loicparent
Copy link
Author

loicparent commented Nov 17, 2021

Hi @hideokamoto,

Thanks for your reply!

I tried several things and the error appears because I have tested on the browser using ionic serve (my mistake).
When I try on the ios simulator, I don't have this error anymore.

However, after the function Stripe.createPaymentSheet(), when I call the function Stripe.presentPaymentSheet(), the modal appears a short time with a loader but then disappears directly. I can see in the console that the event PaymentSheetEventsEnum.Failed is called too.

Demo: link to video

So very similar to this issue: #106

Do you know what I have to change?

I am gradually approaching :)

Thanks,
Loïc

@loicparent
Copy link
Author

Hi @hideokamoto,

Ok I see what was wrong. I used the secretKey (sk_test…) instead of the publicKey (pk_test…).
After changing this, I have no more error, the payment modal appears correctly and the payment process works fine.

Now I will try the ApplePay and GooglePay tools :)

Regards

@rdlabo
Copy link
Member

rdlabo commented Jan 19, 2022

@loicparent Did you adapt this plugin for production? If yes, please tell us what app. Please help us to develop this plugin in 2022.
#145
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants