Running Stripe offline

Running a Stripe payment control with my app is fine when i am running online.
But if i run offline (no internet), i get this error:
Uncaught ReferenceError:
StripeCheckout is not defined. line 133 column 21

Is there any way to still run it offline without showing this error?

Thanks

Stripe, by its very nature, requires that you be online.

You could check if typeof(StripeCheckout) === “undefined” and recover more gracefully than throwing an error.

Thanks for your reply.
Running online only will be a problem as many of my app users are in remote areas and many run my app in offline mode until they are in a coveraged area.
I don’t want the Stripe control stopping the entire app from running if internet is not available.

Are there any ways to get around this one?

Thanks

Hi

If it is not working offline, why do you want to use it offline?

What about this:
In the app you just show a picture of stripe (or a button). When the user chooses it, you check first, if stripe is available as Leader suggested you. If not online you show a message “Sorry, not online”, if online you show a form with stripe functions on it. :slightly_smiling_face:

Good luck :+1:

Thanks for your reply.

I should have been more clear. The message:
Uncaught ReferenceError:
StripeCheckout is not defined. line 133 column 21
shows when the app first loads.
The first form won’t load.

If i start the app with internet enabled (online), i don’t get the Stripe error.
If i start the app with no internet (offline), then the Stripe error shows and the app won’t load.

So i still need to be able to load the app when there is no internet when the app is first opened.

So you should not put the stripe control in the first form

The Stripe control is on a different form, not first form.
It is not visible until a payment form is shown.

:roll_eyes: Yeah, I just checked. NSB is running some code before opening any form.

stripe

I have no idea how a NSB developper can prevent this…

Just a thought, but could you put the Stripe portion of your app in a different app and only call this when it is needed and after testing to see if you are running online?

John

If you don’t include the strip control using the AppStudio IDE, then the initialization will not be added by AppStudio. You could use jQuery to add the control on the fly after you determine you are online.

I see what you’re saying. We’ll put something into the next build of AppStudio (coming soon) to deal with this.