123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
interface PrimerSettings {  paymentHandling?: 'AUTO' | 'MANUAL';  localeData?: IPrimerLocaleData;  paymentMethodOptions?: IPrimerPaymentMethodOptions;  uiOptions?: IPrimerUIOptions;  debugOptions?: IPrimerDebugOptions;  clientSessionCachingEnabled?: boolean;
  // Dropin UI  onBeforeClientSessionUpdate?: () => void;  onClientSessionUpdate?: (clientSession: PrimerClientSession) => void;  onBeforePaymentCreate?: (checkoutPaymentMethodData: PrimerCheckoutPaymentMethodData, handler: PrimerPaymentCreationHandler) => void;  onCheckoutComplete?: (checkoutData: PrimerCheckoutData) => void;  onTokenizeSuccess?: (paymentMethodTokenData: PrimerPaymentMethodTokenData, handler: PrimerTokenizationHandler) => void;  onResumeSuccess?: (resumeToken: string, handler: PrimerResumeHandler) => void;  onResumePending?: (additionalInfo: PrimerCheckoutAdditionalInfo) => void;  onCheckoutReceivedAdditionalInfo?: (additionalInfo: PrimerCheckoutAdditionalInfo) => void;  onError?: (error: PrimerError, checkoutData: PrimerCheckoutData | null, handler: PrimerErrorHandler | undefined) => void;  onDismiss?: () => void;
  headlessUniversalCheckoutCallbacks?: {    onAvailablePaymentMethodsLoad?: (availablePaymentMethods: any[]) => void;    onTokenizationStart?: (paymentMethodType: string) => void;    onTokenizationSuccess?: (paymentMethodTokenData: PrimerPaymentMethodTokenData, handler: PrimerHeadlessUniversalCheckoutResumeHandler) => void;
    onCheckoutResume?: (resumeToken: string, handler: PrimerHeadlessUniversalCheckoutResumeHandler) => void;    onCheckoutPending?: (additionalInfo: PrimerCheckoutAdditionalInfo) => void;    onCheckoutAdditionalInfo?: (additionalInfo: PrimerCheckoutAdditionalInfo) => void;
    onError?: (error: PrimerError, checkoutData: PrimerCheckoutData | null) => void;    onCheckoutComplete?: (checkoutData: PrimerCheckoutData) => void;    onBeforeClientSessionUpdate?: () => void;
    onClientSessionUpdate?: (clientSession: PrimerClientSession) => void;    onBeforePaymentCreate?: (checkoutPaymentMethodData: PrimerCheckoutPaymentMethodData, handler: PrimerPaymentCreationHandler) => void;    onPreparationStart?: (paymentMethodType: string) => void;
    onPaymentMethodShow?: (paymentMethodType: string) => void;  }}
interface IPrimerLocaleData {  languageCode?: string  localeCode?: string}
interface IPrimerPaymentMethodOptions {  iOS?: {    urlScheme?: string;  }  android?: {    redirectScheme?: string;  },  apayaOptions?: IPrimerApayaOptions;  applePayOptions?: IPrimerApplePayOptions;
  /**  * @obsoleted The IPrimerCardPaymentOptions is obsoleted on v.2.14.0  */  cardPaymentOptions?: IPrimerCardPaymentOptions;
  goCardlessOptions?: IPrimerGoCardlessOptions;  googlePayOptions?: IPrimerGooglePayOptions;  klarnaOptions?: IPrimerKlarnaOptions;  threeDsOptions?: IPrimerThreeDsOptions;  stripeOptions?: IPrimerStripeOptions;}
