Skip to navigation

iOS SDK

The Afterpay iOS SDK presents Afterpay checkout in your iOS app and provides prebuilt UI components, such as the payment button and price breakdown. It also lets you accept Cash App Pay through your Afterpay merchant account.

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 Afterpay checkout. Supports standard and express checkout.
  • Afterpay Button: the SDK creates the checkout from your app and returns a one-time virtual card. No server integration. The SDK calls this Checkout V3.
  • Cash App Pay: the customer approves the payment in Cash App.
  • 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 Afterpay brand guidelines. Outside the US, they show Afterpay branding, or Clearpay branding for UK merchants. US merchants see Cash App Afterpay branding.

  • Payment button: PaymentButton starts an Afterpay checkout.
  • Lockup: LockupView shows the Afterpay logo.
  • Price breakdown: PriceBreakdownView shows the installment amounts for a price.
  • Checkout widget: WidgetView shows the payment schedule and updates when you send it a new total.

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

Requirements

  • iOS 12.0 or later
  • Swift 5.7 or later
  • Xcode 14.0 or later
WebView support

Afterpay checkout runs in a WKWebView that requires iOS Safari 13.4 or later. The SDK runs on iOS 12, but your app must hide Afterpay from customers on earlier versions. For example, wrap your Afterpay views in an if #available(iOS 13.4, *) check.

Get started