Skip to main content

Subscriptions

Introduction

Lukapay subscriptions allow you to easily accept recurring credit and debit card payments. When using this library, Lukapay affiliates a customer’s data through a JavaScript library without needing PCI compliance, as the buyer’s payment data is tokenized and sent directly to payment processors' servers.

Once the customer’s credit card is affiliated, the company can make payments through an API without needing the customer’s prior approval. The system allows listing a subscriber’s cards and deleting them if payments with that card are no longer desired.

Requirements

To affiliate the subscriber and their payment methods, it is necessary to integrate the Lukapay JavaScript library.

Afterward, through our REST API, you can make recurring payments, list, and delete a customer’s credit cards.

Available Methods

The subscription process is divided into two parts:

Create subscriber token: Credit/Debit card affiliation and storage in the vault via Lukapay JS.

Checkout: Create a transaction for an existing buyer via REST API:

  • Authentication
  • Retrieve the customer's card list
  • Pay with a vault-stored credit card
  • Delete a credit card from the vault.

Create Subscriber Token

Below are the specifications for implementing the Lukapay JavaScript library, which will be used for customer affiliation and tokenization of their payment methods.

Payment Methods

NameCurrencyKeyEnvironment
Credit/Debit CardUSDtdc_bsProduction
Credit/Debit CardCLPtbk_oneclickTesting

Luka JS Implementation

See Luka JS Library Documentation.

Register Card

Depending on the selected currency, the user must complete the registration form by entering credit/debit card information.

Registration Form for USD

Registration form for USD

Checkout

This method is used to generate a recurring charge for the registered buyer from the merchant's application, which controls the payment flow from end to end.
Necessary steps for this process:

  • Generate a token for application authentication.
  • Collect and send the buyer's payment information via REST API.
  • Retrieve the response object LukaPaymentResult.
  • Complete the transaction within the merchant's application.

The URL is specified in Environments.

Authentication is performed via a token (JWT) returned by the login method using the credentials provided by Lukapay. See Documentation.

Retrieve Customer Card List

This method allows you to get the list of cards that the customer has registered in the vault. This step is essential to specify which credit card will be used to make payments in US dollars (USD).

To retrieve the customer's cards, you must provide the LukapayId value, which is returned when creating the card token, and the merchant must associate it with the user in their own database.

Request

GET {URL}/api/v1/tarjetacredito/servicio/{LukapayId}
Headers
Content-Type: application/json
Authorization: Bearer {token}

Response

Body

The response returns a list of objects containing the following credit/debit card information:

FieldDescriptionType
IdUnique identifier of the card in the Lukapay databaseNumber
UltimosCuatroDigitosLast four digits of the cardString
SubTipoTarjetaIndicates whether the card is credit or debitString
TipoTarjetaCard type. Example: VISA, MASTERString
CategoriaTarjetaIndicates whether the card is commercial or personalString
BinBank Identification Number (BIN). These are the first 4 to 6 digits of the credit card numberString
FechaVencimientoExpiration date of the card in MM/YYYY formatString
PaisISO code of the country where the card was issuedString
EstaBovedaIndicates if the card is associated with the user's vaultBoolean
DireccionObject with the billing address of the cardObject
DescripcionName or description provided by the user to easily identify the cardString

Example Usage

Request
GET {URL}/api/v1/tarjetacredito/servicio/560356a272d9

Response Body

[
{
"Id": 1,
"UltimosCuatroDigitos": "1111",
"SubTipoTarjeta": "CREDIT",
"TipoTarjeta": "VISA",
"CategoriaTarjeta": "CONSUMER",
"Bin": "111111",
"FechaVencimiento": "03/2023",
"Pais": "US",
"EstaBoveda": true,
"Direccion": {
"Id": 0,
"Direccion": "Calle 1",
"Ciudad": "Guatire",
"Estado": "Miranda",
"CodigoPostal": "1111"
},
"Descripcion": ""
}
]

Pay with a Credit Card from the Vault

This function allows you to make a payment request using the credit/debit card information previously registered by the user.

Pay in USD

This method requires the credit/debit card information obtained from the "Get Customer Card List" flow to proceed with the payment.

Request

