Configure the provider
SuqoProvider and per-call options, safe-area insets, and the package's exports.
Options
Every option can be set once on SuqoProvider or per call on SuqoCheckout.open. open takes your BuildContext first, then these as named arguments; each falls back to the nearest SuqoProvider, then to the package default.
| Option | Default | Notes |
|---|---|---|
sessionId | — | Required, per call only. The checkout session to pay, e.g. cks_9f2c41a8. |
mode | SuqoMode.sandbox | live → app.suqo.ai, sandbox → test.suqo.ai. |
baseUrl | — | Where SUQO's checkout is served from. Overrides mode. |
checkoutPath | /c/:id | The route, with :id for the checkout session id. |
title | Secure payment | Screen header. The amount and seller are rendered by the page. |
loadingLabel | Loading secure checkout | The line under the spinner. Pass '' for a spinner alone. |
debug | false | Turns on this package's redacted logging. |
onEvent | — | A debug stream for your own logs. Not a payment signal. See Debug with events. |
SuqoProvider is optional, and holds configuration and nothing else. Unlike the React Native SDK's provider, which owns the single checkout sheet, there is nothing for it to own — Flutter's Navigator already gives a screen that returns a result. Mount it only to state defaults once:
SuqoProvider(
mode: SuqoMode.live,
title: 'Pay with SUQO',
debug: kDebugMode,
onEvent: (event) => debugPrint('suqo: ${event.type}'),
child: MaterialApp(home: MyApp()),
)A per-call value wins over the same option on the provider, and with no provider mounted the package defaults apply.
baseUrl beats a per-call mode. baseUrl always overrides mode, wherever each was set. With SuqoProvider(baseUrl: 'https://staging.example') mounted, open(context, sessionId: id, mode: SuqoMode.live) still loads staging. To switch environments per call, pass baseUrl per call too, or keep baseUrl off the provider.Safe-area insets
There is no insets option. The React Native SDK needs one because React Native has no built-in safe-area values; Flutter has MediaQuery.viewPadding, which is the real thing, so the screen reads it and there is nothing to pass.
Environments and exports
| You are testing against | Set | Served from |
|---|---|---|
| Sandbox data | SuqoMode.sandbox | https://test.suqo.ai |
| Live data | SuqoMode.live | https://app.suqo.ai |
Sandbox is the default on purpose: an app that names neither mode nor baseUrl cannot take a live payment by accident. The session and the environment must agree — a session created against sandbox is not found on live.
Pass baseUrl to go somewhere else entirely, such as a staging mirror or a local mock server. A non-empty baseUrl overrides mode, and must be a valid http(s) URL or open throws SuqoConfigError. An empty or whitespace-only baseUrl does not throw: it falls back to mode, so a missing config value quietly loads sandbox (or live, if mode says so). An empty per-call baseUrl also hides the provider's baseUrl — resolution goes straight to mode, not to the provider.
import 'package:suqo_checkout/suqo_checkout.dart'
show
SuqoCheckout, SuqoProvider,
SuqoOutcome, SuqoSuccess, SuqoFailure, SuqoClosed,
SuqoMode, SuqoFailureStatus, SuqoUnavailableReason,
SuqoEvent, SuqoEventSink, ReturnParams,
SuqoConfigError,
kLiveOrigin, kSandboxOrigin, kDefaultCheckoutPath, resolveBaseUrl,
suqoCheckoutVersion;kLiveOrigin / kSandboxOrigin are the two origins mode picks between. resolveBaseUrl is the same resolution open runs internally (baseUrl, else mode, defaulting to sandbox), exported for anywhere else in your app that needs to build a SUQO URL consistently. SuqoConfigError is what open throws for each of its three failure reasons — catch it with on SuqoConfigError rather than matching its message. suqoCheckoutVersion is the package version as published.