This is the official Android checkout SDK (
com.dodopayments.api:checkout-android),
for opening Dodo’s hosted checkout. It is distinct from the
backend Kotlin SDK, which calls the Dodo
Payments API from your server.Checkout Sessions API
Create the
checkout_url that this SDK opensMobile Integration Guide
Best practices for mobile checkout flows
androidx.browser.customtabs. It contains zero networking code and holds no API key. You pass a checkoutUrl from your backend’s checkout session, and the SDK returns a typed CheckoutResult when the user completes or abandons the flow.
Requirements: minSdk 23, Kotlin, Java 17.
Installation
1
Add the Dependency
build.gradle.kts
2
Register a Callback URL Scheme
Set your callback scheme as a Gradle manifest placeholder. The library’s own
manifest already declares the redirect activity’s intent filter using the
The value must match the scheme in
${dodoCallbackScheme} token, so this one property is the entire setup cost —
you add no manifest XML:build.gradle.kts
CheckoutParams.returnUrl (e.g.
myapp://checkout/return).If you omit the placeholder entirely, the build fails immediately with an
unresolved-placeholder error rather than failing silently at checkout time. If
you set it but it doesn’t match
returnUrl’s scheme, DodoCheckout.start
throws PLATFORM_ERROR before presenting anything.Usage
The SDK supports two invocation styles.- Launcher (Recommended)
- Suspend Function
Register the contract with
registerForActivityResult, then launch it: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
Listen for payment events in real time
Get Payment Detail
Query the payment status on demand
CheckoutResult.status alone.
Errors
DodoCheckout.start throws CheckoutError only for misuse or a platform
failure. Read the code from CheckoutError.code:
INVALID_CHECKOUT_URL: not acheckout.dodopayments.comsession URL.INVALID_RETURN_URL: not a valid absolute URL.ALREADY_IN_PROGRESS: a checkout is already running.PLATFORM_ERROR: unexpected platform failure, including areturnUrlwhose scheme doesn’t match yourdodoCallbackSchemeplaceholder.
CANCELLED or
FAILED), never a thrown error. With the launcher style, validation errors
throw out of launcher.launch(...).
Abandoned Sessions
If the app is killed or the user force-stops it during checkout, the SDK stores the session locally. On the next app launch, check for an abandoned session and reconcile it with your backend:abandoned.createdAt is an epoch timestamp in milliseconds.
Related
Mobile Integration Guide
Best practices for mobile checkout flows
Kotlin SDK
Backend SDK for server-side operations