Skip to main content

Overview

Set the PrimerCheckoutListener in order to receive different callbacks from Primer SDK. Callbacks can be used for managing the customer journey and trigger actions after specific events throughout the payment journey. See below for a breakdown of all callbacks supported within the Primer SDK.

onCheckoutCompleted

This method will be called when the payment has been completed, returning the payment’ data.
This method won’t be called when you are using PrimerPaymentHandling.MANUAL flow, or the PrimerSessionIntent.VAULT session intent.
KOTLIN

Parameters

onBeforePaymentCreated

This method will be called just before the payment gets created, and lets you decide whether you want to proceed with the payment creation.
This method will be called only when using the PrimerPaymentHandling.AUTO flow. Please note, that if you override this method, you must call one of the decisionHandler’s methods.
KOTLIN

Parameters

Example

KOTLIN

Example with Idempotency Key

KOTLIN

onAdditionalInfoReceived

This callback is trigger when the payment is not authorized as it’s an asynchronous alternative payment method, such as a voucher payment method.
This method will be called only when using the PrimerPaymentHandling.AUTO flow.
KOTLIN

Parameters

onTokenizeSuccess

This method will be called with the when the payment method has been is tokenized, returning the payment method’s tokenization data. Use the token to create a payment on your backend. Make sure that you call the decisionHandler once your operation has been completed.
This method will be called when you are using PrimerPaymentHandling.MANUAL flow, or the PrimerSessionIntent.VAULT session intent.
KOTLIN

Parameters

Example

KOTLIN

onResumeSuccess

This method will be called providing a resumeToken so you can resume the payment.
This method will be called when you are using PrimerPaymentHandling.MANUAL flow and when the payment is in a state.
KOTLIN

Parameters

Example

KOTLIN

onResumePending

This callback is trigger when the payment is not authorized as it’s an asynchronous alternative payment method, such as a voucher payment method.
This method will be called only when using the PrimerPaymentHandling.MANUAL flow.
KOTLIN

Parameters

onBeforeClientSessionUpdated

This method will be called to notify you that the client session will be updated, e.g. a surcharge needs to be applied when a payment method has been chosen.
KOTLIN

onClientSessionUpdated

This method will be called to notify you that the client session has been updated, e.g. surcharge has been applied when a payment method has been chosen.
KOTLIN

Parameters

onFailed

This method will be called when an error occurs. It may return PrimerCheckoutData if the error occurs after the payment creation.
Please note, that if you override this method, you must call the errorHandler to finalize the flow.
KOTLIN

Parameters

Example

KOTLIN

onDismissed

This method will be called to notify you that the Primer SDK has been dismissed.
KOTLIN