interface IPrimerApayaOptions {  webViewTitle: string;}
interface IPrimerApplePayOptions {  merchantIdentifier: string;  merchantName?: string;  isCaptureBillingAddressEnabled?: boolean;  showApplePayForUnsupportedDevice?: boolean;  checkProvidedNetworks?: boolean;  shippingOptions?: {    shippingContactFields?: RequiredContactField[];    requireShippingMethod: boolean;  };  billingOptions?: {    requiredBillingContactFields?: RequiredContactField[];  };}
type RequiredContactField = 'name' | 'emailAddress' | 'phoneNumber' | 'postalAddress';
interface IPrimerCardPaymentOptions {  is3DSOnVaultingEnabled: boolean;}
interface IPrimerGoCardlessOptions {  businessName?: string;  businessAddress?: string;}
interface IPrimerGooglePayOptions {  merchantName?: string;  allowedCardNetworks?: string[];  isCaptureBillingAddressEnabled?: boolean;  isExistingPaymentMethodRequired?: boolean;  shippingAddressParameters?: IPrimerGoogleShippingAddressParameters;  requireShippingMethod?: boolean;  emailAddressRequired?: boolean;  buttonOptions?: IPrimerGooglePayButtonOptions;}
interface IPrimerGooglePayButtonOptions {  buttonType?: number;  buttonTheme?: number;}
interface IPrimerGoogleShippingAddressParameters {  isPhoneNumberRequired?: boolean;}
interface IPrimerKlarnaOptions {  recurringPaymentDescription?: string;  webViewTitle?: string;}
interface IPrimerUIOptions {  isInitScreenEnabled?: boolean;  isSuccessScreenEnabled?: boolean;  isErrorScreenEnabled?: boolean;  theme?: IPrimerTheme;}
interface IPrimerDebugOptions {  is3DSSanityCheckEnabled?: boolean;}
interface IPrimerThreeDsOptions {  iOS?: {    threeDsAppRequestorUrl?: string;  };  android?: {    threeDsAppRequestorUrl?: string;  };}
ts
copy

⚠️ If no settings are provided, the SDK will initialize with its default settings.
Use PrimerSettings to provide different options based on your use case.

paymentHandling
Stringoptional

Can be set to 'MANUAL' or 'AUTO' Force the SDK locale. By default, the locale will be set to the device's locale.

localeData
IPrimerLocaleDataoptional
Forces some payment methods' locale.
properties

Forces the language code (e.g. en). Defaults on your app's language code if available.

Forces the locale code (e.g. US). Defaults on your app's country locale code if available.

paymentMethodOptions
IPrimerPaymentMethodOptionsoptional

Customize the appearance and behavior of the card fields in the checkout form for various payment methods

properties
iOS
objectoptional
Properties
urlScheme
Stringoptional
⚠️ Required for some payment methods (e.g. PayPal).

This option sets the deeplink schema used when redirecting back from 3rd party applications to your app.
android
objectoptional
Properties
redirectScheme
Stringoptional
⚠️ Required for some payment methods (e.g. PayPal).

This option sets the deeplink schema used when redirecting back from 3rd party applications to your app.
applePayOptions
IPrimerApplePayOptionsoptional
Options for using Apple Pay as a payment method.
Properties
Set it to the merchant identifier as it is shown in your Apple Pay certificate.
Deprecated: Use Client Session API to provide merchant name value.

Defaults to false. Set to true to let Apple Pay capture the customer's billing address.

Deprecated: Use BillingOptions to configure required billing fields.

If in some cases you don't want to present ApplePay option if the device is not supporting it set this to false. The default value is true.

Default value is `true`. Set to `false` if you do not want to present Apple Pay option on unsupported devices.
⚠️

This is an advanced configuration flag. You should discuss it with the Primer team before using it.

If set to true, only merchant-allowed card networks can be used when paying with Apple Pay. If set to false any network can be used provided the device supports Apple Pay.

Merchant-allowed networks are provided using orderedAllowedCardNetworks when creating the client session.

Default value is `true`. This flag supports the old behavior where Apple Pay flow might not present if there are no cards in the Wallet.
shippingOptions
ShippingOptions
Configure shipping options for Apple Pay.
Properties
shippingContactFields
Array of RequiredContactField
Specify which contact fields are required for shipping.
Indicate if a shipping method is required.
billingOptions
BillingOptions
Configure billing options for Apple Pay.
Properties
requiredBillingContactFields
Array of RequiredContactField
Specify which contact fields are required for billing.
cardPaymentOptions
IPrimerCardPaymentOptionsdeprecated

⚠️ This option is Deprecated since v.2.14.0.

Properties
Enable 3DS flow on vaulted cards.
goCardlessOptions
IPrimerGoCardlessOptionsoptional
⚠️ Required when using Go Cardless in your integration.
Properties
Business name.
Business address.
googlePayOptions
IPrimerGooglePayOptionsoptional
⚠️ Required when using Google Pay in your integration.
Properties
Set it the merchant name that you want to be shown on the Google Pay screen.
allowedCardNetworks
Array<String>Default: ["AMEX", "DISCOVER", "JCB", "MASTERCARD","VISA"]

Sets the card networks that your application accepts.