POST {URL}/api/v1/transaccion
Headers
Content-Type: application/json  
Authorization: Bearer {token}
Body
NameDescriptionTypeRequired
EmailTarjetaHabienteUser's emailStringYes
IdCanalChannel ID through which the service is being consumed. Default value: 2NumberNo
IdTrazaTransaction ID in the merchant's system. This field will be used later to check the status of the transaction.StringYes
MonedaISO currency code. Example: USD, CLPStringNo
MontoAmount of the transaction or paymentNumberYes
ReferenciaPayment identifier visible to the customer. Example: invoice number, contract ID, etc.StringNo
TarjetaCreditoInformation of the card to be used for the payment. Obtained from the "Get Customer Card List" method.ObjectYes
TarjetaHabienteInformation about the paying userObjectYes
Properties of the Objects
TarjetaCredito
NameDescriptionType
IdCard ID in the Lukapay database (Required)Number
UltimosCuatroDigitosLast four digits of the cardString
SubTipoTarjetaIndicates whether the card is credit or debitString
TipoTarjetaIndicates the type of credit card. Example: VISA, MASTERString
CategoriaTarjetaIndicates whether the card is commercial or personalString
BinBank Identification Number (BIN). These are the first 4 to 6 digits of the credit card numberString
FechaVencimientoExpiration date of the card in MM/YYYY formatString
PaisISO code of the card's issuing countryString
TarjetaHabiente
NameDescriptionTypeRequired
ApellidoUser's last nameStringNo
NombreUser's first nameStringNo
NumeroIdentificacionPersonalUser's ID numberStringNo
NumeroTelefonoUser's phone numberStringNo
LukapayIdUser's registration ID in the card vault (UUID)StringYes

Response

NameDescriptionType
CanalIndicates the channel used to process the payment in LukapayNumber
CargosAdicionalesObject containing additional chargesObject
CuotasObject containing information about installment paymentsObject
DescripciónContains the payment application response, such as transaction status and any additional informationString
ExitosoIndicates whether the transaction was successful. Used to validate the responseBoolean
FechaOperacionDate the transaction took placeString
InfoProcesoObject containing more detailed status information of the transactionObject
InfoTarjetaObject with information about the credit card used for the payment. Applies only for card paymentsObject
InfoUsuarioPagadorObject that returns basic information about the paying userObject
MedioDePagoIndicates the payment method usedString
MerchantIdMerchant transaction reference used to apply the paymentString
MonedaCurrency code used for the paymentString
MontoIndicates the amount of the payment madeNumber
MontoOriginalObject containing information on the original amount. Used when currency conversion is requiredObject
MontoUsdPayment amount in US dollars. Used when MontoOriginal is specifiedNumber
TarjetaHabienteObject containing information about the payer (if specified)Object
TransaccionIdLukapay transaction referenceNumber
TransaccionMerchantIdMerchant transaction reference used to apply the paymentNumber
TrazaIdInternal merchant identifier. If not provided, a random code is generatedString

Example Usage

{
"Monto":100,
"TarjetaHabiente": {
"Nombre":"Jhon",
"Apellido":"Doe",
"LukapayId":"560356a272d9"
},
"TarjetaCredito": {
"Id": 1,
"UltimosCuatroDigitos": "1111",
"SubTipoTarjeta": "CREDIT",
"TipoTarjeta": "VISA",
"CategoriaTarjeta": "CONSUMER",
"Bin": "111111",
"FechaVencimiento": "03/2023",
"Pais": "US",
},
"IdTraza":"1234567890",
"Moneda":"USD",
"EmailTarjetaHabiente":"usuario@mail.com",
"IdCanal":2,
"Referencia":"000265700237"
}
{
"Monto": 100.0,
"MontoUsd": 100.0,
"InfoProceso": {
"EstatusProcesamiento": "success",
"CodigoRespuestaCvv": "N/D"
},
"TarjetaHabiente": {
"Nombre":"Jhon",
"Apellido":"Doe",
“LukapayId”:”560356a272d9”
"NumeroIdentificacionPersonal": null,
"NumeroTelefono": null,
"LukapayId": "560356a272d9"
},
"InfoUsuarioPagador": {
"Nombre": "Jhon",
"Apellido": "Doe",
"NumeroIdentidad": null,
"NumeroTelefono": null,
"Email": "usuario@mail.com"
},
"Moneda": "USD",
"InfoTarjeta": {
"Id": 1,
"UltimosCuatroDigitos": "1111",
"SubTipoTarjeta": "CREDIT",
"TipoTarjeta": "VISA",
"CategoriaTarjeta": "CONSUMER",
"Bin": "111111",
"FechaVencimiento": "03/2023",
"Pais": "US",
},
"TransaccionId": 102143,
"TransaccionMerchantId": 1108334200,
"Descripcion": "success",
"TrazaId": "1234567890",
"Exitoso": true,
"Canal": "Api",
"MedioDePago": "Débito",
"MontoOriginal": null,
"MerchantId": null,
"FechaOperacion": null,
"CargosAdicionales": null,
"Cuotas": null
}

Pay with CLP

To process a payment in Chilean pesos (CLP) using a previously registered card, you only need to provide the LukapayId along with the transaction details. Below are the method specifications.

