Skip to main content
Headless Universal Checkout has changed to solidify the integration experience and make the interfaces clearer and more consistent. Below is a summary of the changes and examples of how to migrate to this new integration, however we recommend you consult the full documentation during integration.

Starting Headless Universal Checkout

Like before, you still prepare the PrimerHeadlessUniversalCheckoutListener and start headless universal checkout with your client token.onAvailablePaymentMethodsLoaded now returns a list of payment methods with improved functionality.Instead of just a string, each payment method returned contains the following:
  • paymentMethodType a unique string identifier for the payment method.
  • paymentMethodManagerCategories a list that defines the payment method managers that can be used with this payment method (i.e. NATIVE_UI or RAW_DATA).
  • [Optional] requiredInputDataClass this is provided when paymentMethodManagerCategories contains RAW_DATA and indicates the type of data that should be captured for the payment method.
  • supportedPrimerSessionIntents a list of PrimerSessionIntent which defines what intents can be used with this payment method (i.e. CHECKOUT or VAULT).
See an example below:
KOTLIN

Building your UI

Before when building your UI, you could create your own buttons using headlessUniversalCheckout.makeView like in the example below:
KOTLIN
You can now import the PrimerHeadlessUniversalCheckoutAssetsManager that provides payment method assets per payment method type. See below:
KOTLIN
The payment method asset contains the following:
  • paymentMethodType a unique string identifier for the payment method.
  • paymentMethodName a user friendly English localized string identifier for the payment method (e.g. Google Pay)
  • paymentMethodLogo an instance of the PrimerPaymentMethodLogo
  • paymentMethodBackgroundColor an instance of the PrimerPaymentMethodBackgroundColor
The PrimerPaymentMethodLogo holds Drawable objects for different scenarios
  • [Optional] colored a Drawable to be used anywhere
  • [Optional] dark a Drawable to be used in dark mode
  • [Optional] light a Drawable to be used in light mode
The PrimerPaymentMethodBackgroundColor holds @ColorInt objects for different scenarios[Optional] colored a @ColorInt to be used anywhere [Optional] dark a @ColorInt to be used in dark mode [Optional] light a @ColorInt to be used in light mode With the above images and colors you can build your own payment method buttons 💪

Handling Payment Methods

Before, you had to call showPaymentMethod directly for some payment methods while having managers for others.Now each payment method belongs to a payment method manager, as indicated by paymentMethodManagerCategories on the list of available payment methods.

Native UI Manager

Used for any payment method that needs to present its own UI, like Google Pay. See example integration below:
KOTLIN

Raw Data Manager

Used for payment methods that require you to pass data to the SDK, for example for cards. As before, you have to render your own input elements and capture the required data before finally calling submit on the raw data manager. See example integration below:
KOTLIN

Other changes

PrimerHeadlessUniversalCheckoutUiListener addition

We have created new listener in order to separate payment events and UI ones. You can attach a listener by calling PrimerHeadlessUniversalCheckout.current.start(uiListener = ).

PrimerHeadlessUniversalCheckoutListener updates

Some listener functions have been renamed.Some listener functions have been removed and moved to different classes.Resume handler updates Some listener functions provide a decision handler.You can process the data provided and once you’re ready you can call the decision handler with your relevant decision. Once you do, the SDK will continue the flow. We have changed the handler class name and signature of following functions have changed:

Before v2.17.0

KOTLIN
KOTLIN

After 2.17.0

KOTLIN
KOTLIN
Miscellaneous changes
Models that need to be passed to the SDK when using Raw Data Managers have changed structures and naming:

Before v2.17.0

KOTLIN
KOTLIN
KOTLIN
KOTLIN

After 2.17.0

KOTLIN
KOTLIN
KOTLIN
KOTLIN