isCaptureBillingAddressEnabled
BooleanDefault: false
Sets whether user's billing address should be captured from Google Pay.
isExistingPaymentMethodRequired
BooleanDefault: false

If set to true, this specifies that Google Pay can only be used for payments if the user's Google Pay wallet already contains allowed payment methods.

klarnaOptions
IPrimerKlarnaOptionsoptional
⚠️ Required when using Klarna in your integration.
Properties
Set the payment description that will be shown on the Klarna screen.
webViewTitle
Stringoptional

⚠️ This option is Deprecated.
Sets the toolbar title of the Activity displaying Klarna views.

threeDsOptions
IPrimerThreeDsOptions
Sets the 3DS options in the SDK.
Properties
iOS
objectoptional
Properties

Set the iOS Universal Link that's used to call your app after an out-of-band (OOB) authentication.

android
objectoptional
Properties

Set the App link that's used to call your app after an out-of-band (OOB) authentication.

stripeOptions
IPrimerStripeOptionsoptional
⚠️ Required when using Stripe ACH in your integration.
Properties
mandateData
IPrimerStripeTemplateMandateData | IPrimerFullMandateDataoptional
Data used for mandate in Drop-in
IPrimerStripeTemplateMandateData
Data for the mandate allowing you to specify the name of the merchant that would be used in a predefined mandate template.
Properties
The name of the merchant.
IPrimerFullMandateData
Data for the mandate allowing you to specify the full mandate.
Properties
fullMandateText
Stringrequired
The string resource pointing to the full mandate. Supported on Android and iOS.
The name of the Android string resource pointing to the the full mandate. Supported only on Android.
uiOptions
IPrimerUIOptionsoptional
Properties
isInitScreenEnabled
Booleanoptional

Set to false to hide the loading screen before the Universal Checkout or the Vault Manager. Defaults to true.

isSuccessScreenEnabled
Booleanoptional

Set to false to hide the screen after a successful payment, or tokenization on the vault flow. Defaults to true.

isErrorScreenEnabled
Booleanoptional

Set to false to hide the error screen when an error occurs. Defaults to true.

theme
IPrimerThemeoptional
Set a custom theme for Primer SDK.
debugOptions
IPrimerDebugOptionsoptional
Properties
Debug option on 3DS for Primer SDK.
Before enabling flag to true it's recommended to reach out to Primer support for additional verification since there are edge cases where it's not advised.

Indicates whether client session caching is enabled.

When set to true, responses from the server will be cached on the client side, allowing for faster subsequent access to the same data within the cache duration. When set to false, every request to the server will be processed without utilizing any client-side cache, ensuring that the client always receives the most up-to-date data.

onBeforeClientSessionUpdate
() => voidoptional
Called when the client session is in the process of being updated. Use it to show a loading indicator on your UI.
onClientSessionUpdate
(clientSession: PrimerClientSession) => voidoptional
Called when the client session has been updated by the checkout. Returns the updated client session which can be used to inform your UI. For example updating tax, shipping or discount amounts displayed to your customers.
onBeforePaymentCreate
(checkoutPaymentMethodData: PrimerCheckoutPaymentMethodData, handler: PrimerPaymentCreationHandler) => voidoptional

Called when a payment will be created. Use as an opportunity to update UI accordingly - for example, to display a "loading" component. The handler must be used to then abort or continue with payment creation. Primer will continue with payment creation if onBeforePaymentCreate is not implemented.

Parameters
checkoutPaymentMethodData
PrimerCheckoutPaymentMethodData
Parameters

The type of the payment method Primer will use for payment creation, one of PaymentMethodType

The name of the payment method Primer will use for payment creation.
handler
PrimerPaymentCreationHandler

Provides two methods to continue or abort the payment.
You MUST call one of the methods of the handler if onBeforePaymentCreate is implemented.

Parameters
abortPaymentCreation
(errorMessage: string | null) => void
Choose to abort a payment.
Choose to continue with payment creation
onCheckoutComplete
(checkoutData: PrimerCheckoutData) => voidoptional

Called when a payment has been created. Move on to next step in your checkout flow, such as showing a success message, giving access to the service, fulfilling the order, etc.

Parameters
checkoutData
PrimerCheckoutData
Properties
payment
IPrimerCheckoutDataPayment
Properties
id
string
Primer's unique identifier for the payment.
orderId
string
Your order identifier as provided in the client session.
paymentFailureReason
PrimerPaymentErrorCode

