Debug with events
The onEvent stream and the unavailable event in the SUQO Flutter SDK.
onEvent is a debug stream
Pass onEvent to SuqoCheckout.open or to SuqoProvider to see what the screen is doing. It is not a payment signal — the awaited outcome is that.
Every SuqoEvent carries sessionId and a type; the other fields are null unless the row below names them.
type | When |
|---|---|
open | open was called and the screen is about to show. |
alive | The document loaded and ran scripts. |
ready | The payment block is on screen. |
resize | height — reported, but nothing here is sized by it. |
gateway | The page is navigating this WebView to a gateway. |
handoff | scheme — a bank/wallet deeplink was handed to the OS. |
handoff_failed | scheme — the OS had nothing registered to open it. intent for an Android intent URI — declare its scheme= target, not intent. |
load_timeout | stage ('alive' or 'ready') — a load deadline elapsed. |
load_error | The WebView itself failed to load the page. |
unavailable | reason — the session cannot be paid at all. See below. |
settled | outcome — the screen's one outcome, mirroring what open completed with. |
Events are delivered after the frame that mounts the screen, never during it, so a handler that calls setState is safe.
Events handed to you carry the real sessionId, since it is your own identifier. Redaction applies to what this package prints itself: with debug: true, its log output scrubs session ids, URLs and gateway params.
unavailable is an event, not a callback
When the session cannot be paid at all, the page renders its own explanation and the buyer dismisses, which completes as SuqoClosed. The unavailable event is how you find out why:
await SuqoCheckout.open(
context,
sessionId: sessionId,
onEvent: (event) {
if (event.type == 'unavailable') {
debugPrint('session not payable: ${event.reason!.name}');
}
},
);SuqoUnavailableReason | Means |
|---|---|
notFound | No such session at this origin (often the wrong environment). |
expired | The session's window has passed. |
spent | It has already been paid. |
noCustomer | It was created without a customer assigned. |
noMethods | The seller has no payment method the buyer can use. |
loadFailed | The block could not load its own data. |
It is usually a sign your own integration created the session wrong — most often an expired or already-used id, a sandbox session opened in live mode, or noCustomer, which this package has no field to supply after the fact.