Skip to main content

Event Detail / Message Data

Whether inside event data, or as an argument passed to a supplied callback, the data structure will always arrive in this format:

{
type: 'validation' | 'tokenization' | 'cardType' | 'initiated'
fieldName: 'cardNumber' | 'cardCvv' | 'cardExpiry' | 'allFields',
success: boolean,
message: string,
paymentToken: string
}
ParameterValueDescription
type'validation' | 'tokenization' | 'cardType' | 'initiated'the type of message
fieldName'cardNumber' | 'cardCvv' | 'cardExpiry' | 'allFields
successbooleanresult of an action. e.g. validation or tokenization
messagestringOptional. e.g. for validation, might include a validation error string.
paymentTokenstringThe same paymentToken to be used in the sale API.
cardTypeDataCardTypeDataOnly applies if the type is cardType

CardTypeData​

This is only useful for receiving the detected card type from the user:

typeData?: {
niceType: string; // Human-readable card type (e.g., "Visa")
type: string; // Card type code
patterns: number[] | [number[]]; // Valid number patterns
gaps: number[]; // Positions of gaps in card number
lengths: number[]; // Valid card number lengths
code: {
size: number; // CVV length
name: string; // CVV field name (e.g., "CVV")
};
matchStrength?: number; // Confidence of card type match
};

type strings

| "american-express"
| "diners-club"
| "discover"
| "elo"
| "hiper"
| "hipercard"
| "jcb"
| "maestro"
| "mastercard"
| "mir"
| "unionpay"
| "visa";

niceType strings

| "American Express"
| "Diners Club"
| "Discover"
| "Elo"
| "Hiper"
| "Hipercard"
| "JCB"
| "Maestro"
| "Mastercard"
| "Mir"
| "UnionPay"
| "Visa";