Gateway (JavaScript)
Introduction
The Luka JS library provides an object called luka that has three public methods:
init()updateMonto()updateEmail()
Authentication is done through the token returned by the login method using the credentials provided by Lukapay.
init
Function that initializes and renders the component in the HTML node specified in the input parameter.
Input Parameters
| Name | Description | Type | Required |
|---|---|---|---|
| token | Validation and authentication token | String | Yes |
| container | Id of the HTML node where the payment methods will be displayed | String | Yes |
| montoObj | Object that represents the amount to be processed | Object | Yes |
| User's email address making the payment. Can be initialized as null | String | No | |
| idTraza | Unique identifier provided by the merchant to identify the transaction in Lukapay's systems | String | No |
| config | Object that specifies how the component will be displayed | Object | Yes |
| callback | Function called by the library when the transaction is processed; it must receive two parameters | Function | Yes |
| preValidationCall | Optional function provided by the merchant. Must return true or false | Function | No |
| postLoadCallback | Optional function executed when the component finishes loading on the web page | Function | No |
| extraObj | Object that allows adding additional information to the library | Object | No |
Object Properties
montoObj
| Name | Description | Type | Required |
|---|---|---|---|
| monto | Amount to be processed in the transaction | Number | Yes |
| numeroDecimales | Number of decimals to display for the amount | Number | No |
| separadorMiles | Specifies the thousands separator to be used. By default, a period (.) is used | String | No |
| separadorDecimal | Specifies the symbol to be used for separating the integer part from the decimal part. By default, a comma (,) is used | String | No |
config
| Name | Description | Type | Required |
|---|---|---|---|
| moneda | Currency in which the transaction will be conducted | String | No |
| idioma | Language in which the library will be displayed | String | No |
| metodos | Payment methods to load into the component. This is a comma-separated string. Example: "tdc, paypal" | String | No |
| terminos | Object that represents how the terms and conditions will be displayed | Object | No |
| color | Hexadecimal color used for displaying the component | String | No |
| seleccion | Indicator for whether the payment methods will be shown as radio buttons or tabs. Possible values: 1: Radio button, 2: Tabs | Number | No |
| paypal | Paypal button configuration object | Object | No |
| fuente | Font name in which the component will be displayed (if it's a webfont, it must be preloaded) | String | No |
| showSkeletonLoading | Indicator for whether an animation should be shown before the payment form fields load. Possible values: true or false. Default: false | Boolean | No |
| fnValidacionEsAsync | Indicator for whether the optional validation function provided by the merchant is asynchronous or synchronous: Possible values: true or false. Default: false | Boolean | No |
| guardarEnBoveda | Property indicating whether to store credit/debit card information in the user vault. Applies only to credit/debit cards | Boolean | No |
| horizontal | Property indicating whether to display the payment options horizontally. Possible values: true or false. Default: true | Boolean | No |
| estilos | Object with additional styles | Object | No |
terminos
| Name | Description | Type | Required |
|---|---|---|---|
| tipo | Indicator of the type of terms and conditions to display. Possible values: "1": simple, "2": with checkbox | String | No |
| comportamiento | Can be a string or a function. String: assumes it's a link and opens a popup when clicked. Function: executed when clicked. | String / Function | No |
paypal
| Name | Description | Type | Required |
|---|---|---|---|
| color | Specifies the color to display for the Paypal button. Possible values: blue, gold, black, white, silver. Default: black | String | No |
| ocultarMonto | Hide amount on the Paypal button | Boolean | No |
extraObj
| Name | Description | Type | Required |
|---|---|---|---|
| nombrePagador | Name of the person making the payment | String | No |
| referenciaPago | Customer-facing payment identifier (Example: invoice number, contract ID) | String | No |
| mostrarPoweredBy | Show “Powered by” | Boolean | No |
| montoOriginal | Object with information about the original amount. Used when a currency conversion is applied | Object | No |
| lukapayId | User registration ID in the card vault. Returned when true is specified in guardarEnBoveda | String | No |
| mostrarCargosAdicionales | Show additional charges | Boolean | No |
| cuotasConfig | Quotas configuration object | Object | No |
montoOriginal
| Name | Description | Type | Required |
|---|---|---|---|
| Monto | Transaction amount before currency conversion | Number | Yes |
| Moneda | Currency code for the transaction before currency conversion | String | Yes |
| TasaConversion | Exchange rate used during the currency conversion | Number | Yes |
cuotasConfig
| Name | Description | Type | Required |
|---|---|---|---|
| idConfig | Unique identifier for the quotas configuration | Number | Yes |
Output Parameters
The library returns the response object through the function specified in the callback property provided in the init method.
| Name | Description | Type |
|---|---|---|
| Canal | Indicates the channel used for applying the payment in Lukapay | Number |
| CargosAdicionales | Object containing additional charges. | Object |
| Cuotas | Object containing information about installments. | Object |
| Descripción | Contains the response of the payment application, such as transaction status and any additional information | String |
| Exitoso | Indicates whether the transaction was successful or not. This is used to validate the response | Boolean |
| FechaOperacion | Date the transaction occurred | String |
| InfoProceso | Object containing more detailed information about the transaction status | Object |
| InfoTarjeta | Object containing information about the credit card used to make the payment. Only applicable for card payments | Object |
| InfoUsuarioPagador | Object that returns basic information about the user making the payment | Object |
| MedioDePago | Indicates the payment method used | String |
| MerchantId | Transaction reference from the merchant used to apply the payment | String |
| Moneda | Code of the currency used for the payment | String |
| Monto | Indicates the payment amount | Number |
| MontoOriginal | Object with information about the original amount. This is used when currency conversion is needed | Object |
| MontoUsd | Value of the amount in US dollars. This is used when the original amount is specified | Number |
| TarjetaHabiente | Object containing information about the cardholder (if specified) | Object |
| TransaccionId | Transaction reference in Lukapay | Number |
| TransaccionMerchantId | Transaction reference from the merchant used to apply the payment | Number |
| TrazaId | Internal identifier of the merchant. If the merchant does not provide it, a random code is generated | String |
Object Properties
CargosAdicionales
| Name | Description | Type |
|---|---|---|
| Comision | Commission for the selected payment method | Number |
| OtrosCargos | Other charges and fees added to the transaction | Array |
| TotalCargos | Total sum of the commission and other charges | Number |
| MonedaCargos | Currency in which the commission and charges are expressed | String |
Cuotas
| Name | Description | Type |
|---|---|---|
| Cuotas | Array of objects containing details of each installment | Array |
| Contrato | Code associated with the payment installments | String |
| Monto | Total amount of the payment installments | String |
| Moneda | Code of the currency used for the payment | String |
| UrlLink | URL of the payment installment link | String |
Object Properties within the Cuotas Array
| Name | Description | Type |
|---|---|---|
| NumCuota | Installment number | Number |
| Monto | Amount of the installment | String |
| FechaCorte | Due date for the installment payment | String |
| FechaExpiracion | Expiration date for the installment payment | String |
InfoProceso
| Name | Description | Type |
|---|---|---|
| EstatusProcesamiento | Processing status | String |
| CodigoRespuestaCvv | CVV response code | String |
InfoTarjeta
| Name | Description | Type |
|---|---|---|
| Bin | Bank Identification Number (BIN). These are the first 4 to 6 digits of the credit card number | String |
| CategoriaTarjeta | Indicates whether the card is commercial or personal | String |
| FechaVencimiento | Credit card expiration date in MM/YYYY format | String |
| Pais | ISO code of the country where the credit card was issued | String |
| SubTipoTarjeta | Indicates whether the card is credit or debit | String |
| TipoTarjeta | Indicates the type of credit card, e.g., VISA, MASTER | String |
| UltimosCuatroDigitos | Last 4 digits of the credit card | String |
InfoUsuarioPagador
| Name | Description | Type |
|---|---|---|
| Apellido | Last name of the user making the transaction | String |
| Nombre | First name of the user making the transaction | String |
| User's email address | String | |
| NumeroIdentidad | User's identity number or national ID | String |
| NumeroTelefono | User's phone number | String |
TarjetaHabiente
| Name | Description | Type |
|---|---|---|
| Apellido | Last name of the cardholder making the transaction | String |
| Nombre | First name of the cardholder making the transaction | String |
| NúmeroIdentificacionPersonal | Cardholder's identity number | String |
| NumeroTelefono | Cardholder's phone number | String |
| LukapayId | Cardholder's ID in the Lukapay vault. This value is returned only when guardarEnBoveda is set to TRUE in the Init method. The merchant must store this value in their own customer database | String |
Ejemplo de uso
luka.init("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_ adQssw5c",
'container',
{
"monto": 16.03,
"numeroDecimales": null,
"separadorMiles": "",
"separadorDecimal": ""
},
"demo@example.com",
"xxxxxxxxxxxxxx",
{
formBorde: false,
moneda: "USD",
terminos: {
"tipo": "1"
},
idioma: "esp",
color: "c41616",
metodos: "zelle,paypal",
paypal: {
color: "gold"
},
fuente: "Montserrat",
seleccion: 2,
showSkeletonLoading: true,
fnValidacionEsAsync: true,
guardarEnBoveda: false,
horizontal: false,
estilos: {
"color": "#0516b1"
}
},
function (result, error) {
if (error) {
//error handle code
} else {
if (result.Exitoso) {
//success transfer
} else {
//failed transfer
}
}
},
function () {
//intern validation code
return true;
},
function () {
//code with loaded component
},
{
"nombrePagador": "John Doe",
"referenciaPago": "151515",
"lukapayId": "548791",
"cuotasConfig": {
"idConfig": "4"
}
}
);
updateMonto
This function allows you to update the amount to be paid within the component. It can be used when you need to change the transaction amount after the component has been initialized.
Input Parameters
| Name | Description | Type | Required |
|---|---|---|---|
| monto | The new amount you want to set for the transaction | Number | Yes |
| token | Validation and authentication token | String | Yes |
Output Parameters
The function returns true or false to indicate whether the amount was successfully updated.
Usage Example
luka.updateMonto(28.14,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_ adQssw5c"
);
updateEmail
This function allows you to update the email associated with the transaction within the component. It can be used when you need to change the email after the component has been initialized.
Input Parameters
| Name | Description | Type | Required |
|---|---|---|---|
| The new email address you want to update for the transaction | String | Yes | |
| token | Validation and authentication token | String | Yes |
Output Parameters
The function returns true or false to indicate whether the email was successfully updated.
Usage Example
luka.updateEmail("demo@payco.net.ve",
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_ adQssw5c"
);
Webhooks for Asynchronous Payments
Our platform validates the payment reference provided by the user in real-time. If the reference is not automatically found, the transaction is marked as "Pending Review" and retried up to 5 times, with attempts every 2 minutes. If it still cannot be found, the transaction is reviewed manually. In such cases, the user is notified via email. In the integration, the Exitoso field will be marked as true, but you must check InfoProceso.EstatusProcesamiento to determine the actual status of the payment: either success (successful) or pending. The final status is sent through a webhook.
Demo
You can access the demo implementation of the library at: