Skip to main content

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

NameDescriptionTypeRequired
tokenValidation and authentication tokenStringYes
containerId of the HTML node where the payment methods will be displayedStringYes
montoObjObject that represents the amount to be processedObjectYes
emailUser's email address making the payment. Can be initialized as nullStringNo
idTrazaUnique identifier provided by the merchant to identify the transaction in Lukapay's systemsStringNo
configObject that specifies how the component will be displayedObjectYes
callbackFunction called by the library when the transaction is processed; it must receive two parametersFunctionYes
preValidationCallOptional function provided by the merchant. Must return true or falseFunctionNo
postLoadCallbackOptional function executed when the component finishes loading on the web pageFunctionNo
extraObjObject that allows adding additional information to the libraryObjectNo

Object Properties

montoObj
NameDescriptionTypeRequired
montoAmount to be processed in the transactionNumberYes
numeroDecimalesNumber of decimals to display for the amountNumberNo
separadorMilesSpecifies the thousands separator to be used. By default, a period (.) is usedStringNo
separadorDecimalSpecifies the symbol to be used for separating the integer part from the decimal part. By default, a comma (,) is usedStringNo
config
NameDescriptionTypeRequired
monedaCurrency in which the transaction will be conductedStringNo
idiomaLanguage in which the library will be displayedStringNo
metodosPayment methods to load into the component. This is a comma-separated string. Example: "tdc, paypal"StringNo
terminosObject that represents how the terms and conditions will be displayedObjectNo
colorHexadecimal color used for displaying the componentStringNo
seleccionIndicator for whether the payment methods will be shown as radio buttons or tabs. Possible values: 1: Radio button, 2: TabsNumberNo
paypalPaypal button configuration objectObjectNo
fuenteFont name in which the component will be displayed (if it's a webfont, it must be preloaded)StringNo
showSkeletonLoadingIndicator for whether an animation should be shown before the payment form fields load. Possible values: true or false. Default: falseBooleanNo
fnValidacionEsAsyncIndicator for whether the optional validation function provided by the merchant is asynchronous or synchronous: Possible values: true or false. Default: falseBooleanNo
guardarEnBovedaProperty indicating whether to store credit/debit card information in the user vault. Applies only to credit/debit cardsBooleanNo
horizontalProperty indicating whether to display the payment options horizontally. Possible values: true or false. Default: trueBooleanNo
estilosObject with additional stylesObjectNo
terminos
NameDescriptionTypeRequired
tipoIndicator of the type of terms and conditions to display. Possible values: "1": simple, "2": with checkboxStringNo
comportamientoCan be a string or a function. String: assumes it's a link and opens a popup when clicked. Function: executed when clicked.String / FunctionNo
paypal
NameDescriptionTypeRequired
colorSpecifies the color to display for the Paypal button. Possible values: blue, gold, black, white, silver. Default: blackStringNo
ocultarMontoHide amount on the Paypal buttonBooleanNo
extraObj
NameDescriptionTypeRequired
nombrePagadorName of the person making the paymentStringNo
referenciaPagoCustomer-facing payment identifier (Example: invoice number, contract ID)StringNo
mostrarPoweredByShow “Powered by”BooleanNo
montoOriginalObject with information about the original amount. Used when a currency conversion is appliedObjectNo
lukapayIdUser registration ID in the card vault. Returned when true is specified in guardarEnBovedaStringNo
mostrarCargosAdicionalesShow additional chargesBooleanNo
cuotasConfigQuotas configuration objectObjectNo
montoOriginal
NameDescriptionTypeRequired
MontoTransaction amount before currency conversionNumberYes
MonedaCurrency code for the transaction before currency conversionStringYes
TasaConversionExchange rate used during the currency conversionNumberYes
cuotasConfig
NameDescriptionTypeRequired
idConfigUnique identifier for the quotas configurationNumberYes

Output Parameters

The library returns the response object through the function specified in the callback property provided in the init method.

NameDescriptionType
CanalIndicates the channel used for applying the payment in LukapayNumber
CargosAdicionalesObject containing additional charges.Object
CuotasObject containing information about installments.Object
DescripciónContains the response of the payment application, such as transaction status and any additional informationString
ExitosoIndicates whether the transaction was successful or not. This is used to validate the responseBoolean
FechaOperacionDate the transaction occurredString
InfoProcesoObject containing more detailed information about the transaction statusObject
InfoTarjetaObject containing information about the credit card used to make the payment. Only applicable for card paymentsObject
InfoUsuarioPagadorObject that returns basic information about the user making the paymentObject
MedioDePagoIndicates the payment method usedString
MerchantIdTransaction reference from the merchant used to apply the paymentString
MonedaCode of the currency used for the paymentString
MontoIndicates the payment amountNumber
MontoOriginalObject with information about the original amount. This is used when currency conversion is neededObject
MontoUsdValue of the amount in US dollars. This is used when the original amount is specifiedNumber
TarjetaHabienteObject containing information about the cardholder (if specified)Object
TransaccionIdTransaction reference in LukapayNumber
TransaccionMerchantIdTransaction reference from the merchant used to apply the paymentNumber
TrazaIdInternal identifier of the merchant. If the merchant does not provide it, a random code is generatedString

Object Properties

CargosAdicionales

NameDescriptionType
ComisionCommission for the selected payment methodNumber
OtrosCargosOther charges and fees added to the transactionArray
TotalCargosTotal sum of the commission and other chargesNumber
MonedaCargosCurrency in which the commission and charges are expressedString

Cuotas

NameDescriptionType
CuotasArray of objects containing details of each installmentArray
ContratoCode associated with the payment installmentsString
MontoTotal amount of the payment installmentsString
MonedaCode of the currency used for the paymentString
UrlLinkURL of the payment installment linkString
Object Properties within the Cuotas Array
NameDescriptionType
NumCuotaInstallment numberNumber
MontoAmount of the installmentString
FechaCorteDue date for the installment paymentString
FechaExpiracionExpiration date for the installment paymentString

InfoProceso

NameDescriptionType
EstatusProcesamientoProcessing statusString
CodigoRespuestaCvvCVV response codeString

InfoTarjeta

NameDescriptionType
BinBank Identification Number (BIN). These are the first 4 to 6 digits of the credit card numberString
CategoriaTarjetaIndicates whether the card is commercial or personalString
FechaVencimientoCredit card expiration date in MM/YYYY formatString
PaisISO code of the country where the credit card was issuedString
SubTipoTarjetaIndicates whether the card is credit or debitString
TipoTarjetaIndicates the type of credit card, e.g., VISA, MASTERString
UltimosCuatroDigitosLast 4 digits of the credit cardString

InfoUsuarioPagador

NameDescriptionType
ApellidoLast name of the user making the transactionString
NombreFirst name of the user making the transactionString
EmailUser's email addressString
NumeroIdentidadUser's identity number or national IDString
NumeroTelefonoUser's phone numberString

TarjetaHabiente

NameDescriptionType
ApellidoLast name of the cardholder making the transactionString
NombreFirst name of the cardholder making the transactionString
NúmeroIdentificacionPersonalCardholder's identity numberString
NumeroTelefonoCardholder's phone numberString
LukapayIdCardholder'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 databaseString

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

NameDescriptionTypeRequired
montoThe new amount you want to set for the transactionNumberYes
tokenValidation and authentication tokenStringYes

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

NameDescriptionTypeRequired
emailThe new email address you want to update for the transactionStringYes
tokenValidation and authentication tokenStringYes

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.

Learn more about webhooks.

Demo

You can access the demo implementation of the library at:

https://qa.lukapay.io/demo.luka.v2