Skip to navigation

Android SDK

The Afterpay Android SDK presents Clearpay checkout in your Android app and provides prebuilt UI components, such as the payment button and price breakdown. With a UK configuration, the SDK shows Clearpay branding. Its APIs use the Afterpay name, for example Afterpay.setConfiguration.

What the SDK includes

Checkout

The SDK presents checkout in these ways:

  • Checkout V2 (recommended): the SDK shows a loading screen, asks your app for a checkout token from your server, and opens Clearpay checkout. Supports standard and express checkout.
  • Checkout V1 (deprecated): your server returns a checkout URL, and the SDK loads it in a web view. Supports standard checkout only.

UI components

The SDK includes prebuilt components that follow Clearpay brand guidelines. With a UK configuration, they show Clearpay branding.

  • Payment button: AfterpayPaymentButton starts a Clearpay checkout.
  • Logo: Shows the Clearpay logo.
  • Price breakdown: AfterpayPriceBreakdown shows the installment amounts for a price.
  • Checkout widget: AfterpayWidgetView shows the payment schedule and keeps it in sync with the order total.

For branding, color schemes, and accessibility, see Android UI components.

Requirements

  • Android 7.0 (API level 24) or later
WebView support

Clearpay checkout runs in a WebView that requires specific browser features. The SDK runs on API level 24, but checkout depends on the WebView version installed on the device, which is independent of the Android version. If your app knows the WebView version, show Clearpay only on supported versions.

Get started