Skip to main content
The Forte Payments widget emits client-side CustomEvents that you can listen to on your page. Use these to trigger post-payment UX β€” such as showing a success message, refreshing inventory, or dismissing a modal β€” without polling.
Client-side events are available in widget mode only. They are not emitted in redirect mode. For authoritative payment confirmation in both modes, use webhooks.

Event Types

Emitted when the user exits the widget from the success screen after completing a VDG purchase β€” whether they press β€œDone” or click the close button.When to act: This is a UI signal that the user has seen the success confirmation. For authoritative delivery confirmation β€” especially before delivering a Virtual Digital Good β€” wait for the payment_approved webhook.
Emitted when the user closes the widget from any screen that is not the success screen β€” including mid-flow abandonment, after a payment decline, or after session expiry.Use this event to handle clean-up UX, such as re-showing a β€œBuy” button or dismissing a modal.

Event Listener Snippet

Add event listeners before the script that loads the Forte widget.
window.addEventListener('FortePaymentsBuyVdaSuccess', function(event) {
  console.log('Payment intent ID:', event.detail.paymentIntentId);
  // e.g. show success toast, refresh inventory UI
});

window.addEventListener('FortePaymentsWidgetClosed', function(event) {
  console.log('Widget closed. Intent ID:', event.detail.paymentIntentId);
  // e.g. re-show the Buy button, dismiss modal
});
Each event’s detail object includes the paymentIntentId associated with the session.

Authoritative Payment Confirmation

Client-side events confirm that the user closed the widget β€” not that the payment has settled. For authoritative confirmation before delivering a Virtual Digital Good, always rely on the server-side payment_approved webhook.

Webhooks

Set up server-side webhook subscriptions for payment status events