Skip to main content

Card

danger

Please be aware that our Tokenizer is still in Beta. Breaking changes might happen in the future.

Methods

The SimpleReverePay class provides several methods that you can use to perform various actions related to payment form management and validation. These methods allow for programmatic control over the payment form's behavior, enhancing form interaction and data handling. Below is a table detailing each method available on an instance of SimpleReverePay.

MethodDescriptionParametersReturns
checkValidityUpdates the validation state for all form inputs, and returns an isValid boolean through the onCheckValidity callback function.NoneNone
resetClears out all inputs and sets the validation states to neutral.NoneNone
submitSubmits the credit card form.NoneNone
updateFieldsYou can update the Card Holder Name and the Postal Code field values or placeholders after the initialization. Known issues: You can't set an empty string, and it does not work after calling the reset() method!FieldUpdateConfigNone

How to call a method

To use these methods, you typically need to call the SimpleReverePay class instance methods. Here's a brief example using JavaScript:

// Assume `reverePay` is your SimpleReverePay instance
reverePay.checkValidity(); // Validates the form and executes the callback
reverePay.reset(); // Resets the credit card form
reverePay.submit(); // Submits the credit card form
reverePay.updateFields({
cardHolderName: {
value: 'John Doe'
},
postalCode: {
value: '12345'
}
}); // Updates the existing field values in the form.

Playgrounds

Types of response

CardPaymentResponse

Details associated with a card payment method.

PropertyTypeDescription
binstringBank Identification Number.
brandstringCard brand (e.g., Visa, MasterCard).
cardTypestringType of card (e.g., credit, debit).
cardVerificationCardVerificationVerification details for the card.
domesticPushToCardstringIndicator if the card supports domestic push.
expirationCardExpirationExpiration details of the card.
holderNamestringName of the cardholder.
lastFourCardNumberstringLast four digits of the card number.

CardExpiration

Details regarding the card's expiration.

PropertyTypeDescription
monthstringExpiration month of the card.
yearstringExpiration year of the card.

CardVerification

Information about the card's verification status.

PropertyTypeDescription
statusstringVerification status of the card.

CardFieldsConfig

The types of the configurable options for the tokenizer card payment fields.

/**
* Configuration for the card fields.
*/
export type CardFieldsConfig = {
/**
* Configuration for the card CVV field.
* @default undefined
*/
cardCVV?: {
/**
* Indicates if the CVV field is required.
* @default true
*/
required?: boolean;
};

/**
* Configuration for the card holder name field.
* @default undefined
*/
cardHolderName?: {
/**
* Placeholder text for the card holder name field.
* @default undefined
*/
placeholder?: string;
/**
* Default value for the card holder name field.
* @default undefined
*/
value?: string;
};

/**
* Configuration for the postal code field.
* @default undefined
*/
postalCode?: {
/**
* Placeholder text for the postal code field.
* @default undefined
*/
placeholder?: string;
/**
* Default value for the postal code field.
* @default undefined
*/
value?: string;
};
};

FieldUpdateConfig

The types of the configurable options for the updatable card payment fields.

/**
* Configuration for the card fields.
*/
export type FieldUpdateConfig = {
/**
* Configuration for the card holder name field.
*/
cardHolderName?: {
/**
* Placeholder text for the card holder name field.
*/
placeholder?: string;

/**
* Value for the card holder name field.
*/
value?: string;
};

/**
* Configuration for the postal code field.
*/
postalCode?: {
/**
* Placeholder text for the postal code field.
*/
placeholder?: string;

/**
* Value for the postal code field.
*/
value?: string;
};
};