Cordova-stripe-plugin in browser?


#1

I have a ionic app (current version) that I have built and its now running on my local dev server just fine. I needed to add Strip Payment integration so I included the cordova-stripe-plugin (https://github.com/zyra/cordova-plugin-stripe#module_stripe). I can not test because ionic serve doesn’t include the cordova.js, etc.
I have looked high and low and can not find any definitive information on how to run/build this app for mobile browser/web/PWA. There is conflicting information. Can you please clarify and provide the command lines to run to build/run and Ionic app that I can deploy to my webserver. Also, what about testing? will I have to rebuild every time I need to make a change or is there a some sort of live reload I can use? Thanks for your help.


Ionic Browser Platform
#2

Can’t you just build for production, and host that on your web server? Building for PWA is kind of a mess, but you don’t really have a PWA, do you? Or do you have service workers? It sounds as though you want a web page that can use Cordova plugins.


#3

Correct @AaronSterling. Its not really a PWA at this point. The only cordova plugin I am using is the strip payments as indicated in my OP.
Can you share the steps and commands to build for production?
Do I need to add the browser platform? Do I add an import to all my pages’ .ts or just the page dealing with stripe payments?
I don.t mean to sound sophomoric but I haven’t been able to find info in the docs or anywhere really.


#4

If you’re in CLI 3.x, ionic cordova build browser --prod gets you a production build. You may want other flags too, depending on your setup. See here:

Edit: also yes, you need to add the browser platform, use ionic cordova platform to do that, docs are close to the above link.


#5

Be aware that the browser platform is not really support on Ionic, and only works “by accident”.
If you want to build for browsers, I suggest you look into finding a pure JS library that implements Stripe instead of the Cordova plugin. Seems more future proof.