0.0.2 • Published 8 months ago

paguelofacil.js v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

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.

Content

Installation

Usage Examples

API Reference

Running Tests

Installation

Install PagueloFacil with npm

npm i paguelofacil.js

Usage Examples

import  PagueloFacil  from  'pageulofacil.js';
const  pagueloFacil  =  new  PagueloFacil(cclw, token, 'development'); //change to 'produciton' for production environment
  • Payment Authorization

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);
  • Capture Payment

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);
  • Reverse Capture

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);
  • Recurrent

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);

API Reference

Constructor

new PagueloFacil(cclw, token, environment)
ParameterTypeDescription
cclwstringRequired. Your cclw key
tokenstringRequired. Your token key
environmentdevelopment or productionOptional. Type of environment

PaymentInformation

ParameterTypeDescription
amountnumberRequired. Transaction amount
taxAmountnumberRequired. Trax amount
emailstringRequired. Client email
phonestringRequired. Client phone
conceptstringRequired. Transaction concept
descriptionstringRequired. Transaction description
langstringOptional. Language
customFieldValuesArray<[string, string, string]>Optional. Optional fields (id, label, value)

CardInformation

ParameterTypeDescription
cardNumberstringRequired. Client card number
expMonthstringRequired. The expiration month
expYearstringOptional. The expiration year
cvvstringOptional. The cvv or cvc
firstNamestringOptional. The client first name
lastNamestringOptional. The client last name
cardTypeVISA or MASTERCARDOptional. The card type

ReverseInformation

ParameterTypeDescription
codOperstringRequired. codOper return by the transaction
amountnumberRequired. Transaction amount
descriptionstringRequired. Transaction description
langstringOptional. Language
customFieldValuesArray<[string, string, string]>Optional. Optional fields (id, label, value)

CaptureInformation

ParameterTypeDescription
amountnumberRequired. Transaction amount
taxAmountnumberRequired. Trax amount
emailstringRequired. Client email
phonestringRequired. Client phone
conceptstringRequired. Transaction concept
descriptionstringRequired. Transaction description
langstringOptional. Language
customFieldValuesArray<[string, string, string]>Optional. Optional fields (id, label, value)
codOperstringRequired. codOper return by the transaction

ServerResponse

ParameterTypeDescription
headerStatusHeaderStatusTransaction status
serverTimestringCurrent server time
messagestring or nullServer message
dataDataTransaction data
successbooleanServer response if is success or not

HeaderStatus

ParameterTypeDescription
codenumberServer code
descriptionstringServer status description

Data

ParameterTypeDescription
datestringTransaction date
authStatusstringServer session status
cardTypeVISA or MASTERCARDType of card for the transaction
typeVISA or MASTERCARDCard provider for the transaction
idtxnumberId identifier for the transaction
cardTokenstringToken generated by the transaction
totalPaystringTotal amount of the transaction
binInfoObjectInformation of card provider
namestringCard name
displayNumstringLast fourth number of the card
operationTypestringType of operation
returnUrlstringCallback URL
requestPayAmountnumberAmount to pay of the request
emailstringClient email
codOperstringOperation code of the transaction
statusbooleanShow if the transaction was successfull or not
messageSysbooleanShow the system message

Running Tests

Remember to set environment variables CCLW and TOKEN

To run tests, run the following command

npm run test
0.0.2

8 months ago

0.0.1

8 months ago

0.0.0

8 months ago

0.0.4

8 months ago