| Characteristic | Kushki.js | Kushki.js Hosted Fields | Details |
|---|---|---|---|
| Size | ~2.7 MB | ~307* KB | |
| Modularity | NO | YES | |
| Import via CDN | YES | YES | |
| Import via NPM | YES | YES | |
| Import via YARN | NO | YES | |
| Library Settings | Kushki() object instance | KushkiOptions() object instance | |
| Token for one-time payment | requestToken() | requestToken() | In Kushki.js Hosted Fields, an object of type CardOptions() must be created, which will contain information about the amount, the type of currency, among other transaction data. |
| amount property in token for one-time payment | String. Amount without breakdown | Object. Allows you to break down the purchase amount by iva, ice, subtotaliva and subtotaliva0. | Transaction amount. |
| months property in token for one-time payment | Integer | Not available | In Kushki.js Hosted Fields, deferrals are now returned in the token (if available for the merchant). |
| Currency property in token for one-time payment | String | String | Currencies available by country. |
| Card object inside the token for one-time payment | Object. Card information such as cardholder name, card number, cvc, etc.) | Not available | In Kushki.js Hosted Fields, the merchant no longer requires handling of sensitive card data information. |
| Callback property in token for one-time payment | Function | Not available | |
| Fields object within token for one-time payment | Not available | Through the CardOptions object instance | The fields object allows you to relate the html div tags with the corresponding ids of the hosted fields to be rendered. |
| isSubscription property in token for one-time payment | Not available | Boolean. Allows you to indicate whether the generated token is for a subscription or not | In Kushki.js Hosted Fields the isSubscription property replaces the implementation of the requestSubscriptionToken() method. |
| preventAutofill property in token for one-time payment | Not available | Boolean. Allows you to prevent hosted fields from being filled in automatically. | |
| styles property in token for one-time payment | Not available | Object. Allows you to modify hosted field styles. | In Kushki.js Hosted Fields, the library allows greater control of styles in fields. |
| Validation via OTP for one-time payment | requestSecureServiceValidation() method | Automatic validation (if applicable) in the requestToken() method. | |
| Getting JWT for 3D Secure validation for one-time payment | requestSecureInit() method | Automatic validation (if applicable) in the requestToken() method. | |
| Validation through 3D Secure for single payment | requestValidate3DS() method | Automatic validation (if applicable) in the requestToken() method. | |
| Deferred for one-time payment | requestDeferred() method | Returned automatically upon consuming the requestToken() method (if available for the merchant). | |
| Information about the bin for one-time payment | requestBinInfo() method | Not available | In Kushki.js Hosted Fields, it is not required to obtain the bin since the validations are done automatically in the requestToken() method. |
| Subscription token | requestSubscriptionToken() | When calling the requestToken() method, the isSubscription property can be sent as true to indicate that the token will be from a subscription. | |
| Currency property in token for subscription | String | String | Currencies available by country. |
| Token card object for subscription | Object. Card information such as cardholder name, card number, cvc, etc.) | Not available | In Kushki.js Hosted Fields, the merchant no longer requires handling of sensitive card data information. |
| Callback property in token for subscription | Function | Not available | |
| Token fields object for subscription | Not available | Through the CardOptions object instance | The fields object allows you to relate the html div tags with the corresponding ids of the hosted fields to be rendered. |
| isSubscription property in token for subscription | Not available | Boolean. Allows you to indicate whether the generated token is for a subscription or not | In Kushki.js Hosted Fields the isSubscription property replaces the implementation of the requestSubscriptionToken() method. |
| preventAutofill property in token for subscription | Not available | Boolean. Allows you to prevent hosted fields from being filled in automatically. | |
| styles property in token for subscription | Not available | Object. Allows you to modify hosted field styles | In Kushki.js Hosted Fields, the library allows greater control of the styles in the fields. |
| OTP validation for subscription | Not available | Automatic validation (if applicable) in the requestToken() method | |
| Getting JWT for 3D Secure validation for subscription | requestSecureInit() method | Automatic validation (if applicable) in the requestToken() method | |
| Validation using 3D Secure for subscription | requestValidate3DS() method | Automatic validation (if applicable) in the requestToken() method | |
| Obtaining the device token for one-click payments | requestDeviceToken() | requestDeviceToken() | |
| Card Async | YES | Not available | |
| Transfer In | YES | Not available | |
| Cash In | YES | Not available | |
| Payouts | YES (transfer, cash) | Only for card payouts |
card.min.js and kushki.min.js libraries.<script> tag. Once imported, you will be able to access the resources described below to create a payment flow with Kushki.kushki.min.js (which brings the necessary code to store your merchant's credentials) and card.min.js (the module that brings the necessary functionalities for the flow with card payments).| Property | Type | Required | Description | Default | Allowed Values |
|---|---|---|---|---|---|
| publicCredentialId | string | YES | Public ID created for your merchant. | ||
| inTest | boolean | NO | Allows you to indicate the work environment between test or production. | false | true, false |
initCardToken() method, it is required to include the necessary <div> elements to render each hosted field.| Property | Required | Description |
|---|---|---|
| cardholderName_id | YES | Hosted field for the cardholder's name. |
| cardNumber_id | YES | Hosted field for the card number. |
| cvv_id | YES | Hosted field for the CVV. |
| expirationDate_id | YES | Hosted field for the expiration date. |
| deferred_id | NO | Hosted field for deferred payments. |
| otp_id | NO | Hosted field for OTP validation. |
cardholderNamecardNumberexpirationDatecvvcardholderNamecardNumberexpirationDate| Property | Type | Required | Description | Allowed Values |
|---|---|---|---|---|
| amount | object | YES (for one-time payments) | Object with detailed transaction amount information. | |
| currency | string | YES | Available currencies by country: MX 🇲🇽: MXN · CO 🇨🇴: COP · CL 🇨🇱: CLP, UF · PE 🇵🇪: PEN, USD · EC 🇪🇨: USD | |
| fields | object | YES | Object to link website containers with hosted fields. | |
| fields.cardNumber.selector | string | YES | Links with the container cardNumber_id and renders the card number field. | |
| fields.cardholderName.selector | string | YES | Links with the container cardholderName_id and renders the cardholder name field. | |
| fields.cvv.selector | string | YES | Links with the container cvv_id and renders the CVV field. You can skip CVV. | |
| fields.cvv.isRequired | boolean | NO | Configures whether CVV entry is required or not. Applies only to subscriptions. | |
| fields.deferred | string | NO | Links with the container deferred_id and renders the deferred payments field (if applicable). | |
| fields.expirationDate | string | YES | Links with the container expirationDate_id and renders the expiration date field. | |
| fields.otp.selector | string | NO | Links with the container otp_id and renders the OTP field (if applicable). | |
| isSubscription | boolean | NO | Allows identifying whether it is a subscription or not. Set as true to generate a scheduled payment or a One-click payment token. | true, false |
| preventAutofill | boolean | NO | Allows preventing autofill of hosted fields. | true, false |
| styles | object | NO | Object for declaring custom styles for hosted fields. | |
| styles.cardNumber | CssProperties | NO | Styles for the card number field. | |
| styles.cardholderName | CssProperties | NO | Styles for the cardholder name field. | |
| styles.container | CssProperties | NO | Styles for the input container. | |
| styles.cvv | CssProperties | NO | Styles for the CVV field. | |
| styles.deferred | CssProperties | NO | Styles for the deferred payments field. | |
| styles.expirationDate | CssProperties | NO | Styles for the expiration date field. | |
| styles.focus | CssProperties | NO | Styles applied when the field has focus. | |
| styles.input | CssProperties | NO | Styles for the input element. | |
| styles.invalid | CssProperties | NO | Styles applied when a field is invalid. | |
| styles.label | CssProperties | NO | Styles for the input label. | |
| styles.otp | CssProperties | NO | Styles for the OTP field. | |
| styles.valid | CssProperties | NO | Styles applied when a field is valid. | |
| fullResponse | boolean | NO | Returns additional card information when generating a subscription token. |
| Property | Type | Required | Description |
|---|---|---|---|
| kushkiInstance | IKushki | YES | Instance with the merchant's public key and working environment. |
| options | CardOptions | YES | Must define the configuration of card fields (amount, currency, subscription status, autofill prevention, custom CSS styles, fields). |
| Code | Message | Example | Description |
|---|---|---|---|
| E012 | Error en inicialización de campos | { code: "E012", message: "Error en inicialización de campos" } | Returned if options or kushkiInstance are null or undefined. |
| E013 | El Id del contenedor de un input no fue encontrado | { code: "E013", message: "El Id del contenedor de un input no fue encontrado" } | Returned if any field references a selector that does not exist in the DOM. |
requestToken() method on the previously initialized card instance. This method also validates all fields; otherwise, it throws an exception.{
"token": "a2b74b7e3cf24e368a20380f16844d16"
}requestToken() method returns additional data based on your merchant's country:token, the method returns the following fields within the deferred object:creditType: Transaction type.graceMonths: Months of grace.months: Months to defer the transaction.creditType per country:"03" = Non-interest-bearing months.deferred object for Mexico and Ecuador:{
"token": "a2b74b7e3cf24e368a20380f16844d16",
"deferred": {
"creditType": "03",
"graceMonths": 2,
"months": 12
}
}token, the method returns a deferred object. The structure depends on the integration model configured for the merchant:{
"token": "a2b74b7e3cf24e368a20380f16844d16",
"deferred": {
"months": 12
}
}deferred object includes additional parameters:creditType: Returns "03" (fixed value for Merchant Installments).graceMonths: Returns 0 (fixed value).months: The number of months selected by the payer.{
"token": "a2b74b7e3cf24e368a20380f16844d16",
"deferred": {
"creditType": "03",
"graceMonths": 0,
"months": 6
}
}| Property | Type | Description |
|---|---|---|
token | String | Token to make a charge. |
deferred | Object | Optional. Returned if the BIN and merchant have deferred enabled. |
deferred.creditType | String | Optional. Type of credit requested. For Chile Cuotas comercio will be 03. |
deferred.graceMonths | String | Optional. Months of grace. Ecuador: standard behavior. Chile Cuotas comercio: returned only for the Kushki Acquiring model with a fixed value of 0. More information in the Make a charge or deferred charge endpoint. |
deferred.months | Integer | Optional. Number of installments. |
requestToken() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E002 | Token request error | { code: "E002", message: "Error en solicitud de token" } | Error when requesting a token. Validate that the required information has been sent correctly. |
| E003 | Merchant data request error | { code: "E003", message: "Error en solicitud de datos del comercio" } | Error when requesting merchant information. Please try again; if the error persists, contact Kushki support. |
| E004 | JWT request error | { code: "E004", message: "Error en solicitud de JWT" } | 3D Secure JWT request error. Please try again; if the error persists, contact Kushki support. |
| E005 | Invalid 3D Secure fields | { code: "E005", message: "Campos 3DS inválidos" } | 3D Secure authentication error. Verify the data entered for 3D Secure validation. |
| E006 | Token validation request error | { code: "E006", message: "Error en solicitud de validación de token" } | 3D Secure validation session error. Please try again; if the error persists, contact Kushki support. |
| E007 | Form validation error | { code: "E007", message: "Error en la validación del formulario" } | One or more hosted fields are invalid. Verify the data entered. |
| E008 | OTP validation error | { code: "E008", message: "Error en la validación de OTP" } | OTP validation failed. Please try again with the correct OTP. |
fullResponse set as trueonSuccess, onError, and onRequired) that allow you to identify the status of OTP validation.onError or onSuccess callbacks.(() => void): Executed when the created token requires OTP validation.((error) => void): Executed when OTP validation returns an error.(() => void): Executed when OTP validation is successful.| Code | Message | Example | Description |
|---|---|---|---|
| E008 | Error en la validación de OTP | { code: "E008", message: "Error en la validación de OTP" } | OTP validation failed. Please try again with the correct OTP. |
requestSecureInit() method. This method allows you to obtain a JSON Web Token (JWT) which is required to obtain a card token. Subsequently, call the requestValidate3DS() method, which will display a modal so that the cardholder can carry out the requested challenges.requestSecureInit() method by sending the card number to get a JWT.| Property | Type | Required | Description |
|---|---|---|---|
| kushkiInstance | IKushki | YES | Object with public merchant id and work environment. |
| secureInitRequest | SecureInitRequest | YES | Object to request the initialization of 3D Secure. |
requestSecureInit() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E004 | JWT request error | { code: "E004", message: "Error en solicitud de JWT" } | Error requesting the 3D Secure JWT. Please try again; if the error persists, contact Kushki support. |
| E018 | Longitud de tarjeta inválida | { code: "E018", message: "Longitud de tarjeta inválida" } | Please verify that the card length is correct. |
| E019 | Comercio no tiene activo 3DS | { code: "E019", message: "Comercio no tiene activo 3DS" } | Merchant does not have 3D Secure authentication enabled. |
{
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}{
"card": {
"name": "John Doe",
"number": "4000000000000002",
"expiryMonth": "01",
"expiryYear": "28",
"cvv": "123"
},
"totalAmount": 59,
"currency": "USD",
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}authRequired property within the security object (security.authRequired) returns true, you must consume the requestValidate3DS() method to display the authentication modal.{
"token": "g9m2XG100000uut73n085881SMOP3bP1",
"secureService": "3dsecure",
"secureId": "61efd064-b9df-4c0c-81fb-5b39a5d0cf9f",
"security": {
"acsURL": "https://merchantacsstag.cardinalcommerce.com/MerchantACSWeb/pareq.jsp?...",
"authenticationTransactionId": "uvvZn0ND0ukTOJIfhfi0",
"authRequired": true,
"paReq": "eNpVUstuwjAQ...",
"specificationVersion": "2.2.0"
}
}requestValidate3DS() method when the transaction needs 3D Secure authentication. This method receives the object obtained when requesting a card token.| Property | Type | Required | Description |
|---|---|---|---|
| kushkiInstance | IKushki | YES | Object with public merchant id and work environment. |
| cardTokenResponse | CardTokenResponse | YES | The response object from the card tokenization process using the API. |
requestValidate3DS() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E005 | Campos 3DS inválidos | { code: "E005", message: "Campos 3DS inválidos" } | 3D Secure authentication error. Verify the data entered. |
| E006 | Error en solicitud de validación de token | { code: "E006", message: "Error en solicitud de validación de token" } | 3D Secure validation session error. Please try again; if the error persists, contact Kushki support. |
{
"token": "g9m2XG100000uut73n085881SMOP3bP1"
}{
"code": "E012",
"message": "Error en inicialización de campos"
}requestSecureInit() again.requestInitAntiFraud() method, which allows you to obtain a JSON Web Token (JWT) required to obtain a card token.requestInitAntiFraud() method by sending a Kushki instance with your merchant configuration and the customer ID.| Property | Type | Required | Description |
|---|---|---|---|
| kushkiInstance | IKushki | YES | Object with public merchant id and work environment. |
| userId | String | YES | Client ID. It can be email, phone number, address, or empty. |
requestInitAntiFraud() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E003 | Error en solicitud de datos del comercio | { code: "E003", message: "Error en solicitud de datos del comercio" } | Error requesting merchant information. Please try again; if the error persists, contact Kushki support. |
| E023 | Error al configurar sesión de Sift | { code: "E023", message: "Error al configurar sesión de Sift" } | Sift configuration error. Please check your Sift settings and try again. |
isSubscription property to true when creating a CardOptions instance.isRequired: false inside the CVV field configuration:cvv configuration from the fields object:periodicity property with the value of custom to get a subscriptionId.subscriptionId is required. It must have been previously created using the recurring charge API with a token obtained from requestToken where isSubscription was set to true.requestDeviceToken() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E003 | Merchant data request error | { code: "E003", message: "Error en solicitud de datos del comercio" } | Error requesting merchant information. Please try again; if the error persists, contact Kushki support. |
| E004 | JWT request error | { code: "E004", message: "Error en solicitud de JWT" } | 3D Secure JWT error. Please try again; if the error persists, contact Kushki support. |
| E005 | Invalid 3DS fields | { code: "E005", message: "Campos 3DS inválidos" } | 3D Secure authentication error. Verify the data entered. |
| E006 | Token validation request error | { code: "E006", message: "Error en solicitud de validación de token" } | 3D Secure validation session error. Please try again; if the error persists, contact Kushki support. |
| E016 | Error in UserId request for subscription | { code: "E016", message: "Error en solicitud de UserId para subscripción" } | Merchant has Sift Science configured and subscriptionId was not found or the request failed. |
| E020 | Merchant data request error | { code: "E020", message: "Error, configuración de campos requeridos no encontrada" } | DeviceTokenRequest body is not defined. |
| Property | Type | Required | Description | Allowed Values |
|---|---|---|---|---|
| fields.cvv.selector | string | YES | Links with the container cvv_id and renders the CVV field. | |
| preventAutofill | boolean | NO | Allows preventing autofill of hosted fields. | true, false |
| styles | Styles | NO | Object for declaring custom styles for hosted fields. |
| Property | Type | Required | Description |
|---|---|---|---|
| kushkiInstance | IKushki | YES | Object with public merchant id and work environment. |
| options | SecureDeviceTokenOptions | YES | Object to get device token for one-click payment. |
initSecureDeviceToken()| Code | Message | Example | Description |
|---|---|---|---|
| E012 | Error en inicialización de campos | { code: "E012", message: "Error en inicialización de campos" } | options or kushkiInstance are null or undefined. |
| E013 | El Id del contenedor de un input no fue encontrado | { code: "E013", message: "El Id del contenedor de un input no fue encontrado" } | A field references a non-existing selector. |
| Property | Type | Description |
|---|---|---|
| token | String | Token to make a charge. |
| cardInfo | Object | Optional. Returned if fullResponse is true when instantiating CardOptions. |
| cardInfo.bin | String | Optional. The card BIN (8 digits). |
| cardInfo.brand | String | Optional. The card brand. |
| cardInfo.expirationDate | String | Optional. The card expiration date. |
| cardInfo.lastFourDigits | String | Optional. The card's last four digits. |
{
"token": "a2b74b7e3cf24e368a20380f16844d16"
}cardInfo:{
"token": "a2b74b7e3cf24e368a20380f16844d16",
"cardInfo": {
"bin": "42424242",
"brand": "visa",
"expirationDate": "11/27",
"lastFourDigits": "4242"
}
}isSubscription field is a checkbox, so specific styles must be applied to this input type. For more details, see the Card Payouts Styles interface.CardPayoutTokenResponse object:isSubscription is checked → returns a CardPayoutSubscriptionTokenResponse with a subscriptionId.initApplePayButton method enables you to render the Apple Pay button and initialize a payment session via the Kushki API.apple-developer-merchantid-domain-association file from Kushki Support (specify UAT or Production).https://{your-domain}/.well-known/apple-developer-merchantid-domain-associationisSubscription: true flag passed to requestApplePayToken, which tells Kushki to generate a subscription token instead of a one-time payment token.#kushki-apple-pay-button).requestApplePayToken is a Kushki card token, not an Apple token. It is pre-processed and ready to be used directly in Kushki's API.isSubscription: true, the resulting token must be used with Kushki's recurring charge API to create a subscription — it cannot be used for a one-time charge.requestBankList() method to get the complete list of available banks.| Property | Type | Required | Description |
|---|---|---|---|
| kushkiInstance | IKushki | YES | Object with public merchant id and work environment. |
requestBankList() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E014 | Error en solicitud de lista de bancos | { code: "E014", message: "Error en solicitud de lista de bancos" } | Error obtaining the bank list. Please try again; if the error persists, contact Kushki support. |
requestBrandsByMerchant() method. This information can be useful to display the payment options available in your store.| Property | Type | Required | Description |
|---|---|---|---|
| kushkiInstance | IKushki | YES | Object with public merchant id and work environment. |
requestBrandsByMerchant() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E021 | Error en solicitud de marcas de tarjetas del comercio | { code: "E021", message: "Error en solicitud de marcas de tarjetas del comercio" } | Please check the information sent and try again. |
| Property | Type | Required | Description |
|---|---|---|---|
| kushkiInstance | IKushki | YES | Object with public merchant id and work environment. |
| body | CommissionConfigurationRequest | YES | Object with currency and amount to calculate commissions. |
requestCommissionConfiguration() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E015 | Error en solicitud de configuración de comisión | { code: "E015", message: "Error en solicitud de configuración de comisión" } | Error getting commission settings. Please try again with the correct information. |
| Property | Type | Required | Description |
|---|---|---|---|
| opts | CardBrandingRequest (Visa, Mastercard) | YES | Object with animation settings (Visa or Mastercard). |
requestInitCardBrandingAnimation() method can return as a KushkiError object:| Code | Message | Example | Description |
|---|---|---|---|
| E022 | Error al generar animación | { code: "E022", message: "Error al generar animación" } | Please verify that the animation configuration parameters are correct. |
requestDeviceToken() method.Got a suggestion on this documentation? Contact us.