PagueloFacil Javascript SDK
The PagueloFacil Node library provides convenient access to the PagueloFacil API from applications written in JavaScript/Typescript
You can read the full documentation of PagueloFacil.
Installation
Usage Examples
API Reference
Running Tests
Install PagueloFacil with npm
import PagueloFacil from 'pageulofacil.js' ;
const pagueloFacil = new PagueloFacil ( cclw , token , 'development' ) ; //change to 'produciton' for production environment
const paymentInfo = {
amount : 1 ,
taxAmount : 0.0 ,
email : "email@mail.com" ,
phone : "61234567" ,
concept : "concept" ,
description : "description" ,
}
const cardInfo = {
cardNumber : "xxxxxxxxxxxxxxxx" ,
expMonth : "1" ,
expYear : "30" ,
cvv : "123" ,
firstName : "FirstName" ,
lastName : "LastName" ,
cardType : "MASTERCARD"
}
const response = await pagueloFacil . Authorization ( paymentInfo , cardInfo ) ;
Reverse Payment Authorization
const reverseInfo = {
amount : 1 ,
description : 'description' ,
codOper : 'SANDBOX_AUTH-XXXXXXXXX'
}
const response = await pagueloFacil . ReverseAuthorization ( reverseInfo ) ;
const paymentInfo = {
amount : 1 ,
taxAmount : 0.0 ,
email : "email@mail.com" ,
phone : "61234567" ,
concept : "concept" ,
description : "description" ,
codOper : "SANDBOX_AUTH-XXXXXXXXX"
}
const response = await pagueloFacil . Capture ( paymentInfo ) ;
const reverseInfo = {
amount : 1 ,
description : 'description' ,
codOper : 'SANDBOX_AUTH-XXXXXXXXX'
}
const response = await pagueloFacil . ReverseCapture ( reverseInfo ) ;
Authorize and Capture Payment (preferred)
const paymentInfo = {
amount : 1 ,
taxAmount : 0.0 ,
email : "email@mail.com" ,
phone : "61234567" ,
concept : "concept" ,
description : "description"
}
const cardInfo = {
cardNumber : "xxxxxxxxxxxxxxxx" ,
expMonth : "1" ,
expYear : "30" ,
cvv : "123" ,
firstName : "FirstName" ,
lastName : "LastName" ,
cardType : "MASTERCARD"
}
const response = await pagueloFacil . AuthCapture ( paymentInfo , cardInfo ) ;
const recurrentInfo = {
amount : 1 ,
taxAmount : 0.0 ,
email : 'email@mail.com' ,
phone : '61234567' ,
concept : 'concept' ,
description : 'description' ,
codOper : 'SANDBOX_AUTH-XXXXXXXXX'
}
const response = await pagueloFacil . Recurrent ( recurrentInfo ) ;
new PagueloFacil ( cclw , token , environment )
Parameter
Type
Description
cclw
string
Required . Your cclw key
token
string
Required . Your token key
environment
development or production
Optional . Type of environment
Parameter
Type
Description
amount
number
Required . Transaction amount
taxAmount
number
Required . Trax amount
email
string
Required . Client email
phone
string
Required . Client phone
concept
string
Required . Transaction concept
description
string
Required . Transaction description
lang
string
Optional . Language
customFieldValues
Array<[string, string, string]>
Optional . Optional fields (id, label, value)
Parameter
Type
Description
cardNumber
string
Required . Client card number
expMonth
string
Required . The expiration month
expYear
string
Optional . The expiration year
cvv
string
Optional . The cvv or cvc
firstName
string
Optional . The client first name
lastName
string
Optional . The client last name
cardType
VISA or MASTERCARD
Optional . The card type
Parameter
Type
Description
codOper
string
Required . codOper return by the transaction
amount
number
Required . Transaction amount
description
string
Required . Transaction description
lang
string
Optional . Language
customFieldValues
Array<[string, string, string]>
Optional . Optional fields (id, label, value)
Parameter
Type
Description
amount
number
Required . Transaction amount
taxAmount
number
Required . Trax amount
email
string
Required . Client email
phone
string
Required . Client phone
concept
string
Required . Transaction concept
description
string
Required . Transaction description
lang
string
Optional . Language
customFieldValues
Array<[string, string, string]>
Optional . Optional fields (id, label, value)
codOper
string
Required . codOper return by the transaction
Parameter
Type
Description
headerStatus
HeaderStatus
Transaction status
serverTime
string
Current server time
message
string or null
Server message
data
Data
Transaction data
success
boolean
Server response if is success or not
HeaderStatus
Parameter
Type
Description
code
number
Server code
description
string
Server status description
Parameter
Type
Description
date
string
Transaction date
authStatus
string
Server session status
cardType
VISA or MASTERCARD
Type of card for the transaction
type
VISA or MASTERCARD
Card provider for the transaction
idtx
number
Id identifier for the transaction
cardToken
string
Token generated by the transaction
totalPay
string
Total amount of the transaction
binInfo
Object
Information of card provider
name
string
Card name
displayNum
string
Last fourth number of the card
operationType
string
Type of operation
returnUrl
string
Callback URL
requestPayAmount
number
Amount to pay of the request
email
string
Client email
codOper
string
Operation code of the transaction
status
boolean
Show if the transaction was successfull or not
messageSys
boolean
Show the system message
Remember to set environment variables CCLW
and TOKEN
To run tests, run the following command