Starting Headless Universal Checkout
Like before, you still prepare thePrimerHeadlessUniversalCheckoutListener
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
orRAW_DATA
).- [Optional]
requiredInputDataClass
this is provided whenpaymentMethodManagerCategories
containsRAW_DATA
and indicates the type of data that should be captured for the payment method. supportedPrimerSessionIntents
a list ofPrimerSessionIntent
which defines what intents can be used with this payment method (i.e.CHECKOUT
orVAULT
).
KOTLIN
Building your UI
Before when building your UI, you could create your own buttons usingheadlessUniversalCheckout.makeView
like in the example below:KOTLIN
PrimerHeadlessUniversalCheckoutAssetsManager
that provides payment method assets per payment method type. See below:KOTLIN
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 PrimerPaymentMethodLogopaymentMethodBackgroundColor
an instance of thePrimerPaymentMethodBackgroundColor
PrimerPaymentMethodLogo
holds Drawable
objects for different scenarios- [Optional]
colored
aDrawable
to be used anywhere - [Optional]
dark
aDrawable
to be used in dark mode - [Optional]
light
aDrawable
to be used in light mode
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 callshowPaymentMethod
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 callingsubmit
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 callingPrimerHeadlessUniversalCheckout.current.start(uiListener = )
.PrimerHeadlessUniversalCheckoutListener updates
Some listener functions have been renamed.Before v2.17.0 | After 2.17.0 |
---|---|
fun onResumeSuccess | Renamed to onCheckoutResume |
fun onAdditionalInfoReceived | Renamed to onCheckoutAdditionalInfoReceived |
Before v2.17.0 | After 2.17.0 |
---|---|
func onPreparationStarted(paymentMethodType: String) | Moved to PrimerHeadlessUniversalCheckoutUiListener |
func onPaymentMethodShowed(paymentMethodType: String) | Moved to PrimerHeadlessUniversalCheckoutUiListener |
Models that need to be passed to the SDK when using
Raw Data Managers
have changed structures and naming: