This is the official Dodo Payments Flutter package (
dodopayments_checkout
on pub.dev). A separate, community-built package also exists, see
Community Projects.Checkout Sessions API
Create the checkout_url this SDK opens, from your backend.
Mobile Integration Guide
See how this fits into the full mobile payment flow.
dodopayments_checkout opens Dodo’s hosted checkout in
SFSafariViewController on iOS and a Chrome Custom Tab on Android — the same
native cores used by the standalone iOS and
Android SDKs. All checkout logic lives in
those native cores; the Dart layer passes the call through a typed
Pigeon channel. It holds no API key and
never calls the Dodo Payments API.
Requires Flutter 3.44+ / Dart 3.12+, iOS 16+, and Android minSdk 23.
Installation
1
Add the Dependency
pubspec.yaml
2
Register a Callback URL Scheme
- iOS
- Android
Add a URL type for your scheme in Then forward incoming URLs (e.g. via
ios/Runner/Info.plist:ios/Runner/Info.plist
app_links) into the SDK, because
SFSafariViewController cannot catch its own return URL:It’s safe to forward every URL here.
handleOpenURL only acts on URLs
matching your registered returnUrl and resolves false for anything
else.Usage
What the Result Means
CheckoutStatus
required
One of
succeeded, failed, cancelled, pending, expired.String?
Set when the return URL included one. Display it in the UI, don’t use it
to grant access. See Verify the Payment below.
String?
Set for subscription checkouts.
List<String>?
Set when the checkout includes license key products.
String?
Set when the checkout captures an email.
Map<String, String>
Every query parameter from the return URL, verbatim.
Verify the Payment
Webhooks
Dodo Payments calls your backend when a payment succeeds or a subscription activates.
Get Payment Detail
Look up
paymentId with your secret key to check its status directly.result.status alone.
Errors
start throws CheckoutException only for misuse or a platform failure.
A cancelled or declined payment is always a result, never an exception.
invalidCheckoutUrl(INVALID_CHECKOUT_URL): not acheckout.dodopayments.comsession URL.invalidReturnUrl(INVALID_RETURN_URL): not a valid absolute URL.alreadyInProgress(ALREADY_IN_PROGRESS): a checkout is already running.platformError(PLATFORM_ERROR): unexpected platform failure.
Abandoned Sessions
If the app is killed mid-checkout, recover the session on next launch and
reconcile it with your backend.
Related
Mobile Integration Guide
The same contract for Android, iOS, and React Native.
Community Projects
A separate, community-built Flutter package also exists.