npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@clinpays/paygate

v1.0.54

Published

Realizar pagos con visa y mastercard

Downloads

127

Readme

PAYGATE PAYMENTS 🚀

Cómo instalarlo

npm

npm i @clinpays/paygate

Métodos principales

- Paygate.debug(true)

Visualizar en la consola los registros de log de todos los procesos.

| Parámetro | Tipo | Descripción | | ------------| --------| -----------------------------------| | true/false | Boolean | Activa/desactiva el modo debugger |

const Paygate = require('@clinpays/paygate');

Paygate.debug(true/false);

- Paygate.dataCollector(account, safeIdentifier, currency)

Ejecutar el data collector para el servicio de antifraude. Este método debe ser llamado en el frontend, es decir en el navegador del cliente, ya que recolectará información relacionada a este. Este método devuelve una promesa que resuelve con un objeto con los ID de sesiones que deben ser enviados en el payload del método payOrder.

| Parámetro | Requerido | Tipo | Especificación | Formato | Descripción | |-----------------|-----------|---------|-----------------|---------------------------|---------------------------------------------------| | account | Sí | String | - | 66107b9c1318da5f6c995357 | ID del comercio | | safeIdentifier | Sí | String | - | 1234567891234567 | PAN de la tarjeta sin guiones ni espacios | | currency | No | String | ISO 4217 code | HNL | Moneda de la transacción. Valor por defecto HNL |

const Paygate = require('@clinpays/paygate');

async function collector() {
  const result = await Paygate.dataCollector(
    '66107b9c1318da5f6c995357',
    'HNL', 
    '1234567891234567'
  );

  console.log(result);
}
Output: 
{
  sess: 'ID de 32 caracteres' | null,
  bankSess: 'ID de 32 caracteres' | null
}

- Paygate.configure_ecommerce(id, token)

Configurar la cuenta con las credenciales correspondientes para poder realizar cobros. Este método debe ser llamado únicamente en el backend para evitar exponer el token de autenticación.

| Parámetro | Requerido | Tipo | Formato | Descripción | |-----------|-----------|---------|-------------------------------|---------------------| | id | Sí | String | 6610421453866e074b4be7b3 | ID del comercio | | token | Sí | String | JWT (eyJhbGciOiJIUzI1NiIs...) | Token del comercio |

const Paygate = require('@clinpays/paygate');

Paygate.configure_ecommerce('6610421453866e074b4be7b3', 'eyJhbGciOiJIUzI1NiIs...');

- Paygate.payOrder(payload)

Realizar el cobo a la tarjeta. Este método devuelve una promesa que resuelve con el resultado del pago o con un mensaje de error.

Contenido del objeto payload:

Datos personales

| Parámetro | Requerido | Tipo | Formato | Descripción | |---------------|:---------:|---------|-----------------|---------------------------------------------------------------------------| | email | C | String | [email protected] | Correo electrónico del cliente | | mobilePhone | C | String | +5049999999 | Número telefónico del cliente con código de área y sin guiones ni espacios| | customerName | C | String | Jorge Santos | Nombre completo del cliente |

Datos de la tarjeta

| Parámetro | Requerido | Tipo | Formato | Descripción | | ----------------|:---------:| --------| ------------------| ------------------------------------------| | firstName | Sí | String | Jorge | Nombre del tarjetahabiente | | lastName | Sí | String | Santos | Apellido del tarjetahabiente | | safeIdentifier | Sí | String | 1234567891234567 | PAN de la tarjeta sin guiones ni espacios | | validThru | Sí | String | MMYY (1226) | Fecha de expiración de la tarjeta | | cvv | Sí | String | 999 | Código de seguridad de la tarjeta |

Detalle del pago

| Parámetro | Requerido | Tipo | Especificación | Formato | Descripción | | --------------------|:---------:|---------|-------------------------|---------------------| --------------------------------------------------| | amount | Sí | Number | - | 20.50 | Total a cobrar | | currency | No | String | ISO 4217 code | HNL | Moneda de la transacción. Valor por defecto HNL | | referenceId | Sí | String | | ABCDFG-1010 | Referencia única del la orden | | description | Sí | String | | Pago Paygate | Descripción de la orden | | orderNumber | Sí | String | | 100000000 | Número único de orden |

Facturación

| Parámetro | Requerido | Tipo | Especificación | Formato | Descripción | | --------------------|:---------:|---------|-------------------------|---------------------| --------------------------------------------| | b2cc | C | String | ISO 3166-1 alpha-2 | HN | País de factuación en código de dos letras | | billingCountryCode | C | String | ISO 3166-1 Numeric code | 340 | País de factuación en código numérico | | billingState | C | String | ISO 3166-2 | FM | Estado de factuación | | billingCity | C | String | - | Tegucigalpa | Estado o provincia de facturación | | billingAddress1 | C | String | - | Barrio Los Hermanos | Dirección de facturación | | billingPostalCode | C | String | Código ZIP | 11101 | Código postal de facturación |

Servicio de antifraude

| Parámetro | Requerido | Tipo | Formato | Descripción | | ------------|:---------:|---------|---------------------|---------------------------------------------------| | sess | C | String | ID de 32 caracteres | ID de sesión obtenido en el método dataCollector| | bankSess | C | String | ID de 32 caracteres | ID de sesión obtenido en el método dataCollector|

const Paygate = require('@clinpays/paygate');

const = payload = {
  // Datos personales del cliente
  email: "[email protected]",
  mobilePhone: "+5049999999",
  customerName: "Jorge Santos",

  // Datos de la tarjeta
  firstName: "Jorge",
  lastName: "Santos",
  safeIdentifier: "4000000000000000",
  validThru: "1226",
  cvv: "999",

  // Detalle del pago
  amount: 20.50,
  currency: "HNL",
  referenceId: "ABCDFG-1010",
  description: "Pago Paygate",
  orderNumber: "100000000",

  // Facturación
  b2cc: "HN",
  billingCountryCode: "340",
  billingState: "FM",
  billingCity: "Tegucigalpa",
  billingAddress1: "Barrio Los Hermanos",
  billingPostalCode: "11101"

  // Servicio de antifraude
  sess: "f45478b8495e4f7098c07bac0b26c3b1",
  bankSess: ""
};

Con async/await

async function pagar() {
  const result = await Paygate.payOrder(payload);

  console.log(result);
}

Con then/catch

function pagar() {
  Paygate.payOrder(payload)
    .then(result => {
     console.log(result);
    })
    .catch(err => {
      console.log(err);
    });
}
Output: 
{
  _id: "661077d38494c40a4318fb31",
  status: "APPOVED" | "DENIED",
  amount: 20.50,
  tax: 0,
  subtotal: 20.50,
  firstName: "Jorge",
  lastName: "Santos",
  safeIdentifier: "4000-00**-****-0000",
  paymentType: "VISA" | "MASTERCARD",
  sequence: 12345,
  transactionID: "AUTH-123",
  createdAt: 2024-01-01T00:00:00.000
}

Utilidades

- Paygate.getCountriesAndStates()

Obtener listado de países y estados/departamentos disponibles

const Paygate = require('@clinpays/paygate');

const countriesAndStates = await Paygate.getCountriesAndStates();