Payment failed alert

A declined payment raises a modal alert with a Retry button that runs a local action in the app, without opening the chat.

Goal

App → track('payment_failed', {'method': 'Visa •••• 4242'}) → an alert “Payment did not go through. Your Visa •••• 4242 was declined…” with Retry payment → the app’s open_checkout handler runs with { retry: true }.

Pieces

  • Rule “Payment failed alert” (sample): event payment_failed, Notify the app with channel alert, tap does not open the chat, tap action Run a local action open_checkout with args { "retry": true }, label “Retry payment”.
  • SDK: registerAction('open_checkout', (args, ctx) async { … }) navigates to checkout. KletsoNotificationHost shows the alert.

Steps

  1. Fire payment_failed from your payment result handler with the method name in properties.
  2. Register open_checkout in the app (the sample shows a snackbar; yours navigates).

Verify

  • Simulate payment_failed → app.notify with channel: alert and the local action in the payload.
  • App: the modal appears over the current screen; Retry payment runs your handler with origin: notification; the transcript records the local action.

Notes

  • Alerts stay until dismissed; use them for failures that need action, banners for information.
  • The same rule can also tick Agent speaks first so the chat has context (“I saw the payment failed. Want to try another card?”) when the user opens it later.

Last updated 2026-09-28 · Report an issue with this page