Skip to navigation

iOS UI components

The Afterpay iOS SDK includes prebuilt UIKit views that follow Afterpay brand guidelines. Use them to show Afterpay on product, cart, and checkout screens.

ComponentViewUse it to
Payment buttonPaymentButtonStart an Afterpay checkout.
LockupLockupViewShow the Afterpay logo, for example in a list of payment methods.
Price breakdownPriceBreakdownViewShow the installment amounts for a price on product and cart screens.
Checkout widgetWidgetViewShow the customer’s payment schedule, and update it when the order total changes.

Set the configuration first

The components read the merchant configuration that you set with Afterpay.setConfiguration(_:). Set it before you display any component. For details, see Configure the SDK.

LockupView, PriceBreakdownView, and WidgetView hide themselves when Afterpay.enabled is false, for example when the customer’s language isn’t supported in the configured region. PaymentButton doesn’t hide itself; it only blanks its artwork, so set paymentButton.isHidden = !Afterpay.enabled. Check Afterpay.enabled before you show your own Afterpay content, such as a heading or a payment method row, so that you don’t leave empty space.

Branding

The SDK chooses the brand from the configuration locale:

LocaleBrand
en_USCash App Afterpay
en_AU, en_CA, fr_CA, en_NZAfterpay
en_GBClearpay

This guide shows the Cash App Afterpay brand that US merchants display. In the US, the SDK displays the Cash App Afterpay lockup in place of the badge. BadgeView and CompactBadgeView aren’t supported for the Cash App Afterpay brand and stay hidden.

Color schemes

Set the colorScheme of a payment button or lockup, or the logoColorScheme of a price breakdown, to one of four palettes:

PalettePayment buttonLockupUse it on
.defaultBlack button, green Cash App logoGreen logo, black textLight backgrounds. This is the default.
.altCash App green button, black logoGreen logo, white textDark backgrounds
.darkMonoBlack button, white logoBlack logo and textLight backgrounds
.lightMonoWhite button, black logoWhite logo and textDark backgrounds
Checkout with Afterpay button, default palette Checkout with Afterpay button, alt palette Checkout with Afterpay button, darkMono palette Checkout with Afterpay button, lightMono palette

Use a static palette, or let the component switch palettes with light and dark mode:

// Always use the default palette.
paymentButton.colorScheme = .static(.default)
// Switch palettes with the system appearance.
lockupView.colorScheme = .dynamic(
lightPalette: .default,
darkPalette: .alt
)

Accessibility

The components set accessibility labels with the brand name. The price breakdown updates its text size and colors when the trait collection changes, so it supports Dynamic Type and dark mode.