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

@capacitor-community/stripe not working on web with Ionic/react #328

Open
1 task
Jayrajrodage opened this issue Dec 9, 2023 · 8 comments
Open
1 task
Labels
enhancement New feature or request payment

Comments

@Jayrajrodage
Copy link

Jayrajrodage commented Dec 9, 2023

Platform

  • Web

Describe the bug
I am getting this error "Failed to fetch dynamically imported module": and this warning "Capacitor WebPlugin "Stripe" config object was deprecated in v3 and will be removed in v4."

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
Screenshot (126)
Screenshot (127)

Additional context
i Initialized the plugin as per the official '@capacitor-community/stripe' docs https://stripe.capacitorjs.jp/docs/react/
versions
"@capacitor/core": "^5.5.1",
"@capacitor-community/stripe": "^5.4.1",
"@ionic/react": "^7.5.5",

Please help me resolve this issue @rdlabo

@coachaaron
Copy link

Any update here? Having similar issue....

@toddaa
Copy link

toddaa commented Mar 19, 2024

Same exact problem here. Any insight would be much appreciated.

@rdlabo
Copy link
Member

rdlabo commented Mar 26, 2024

Currently, vite is not supported; either stop using vite or use the Stripe object without reactProvider.

import { Stripe } from '@capacitor-community/stripe';

@rdlabo rdlabo closed this as completed Mar 26, 2024
@rdlabo rdlabo reopened this Mar 26, 2024
@rdlabo
Copy link
Member

rdlabo commented Mar 26, 2024

Hi, @hideokamoto . Do we plan to support Vite in the React Provider, wondering if it should be Deprecated or not?
Tell us what you think.

Note: React with using the Stripe object will work fine.

@hideokamoto
Copy link
Contributor

I would be very happy if we could use this provider component in the React application built by Vite. However, I'm not well-versed in developing custom components for the Vite environment.

Therefore, we would appreciate get more time for working on this issue. It's possible that we need to gather more detailed context to better comprehend what is happening.

@eofcharma
Copy link

Hi, @hideokamoto . Do we plan to support Vite in the React Provider, wondering if it should be Deprecated or not? Tell us what you think.

Note: React with using the Stripe object will work fine.

Hello

On this quote, "Note: React with using the Stripe object will work fine." Can you elaborate what setup do you have with react?

@shiv19 shiv19 added the payment label Nov 22, 2024
@FredericoGauz
Copy link

Hi, @hideokamoto . Do we plan to support Vite in the React Provider, wondering if it should be Deprecated or not? Tell us what you think.
Note: React with using the Stripe object will work fine.

Hello

On this quote, "Note: React with using the Stripe object will work fine." Can you elaborate what setup do you have with react?

I would appreciate guidance on that as well. Thank you for the plugin!

@ottojaa
Copy link

ottojaa commented Dec 13, 2024

Unfortunately at the moment I think it's very difficult (or impossible) to make this plugin work with vite without updates in the stripe-pwa-elements.

Tried couple things (to no avail):

  1. I tried using vite-plugin-static-copy to include the assets from stripe-pwa-elements/dist/esm in the build assets, and while this enabled the app to launch, the Stencil components were not properly defined (errors like can't read property $hostElement of undefined). I didn't have time to dig deep into this, but seemed like the copied assets were "not used" by the @capacitor-community/stripe plugin as I additionally made patch that added logging to the copied assets, where I could observe that the dynamically created components such as stripe-payment-sheet were correctly created, but seemingly not used by this plugin. Not sure how to connect these two.

  2. Tried rewriting the CapacitorStripeProvider without using the one provided by this library, only using the Stripe object provided by this plugin -> Failed to fetch dynamically imported module

Some additional information that may be useful:

I had this exact same issue with ionic-team/pwa-elements earlier on (which made upgrade to Vite impossible), and they were able to make their package work with Vite in their 3.2.0 release (which is why I gave updating back to Vite another shot). Seeing that that specific change didn't do much more than upgrade the stencil version, might be worth trying to update the stencil version used by stripe-pwa-elements?

Unfortunately I ran out of time and ultimately had to revert to webpack for the time being, which is a shame because Vite's DX is a huge improvement over webpack / CRA. If I have more time at some point, I could try and see if the package upgrade does the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request payment
Projects
None yet
Development

No branches or pull requests

9 participants