diff --git a/docs/events.md b/docs/events.md index 6a366b30cf5a3ceedc5377eb93073929a45ddb1c..704d79576beb2aa93ac51925310ea43df3a8cc1d 100644 --- a/docs/events.md +++ b/docs/events.md @@ -22,6 +22,9 @@ Example code: This event is triggered when the form has completed reloading and is ready for use (Stripe element visible etc.). It is useful for clearing any "loading" indicators and unfreezing form elements. +### crmStripeBillingFormReloadComplete +This event is triggered when the form has completed reloading, is ready for use and the selected payment processor is Stripe. + ### crmBillingFormReloadFailed This event is triggered when the form fails to complete reloading and is NOT ready for use. It usually happens if there is a problem (such as a network issue) when loading the Stripe elements. diff --git a/js/civicrm_stripe.js b/js/civicrm_stripe.js index 6596cfc2215b1851b7a18cce468c1ef0ad44dac6..cdbe176c29eed89a490363413d46b103d5853208 100644 --- a/js/civicrm_stripe.js +++ b/js/civicrm_stripe.js @@ -289,6 +289,7 @@ debugging("Script loaded and executed."); loadStripeBillingBlock(); triggerEvent('crmBillingFormReloadComplete'); + triggerEvent('crmStripeBillingFormReloadComplete'); }) .fail(function() { stripeLoading = false; @@ -299,7 +300,7 @@ else { loadStripeBillingBlock(); if (checkPaymentElementsAreValid()) { - triggerEvent('crmBillingFormReloadComplete'); + triggerEvent('crmStripeBillingFormReloadComplete'); } else { debugging('Failed to load payment elements');