Can be either payment-failed which is an error from the PSP side, or cancelled-by-customer which means the failure initiated on the customer side. I.e. cancelling a 3DS flow.

Custom information, that depends on the payment method.
Variations
Properties
expiresAt
StringRequired
couponCode
StringRequired
retailerName
StringRequired
Properties
expiresAt
StringRequired
qrCodeUrl
String?
qrCodeBase64
StringRequired
Properties
expiresAt
StringRequired
entity
StringRequired
reference
StringRequired
onTokenizeSuccess
(paymentMethodTokenData: PrimerPaymentMethodTokenData, handler: PrimerTokenizationHandler) => voidoptional
ℹ️
If you set `paymentHandling` to `MANUAL`, implementing this is mandatory.
Parameters
paymentMethodTokenData
PrimerPaymentMethodTokenData
Properties

An unique identifier for the payment instrument token.

id
string

Payment method identifier.

isVaulted
boolean

Indicating the use of vaulted instruments for the payment method.

paymentInstrumentData
PaymentInstrumentData

Additional information about the payment instrument. Depending on the payment method type, only some of the following properties are present on the object.

Properties
network
string?
The human readable representation of card network (e.g., Visa, Mastercard).
The name of the cardholder.
The first 6 digits of the card number.
The last 4 digits of the card number.
The last 4 digits of the account number.
The expiration month of the card, in 2-digit format.
The expiration year of the card, in 4-digit format.
externalPayerInfo
IExternalPayerInfo?
Additional Paypal data.
Properties
email
string
The payer's email address.
The payer's unique ID.
firstName
string?
The payer's given name.
lastName
string
The payer's given surname.
sessionData
IKlarnaSessionData?
A unique string identifier for the payment method. (e.g. `PAYPAL`, `GOOGLE_PAY`)
binData
IBinData?
Additional BIN data.
Properties
network
string?
The card network (e.g., VISA, MASTERCARD, AMEX).
bankName
string?
The name of the bank.

The type of the payment instrument.

Example of possible values (new values could be added as we add new payment methods):

  • APPLE_PAY
  • CARD_OFF_SESSION_PAYMENT
  • GOOGLE_PAY
  • KLARNA_CUSTOMER_TOKEN
  • OFF_SESSION_PAYMENT
  • PAYMENT_CARD
  • PAYPAL_BILLING_AGREEMENT
  • PAYPAL_ORDER
token
stringRequired

The payment instrument token you can use to create a payment request from your backend.

tokenType
"SINGLE_USE" | "MULTI_USE"
Whether this payment method token can be used only once or multiple times.
threeDSecureAuthentication
ThreeDSAuthenticationData
Properties
responseCode
ThreeDSecureStatus

Indicates the outcome of the 3D Secure authentication process.
Possible values:

  • AUTH_SUCCESS: The authentication was successful.
  • AUTH_FAILED: The authentication process failed.
  • SKIPPED: The authentication was skipped.
  • CHALLENGE: A challenge was issued during the authentication process.
An optional code indicating the reason for the outcome of the 3D Secure authentication.
An optional text description providing further details about the reason for the authentication outcome.
Specifies the version of the 3D Secure protocol that was used.

Indicates whether a challenge was issued as part of the authentication process.

  • true: A challenge was issued.
  • false: No challenge was issued.
vaultData
PrimerVaultData
Properties

The customerId associated to the payment method, if vaulted.

handler
OnTokenizeSuccessHandler
Properties
handleSuccess
() => void
Display a success screen.
handleFailure
(errorMessage: string) => void

Display errorMessage as an error or failure message.

continueWithNewClientToken
(clientToken: string) => void

Continue the payment flow using the given clientToken.

Called after a customer submitted their payment data and the payment details have been tokenized. You'll receive a paymentMethodToken in onTokenizeSuccess().

  • Create a payment request passing the paymentMethodToken to your backend

  • If the payment is successful, call handler.handleSuccess() in order to display a success screen

  • If the payment is unsuccessful, call handler.handleFailure(errorMessage) to display an error or failure message

  • Payments API may return a new clientToken for additional steps (in the requiredActions on the response). In this case, call handler.continueWithNewClientToken(clientToken) to continue with the payment flow

onResumeSuccess
(resumeToken: string, handler: PrimerResumeHandler) => voidoptional
Parameters

The resume token you can use to resume the payment flow on your backend.

