ICardSubscriptions Interface#
Methods#
focus#
This method asynchronously focuses on a form field of the specified type; otherwise, an exception will be generated.Errors#
| CODE | MESSAGE | EXAMPLE | DESCRIPTION |
|---|
| E010 | Error al realizar focus en el campo | { code: "E010", message: "Error al realizar focus en el campo" } | If the specified field type is invalid, it will return an E010 error |
Example#
This function returns a FormValidity representing the validation status of the CVV field.Example#
onFieldBlur#
This event is emitted when the field loses focus.Parameters#
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
|---|
| event | fieldEvent | YES | This callback is executed when the hosted field is blurry. fieldEvent: FieldValidity | FormValidity |
| fieldType | FieldTypeEnum | NO | Set the field type if you want to control the event blurring of a specific hosted field |
Examples#
Handling the blur event to get FormValidity.Handling blur event to get cvv FieldValidityonFieldFocus#
This event is executed when the field is focused.Parameters#
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
|---|
| event | fieldEvent | YES | This callback is executed when the hosted field is focused. fieldEvent: FieldValidity | FormValidity |
| fieldType | FieldTypeEnum | NO | Set the field type if you want to control the event focus of a specific hosted field |
Examples#
Handling focus event to get FormValidityHandling focus event to get cvv FieldValidityonFieldSubmit#
This event is executed when the field has been sent.Parameters#
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
|---|
| event | fieldEvent | YES | This callback is executed when the hosted field is sent. fieldEvent: FieldValidity | FormValidity |
| fieldType | FieldTypeEnum | NO | Set the field type if you want to control the event dispatch of a specific hosted field |
Examples#
Handling submit event to get FormValidityHandling submit event to get FieldValidityonFieldValidity#
This event is executed when the field validity changes.Parameters#
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
|---|
| event | fieldEvent | YES | This callback is executed when the hosted field changes its validity. fieldEvent: FieldValidity | FormValidity |
| fieldType | FieldTypeEnum | NO | Set the field type if you want to control the validity of a specific hosted field event |
Examples#
Handling FormValidity event of cvv fieldHandling FieldValidity event of cvv fieldrequestDeviceToken#
Retrieve a secure device token for on-demand subscriptions or one-click payments.This method validates whether the cvv field is valid and generates a device token. If the validation fails, an exception is thrown.If the merchant or subscription requires 3DS or Sift Science services, this method automatically performs the necessary validations according to each rule.Parameters#
- body: DeviceTokenRequest (Optional)Object with subscriptionId and other params for specific cases.Returns#
- Promise<TokenResponse>: TokenResponse object with tokenThrows#
KushkiErrorResponse object with code and message of errorErrors#
- If an error occurs on the "requestDeviceToken" endpoint, the system throws an E002 error.
- If an error occurs on the "requestMerchantSettings" endpoint, the system throws an E003 error.
- If the merchant has Sift Science configurations and options.subscriptionId is missing in the request body or the request fails, the system throws an E016 error.
- If the merchant is configured with a 3DS rule and an error occurs on the "requestJWT" endpoint, the system throws an E004 error.
- If the merchant is configured with a 3DS rule and an error occurs during 3DS authentication, the system throws an E005 error.
- If the merchant is configured with a 3DS rule and an error occurs during 3DS session validation, the system throws an E006 error.
- If the cvv field is invalid, the system throws an E007 error.
- If the "DeviceTokenRequest" body is not defined, the system throws an E020 error.Examples#
Example for 3DS and Sift validationsreset#
This method asynchronously resets a field in the form of the specified type to its default state; otherwise, it will throw an exception.Errors#
| CODE | MESSAGE | EXAMPLE | DESCRIPTION |
|---|
| E009 | Error al limpiar el campo | { code: "E009", message: "Error al limpiar el campo" } | If the specified field type is invalid, the onError callback will return the error code E009. |
Example#
Modified at 2026-02-02 22:10:25