Request
POST {URL}/api/v1/transaccion/transbank.authorize
Headers
Content-Type: application/json
Authorization: Bearer {token}
Request Body
NameDescriptionTypeRequired
EmailUser's email addressStringYes
TrazaIdIdentifier of the transaction in the merchant's system. This field will be used later to check the status of a transaction.StringYes
MonedaISO currency code. Example: CLPStringYes
MontoAmount of the transaction or paymentNumberYes
*ReferenciaIdentifier of the payment for the client. Example: invoice number, contract ID, etc.StringNo
LukapayIdIdentification of the user record in the vault of cards.StringYes

Response

Field NameDescriptionType
CanalChannel used to process the paymentNumber
CargosAdicionalesAdditional charges detailsObject
CuotasInformation about payment installmentsObject
DescripciónResponse providing the transaction status and any additional informationString
ExitosoIndicates if the transaction was successfulBoolean
FechaOperacionDate and time of the transactionString
InfoProcesoDetailed information about the transaction statusObject
InfoTarjetaCredit card details used for payment (if applicable)Object
InfoUsuarioPagadorInformation about the customer making the paymentObject
MedioDePagoPayment method usedString
MerchantIdMerchant's transaction identifierString
MonedaCurrency used for the paymentString
MontoAmount paidNumber
MontoOriginalInformation about the original amount (if currency conversion applies)Object
MontoUsdValue of the amount in U.S. dollarsNumber
TarjetaHabientePayer's details if a card is usedObject
TransaccionIdTransaction identifier in LukapayNumber
TransaccionMerchantIdTransaction identifier from the merchantNumber
TrazaIdUnique identifier for the transaction in the merchant's databaseString

For more details on the response objects, see Transaction Response.

Example

Request body
{
"Moneda": "CLP",
"Monto": 100,
"TrazaId": "1234567890",
"LukapayId": "560356a272d9",
"Email": "example@mail.com",
"Referencia": ""
}
Response body
{
"Monto": 100.0,
"MontoUsd": 0.0,
"InfoProceso": {
"EstatusProcesamiento": "success",
"CodigoRespuestaCvv": null
},
"TarjetaHabiente": {
"Nombre": "John",
"Apellido": "Doe",
"NumeroIdentificacionPersonal": "",
"NumeroTelefono": null,
"LukapayId": "6353a328-ef92-454d-826b-f59a01ca62d3"
},
"InfoUsuarioPagador": {
"Nombre": "John",
"Apellido": "Doe",
"NumeroIdentidad": null,
"NumeroTelefono": null,
"Email": "example@mail.com"
},
"Moneda": "CLP",
"InfoTarjeta": null,
"TransaccionId": 102144,
"TransaccionMerchantId": 1108334200,
"Descripcion": "transacción exitosa",
"TrazaId": "1234567890",
"Exitoso": true,
"Canal": "Api",
"MedioDePago": "Transbank",
"MontoOriginal": null,
"MerchantId": null,
"FechaOperacion": null,
"CargosAdicionales": null,
"Cuotas": null
}

Verify the Status of a Transaction

See Transaction Query.

Delete a Credit Card from the Vault

This method allows you to remove a credit card from the vault. You need to provide the card ID to be deleted and the LukapayId of the user.

Request

  • For USD:
DELETE {URL}/api/v1/tarjetacredito/{idTarjeta}/user/{LukapayId}
  • For CLP:
DELETE {URL}/api/v1/transaccion/transbank.unsubscribe/{LukapayId}
Headers
Content-Type: application/json
Authorization: Bearer {token}

Response

The method returns a status code of 202 (Accepted) if the operation is successful; otherwise, it returns an error code.

Errors Code

CodeMessageTranslation Message
400la moneda no está soportadathe currency is not supported
400el correo electrónico es obligatoriothe email address is required
400la tarjeta ya se encuentra registradathe card is already registered
400no se consiguió la tarjeta de créditothe credit card could not be found
400ocurrió un error verificando la información de la tarjeta de créditoan error occurred verifying the credit card information
400identificador de tarjeta inválidoinvalid card identifier
400identificador de usuario inválidoinvalid user identifier
401acceso no autorizadounauthorized access
401usuario no registradouser not registered
401no se consiguieron parámetros de consulta válidosvalid query parameters not found
402monto incorrectoincorrect amount
404no se encontró la tarjeta de créditocredit card not found
409ocurrió un error procesando la transacciónan error occurred processing the transaction
500ocurrió un error inesperadoan unexpected error occurred
500monto menor o igual a ceroamount less than or equal to zero
500no se puede procesar la validación de la tarjeta porque el usuario del servicio no está registradocannot process card validation because the service user is not registered