Properties
handleSuccess
() => void
Display a success screen.
handleFailure
(errorMessage: string) => void
Display `errorMessage` as an error or failure message.
continueWithNewClientToken
(clientToken: string) => void

Continue the payment flow using the given clientToken.

onResumePending
(additionalInfo: PrimerCheckoutAdditionalInfo) => voidoptional

This callback is triggered 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 is set to MANUAL

additionalInfo
PrimerCheckoutAdditionalInfoRequired
variations
Properties
additionalInfoName
XenditCheckoutVoucherAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
couponCode
StringRequired
retailerName
StringRequired
Properties
additionalInfoName
PromptPayCheckoutAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
qrCodeUrl
String?
qrCodeBase64
StringRequired
Properties
additionalInfoName
MultibancoCheckoutAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
entity
StringRequired
reference
StringRequired
Properties
additionalInfoName
DisplayStripeAchMandateAdditionalInfo
The name of this additional info.
onCheckoutReceivedAdditionalInfo
(additionalInfo: PrimerCheckoutAdditionalInfo) => voidoptional

This callback is triggered 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 is set to AUTO

additionalInfo
PrimerCheckoutAdditionalInfoRequired
variations
Properties
additionalInfoName
XenditCheckoutVoucherAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
couponCode
StringRequired
retailerName
StringRequired
Properties
additionalInfoName
PromptPayCheckoutAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
qrCodeUrl
String?
qrCodeBase64
StringRequired
Properties
additionalInfoName
MultibancoCheckoutAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
entity
StringRequired
reference
StringRequired
Properties
additionalInfoName
DisplayStripeAchMandateAdditionalInfo
The name of this additional info.
onError
(error: PrimerError, checkoutData: PrimerCheckoutData | null, handler: PrimerErrorHandler | undefined) => voidoptional

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.

error
PrimerErrorRequired
Properties
errorId
StringRequired
A unique error identifier.
errorCode
String?
A unique error code.
description
StringRequired
A error description.
checkoutData
PrimerCheckoutData
Properties
payment
IPrimerCheckoutDataPayment
Properties
id
string
Primer's unique identifier for the payment.
orderId
string
Your order identifier as provided in the client session.
paymentFailureReason
PrimerPaymentErrorCode

Can be either payment-failed which is an error from the PSP side, or cancelled-by-customer which means the failure initiated on the customer side. I.e. cancelling a 3DS flow.

Custom information, that depends on the payment method.
Variations
Properties
expiresAt
StringRequired
couponCode
StringRequired
retailerName
StringRequired
Properties
expiresAt
StringRequired
qrCodeUrl
String?
qrCodeBase64
StringRequired
Properties
expiresAt
StringRequired
entity
StringRequired
reference
StringRequired
handler
PrimerErrorHandler
Methods
Call with your custom error message.
onDismiss
() => voidoptional
This method will be called to notify you that the Primer SDK has been dismissed.
properties
onAvailablePaymentMethodsLoad
(availablePaymentMethods: any[]) => void
Called when the available payment methods have been loaded. Takes an array of objects as its argument.
Parameters
paymentMethods
PaymentMethodInfo[]
Properties
type
PaymentMethodTypeRequired
managerType
"CARD" | "NATIVE" | "REDIRECT"Required
The type of payment manager to use.
onTokenizationStart
(paymentMethodType: string) => void
This method will be called with just before the tokenization gets started.
attributes
paymentMethodType
StringRequired
onTokenizationSuccess
(paymentMethodTokenData: PrimerPaymentMethodTokenData, handler: PrimerHeadlessUniversalCheckoutResumeHandler) => void
This method will be called when the tokenization was successful.
onCheckoutResume
(resumeToken: string, handler: PrimerHeadlessUniversalCheckoutResumeHandler) => void
Parameters

The resume token you can use to resume the payment flow on your backend.

handler
PrimerHeadlessUniversalCheckoutResumeHandler
Properties
complete
() => void
Complete the payment flow.
continueWithNewClientToken
(clientToken: string) => void

Continue the payment flow using the given clientToken.

onCheckoutPending
(additionalInfo: PrimerCheckoutAdditionalInfo) => void

This callback is triggered 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 is set to MANUAL

