Stripe - 与Cordova集成 - 无需网络连接即可加载应用程序

时间:2016-01-31 05:27:55

标签: cordova stripe-payments

我有一个cordova应用程序。我已经将Stripe与它集成在一起。 它很棒。 但是,当应用程序启动时没有网络连接 - 应用程序无法加载 - 我得到白屏。日志说 -

 Failed to instantiate module angular-stripe due to:
Stripe must be available as window.Stripe

如何启用我的应用程序加载条带 - 即使没有活动的互联网。可能会延迟加载条纹?

1 个答案:

答案 0 :(得分:0)

您可以在需要时延迟加载条带库。

let stripe = document.createElement('script');
stripe.src = 'https://checkout.stripe.com/checkout.js';
stripe.onload = function () {
  // What do to do when the library is loaded
};
document.getElementsByTagName('head')[0].appendChild(stripe);