Skip to navigation

Present checkout on Android

The Android SDK can present Afterpay checkout in four ways. Choose one based on how much of the checkout you want your server to own and which checkout features you need.

OptionHow it worksUse it when
Web RedirectYour server creates a checkout and returns its redirect URL. The SDK loads the URL and detects the result from your redirect URLs.You want the simplest integration and don’t need express checkout features.
Built-in UIThe SDK opens Afterpay’s checkout UI right away and asks your app for a checkout token while it shows a loading state.You want express checkout features, such as shipping address and shipping option callbacks.
Afterpay ButtonYour app passes the order details to the SDK, which returns a one-time virtual card. Your server doesn’t call the Afterpay API.You want a front-end-only integration that uses your existing card payments flow. Available in the US and Canada.
Cash App PayYour server creates a checkout with isCashAppPay: true, or the SDK creates one with the Afterpay Button. The customer approves the payment in Cash App.You want to accept Cash App Pay with your Afterpay merchant account. Available in the US.

The SDK refers to the first three options by version: Web Redirect is Checkout V1, Built-in UI is Checkout V2, and the Afterpay Button is Checkout V3. The versions appear in SDK method names, such as createCheckoutV2Intent.

Before you present checkout

  • Install the SDK.
  • For Web Redirect, Built-in UI, and Cash App Pay, configure the SDK with your merchant configuration. Without it, checkout closes right away with a cancellation status. The Afterpay Button uses its own configuration, described on its page.
  • Show a payment button that starts checkout when the customer taps it.

Server-side flow

Web Redirect and Built-in UI use the same flow. Your server creates the checkout with your merchant credentials, the SDK presents the checkout to the customer, and your server completes the payment. Your merchant credentials never leave your server.

Cash App Pay can use this flow too: your server creates the checkout, but Pay Kit sends the customer to Cash App instead of the SDK presenting checkout. For the steps, see Cash App Pay.

Request checkout POST /v2/checkouts Checkout token and URL Checkout token or URL Start checkout intent Activity result (order token) Complete order Capture or authorize payment App Afterpay SDK Merchant server Afterpay API

The Afterpay Button doesn’t use this flow. The SDK creates the checkout itself and returns a virtual card, which you process like any other card payment.