additionalInfo
PrimerCheckoutAdditionalInfoRequired
variations
Properties
additionalInfoName
XenditCheckoutVoucherAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
couponCode
StringRequired
retailerName
StringRequired
Properties
additionalInfoName
PromptPayCheckoutAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
qrCodeUrl
String?
qrCodeBase64
StringRequired
Properties
additionalInfoName
MultibancoCheckoutAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
entity
StringRequired
reference
StringRequired
Properties
additionalInfoName
DisplayStripeAchMandateAdditionalInfo
The name of this additional info.
onCheckoutAdditionalInfo
(additionalInfo: PrimerCheckoutAdditionalInfo) => void

This callback is triggered 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 is set to AUTO

additionalInfo
PrimerCheckoutAdditionalInfoRequired
variations
Properties
additionalInfoName
XenditCheckoutVoucherAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
couponCode
StringRequired
retailerName
StringRequired
Properties
additionalInfoName
PromptPayCheckoutAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
qrCodeUrl
String?
qrCodeBase64
StringRequired
Properties
additionalInfoName
MultibancoCheckoutAdditionalInfo
The name of this additional info.
expiresAt
StringRequired
entity
StringRequired
reference
StringRequired
Properties
additionalInfoName
DisplayStripeAchMandateAdditionalInfo
The name of this additional info.
onError
(error: PrimerError, checkoutData: PrimerCheckoutData | null) => void

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

error
PrimerErrorRequired
Properties
errorId
StringRequired
A unique error identifier.
errorCode
String?
A unique error code.
description
StringRequired
A error description.
checkoutData
PrimerCheckoutData
Properties
payment
IPrimerCheckoutDataPayment
Properties
id
string
Primer's unique identifier for the payment.
orderId
string
Your order identifier as provided in the client session.
paymentFailureReason
PrimerPaymentErrorCode

Can be either payment-failed which is an error from the PSP side, or cancelled-by-customer which means the failure initiated on the customer side. I.e. cancelling a 3DS flow.

Custom information, that depends on the payment method.
Variations
Properties
expiresAt
StringRequired
couponCode
StringRequired
retailerName
StringRequired
Properties
expiresAt
StringRequired
qrCodeUrl
String?
qrCodeBase64
StringRequired
Properties
expiresAt
StringRequired
entity
StringRequired
reference
StringRequired
onCheckoutComplete
(checkoutData: PrimerCheckoutData) => void

Called when a payment has been created. Move on to next step in your checkout flow, such as showing a success message, giving access to the service, fulfilling the order, etc.

Parameters
checkoutData
PrimerCheckoutData
Properties
payment
IPrimerCheckoutDataPayment
Properties
id
string
Primer's unique identifier for the payment.
orderId
string
Your order identifier as provided in the client session.
paymentFailureReason
PrimerPaymentErrorCode

Can be either payment-failed which is an error from the PSP side, or cancelled-by-customer which means the failure initiated on the customer side. I.e. cancelling a 3DS flow.

Custom information, that depends on the payment method.
Variations
Properties
expiresAt
StringRequired
couponCode
StringRequired
retailerName
StringRequired
Properties
expiresAt
StringRequired
qrCodeUrl
String?
qrCodeBase64
StringRequired
Properties
expiresAt
StringRequired
entity
StringRequired
reference
StringRequired
Called when the client session is in the process of being updated. Use it to show a loading indicator on your app.
onClientSessionUpdate
(clientSession: PrimerClientSession) => void
Called when the client session has been updated by the checkout. Returns the updated client session which can be used to inform your UI. For example updating tax, shipping or discount amounts displayed to your customers.
onBeforePaymentCreate
(checkoutPaymentMethodData: PrimerCheckoutPaymentMethodData, handler: PrimerPaymentCreationHandler) => void

Called when a payment will be created. Use as an opportunity to update UI accordingly - for example, to display a "loading" component. The handler must be used to then abort or continue with payment creation. Primer will continue with payment creation if onBeforePaymentCreate is not implemented.

Parameters
checkoutPaymentMethodData
PrimerCheckoutPaymentMethodData
Parameters

The type of the payment method Primer will use for payment creation, one of PaymentMethodType

The name of the payment method Primer will use for payment creation.
handler
PrimerPaymentCreationHandler

Provides two methods to continue or abort the payment.
You MUST call one of the methods of the handler if onBeforePaymentCreate is implemented.

Parameters
abortPaymentCreation
(errorMessage: string | null) => void
Choose to abort a payment.
Choose to continue with payment creation
onPreparationStart
(paymentMethodType: string) => void
This method will be called when the SDK starts preparing to tokenize the payment method.
onPaymentMethodShow
(paymentMethodType: string) => void
Called when the payment method is displayed.