onReady not firing?
See original GitHub issueWe’re using Hosted Forms and I’m seeing an issue for ~5% of our users where the payment form does not seem to load.
I am hiding the form via CSS while it is loading and then, when the onReady event fires, the form is displayed. This works fine for the majority of our users, but for about 5%, the onReady event does not seem to fire.
Here’s part of the view code:
<%= javascript_include_tag "https://js.braintreegateway.com/js/braintree-2.19.0.min.js" %>
<script>
braintree.setup("<%= Braintree::ClientToken.generate %>", "custom", {
id: "braintree-form",
onReady: function(event) {
RS.braintree.displayForm();
},
...
The call to RS.braintree.displayForm()
points here:
displayForm: function() {
this.formLoaded = true;
$('#payment-wrapper').fadeIn('fast');
$('#payment-loading').hide();
},
A little more info:
On document.ready
, I set an interval which checks every 1/2 second to see if this.formLoaded
has been set to true
. If after 50 seconds, it has not been set, it notifies me and the customer that the payment form could not be loaded and that they should try refreshing the page.
On occasion, they will refresh the page and it works. They’ll be able to see the form and submit a payment. More often, I can see in the logs that they refresh the page multiple times without success. The 5% of users this affects is all over the place when it comes to browser, OS, and geographic location.
I’m at a bit of a loss as to what could be causing this. Is it an issue with my code?
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (4 by maintainers)
Top GitHub Comments
Why close this when taken out of band? I’m still interested in reading about the conclusion, since I am experiencing a similar issue.
We’ve released a beta of our next major version. One predominant feature of this new version is that we no longer rely on forms. All SDK actions are programmatically triggered and manually bound. Hopefully this helps with common single page application use cases.
Here are some links to our official documentation:
Setup for v3 Migrating from v2 to v3
Please send any beta feedback to js-sdk-beta@braintreepayments.com