Skip to main content

Overview

Set the PrimerHeadlessUniversalCheckoutDelegate in order to receive 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.

primerHeadlessUniversalCheckoutDidCompleteCheckoutWithData

This method will be called with the when the payment has been completed, returning the payment’s data.

⚠️ This method won’t be called when you are using manual payment handling, or the vault manager.
SWIFT

Parameters

Example

SWIFT

primerHeadlessUniversalCheckoutDidLoadAvailablePaymentMethods

This method will return the payment methods that should be displayed based on the current client session data.
SWIFT

Parameters

primerHeadlessUniversalCheckoutDidTokenizePaymentMethod

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 manual payment handling, or the vault manager.
SWIFT

Parameters

Example

SWIFT

primerHeadlessUniversalCheckoutDidResumeWith

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.
SWIFT

Parameters

Example

SWIFT

primerHeadlessUniversalCheckoutDidEnterResumePendingWithPaymentAdditionalInfo

This callback is trigger when the payment is not authorized as it’s an asynchronous alternative payment method, such as a voucher payment method, but the payment has stayed in a pending state.
This method will be called only when using the PrimerPaymentHandling.auto flow.
SWIFT

Parameters

primerHeadlessUniversalCheckoutDidReceiveAdditionalInfo

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.
SWIFT

Parameters

primerHeadlessUniversalCheckoutDidFail

This method will be called when an error occurs. It may return PrimerCheckoutData if the error occurs after the payment creation.
SWIFT

Parameters

primerHeadlessUniversalCheckoutWillUpdateClientSession

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.
SWIFT

primerHeadlessUniversalCheckoutDidUpdateClientSession

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.
SWIFT

Parameters

primerHeadlessUniversalCheckoutWillCreatePaymentWithData

This method will be called with 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 checking out using the auto flow.
SWIFT

Parameters

Example

SWIFT

Example with Idempotency Key

SWIFT