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

@ventipay/ventipay

v1.4.0

Published

Librería oficial de VentiPay para Node.js

Downloads

93

Readme

Librería oficial de VentiPay para Node.js

Esta librería provee un acceso conveniente a la API REST de VentiPay para aplicaciones Node.js.

Instalación

Instala la librería utilizando tu package manager favorito.

npm install @ventipay/ventipay
# o
yarn add @ventipay/ventipay

Nota: La librería requiere Node.js 12+.

Uso

La idea de esta librería es reflejar lo más posible el diseño de nuestra API para que, sólo leyendo su documentación, puedas entenderla y utilizarla de manera rápida y simple.

Por cada recurso disponible en la API encontrarás un recurso en esta librería y por cada uno de estos recursos encontrarás acciones a ejecutar sobre ellos.

Inicio

El primer paso es requerir la librería y pasarle tu API Key. Puedes obtener una API Key en el Dashboard de VentiPay y recuerda que esta puede ser usada en modo live o test.

// Requiere la librería y crea el cliente de VentiPay
const ventipay = require('@ventipay/ventipay')('key_test_...'); // Provee tu API Key de modo live o test como primer parámetro del cliente

Ya puedes utilizar la librería y ejecutar acciones sobre los recursos de la API.

Recursos y acciones

La librería ahora te entrega un listado de recursos de la API con sus respectivas acciones. Un recurso se ve reflejado como una propiedad del cliente recién creado y cada acción como un método asociado a esta propiedad.

Ejemplo

// Llamando al método retrieve del recurso checkouts y pasando 2 parámetros.
const checkout = ventipay.checkouts.retrieve('chk_KaIq81HaHvaPq91c8FaK1ua6R', {
    expand: ['customer'],
});

// Imprimiendo el atributo id
console.log(checkout.id);

En este ejemplo se accede al recurso checkouts y al método retrieve. El método recibe 2 parámetros: el ID del recurso a obtener y el atributo opcional expand. Finalmente, se imprime el atributo id del recurso obtenido.

Usualmente los métodos que obtienen o actualizan un recurso (create, update, etc.) reciben un ID como primer parámetro y opciones como segundo parámetro, en cambio los métodos que listan recursos (list) reciben opciones como primer parámetro.

Estas opciones corresponden a los query params o body params encontrados en la documentación de la API.

Listado de recursos

API Pagos

| Recurso | Métodos | | ------ | ------ | | checkouts | retrieve, list, create, refund | | payments | retrieve, list, create, update, refund, capture | | refunds | retrieve, list |

API Suscripciones

| Recurso | Métodos | | ------ | ------ | | subscriptions | retrieve, list, create, update, cancel, suspend, unsuspend | | invoices | retrieve, list, create, update, finalize, pay, send, markUncollectible, void | | products | retrieve, list, create, update |

API Clientes

| Recurso | Métodos | | ------ | ------ | | customers | retrieve, list, create, update |

API Métodos de pago

| Recurso | Métodos | | ------ | ------ | | payment_methods | retrieve, list | | setup_intents | retrieve, create, update, del |

API Eventos

| Recurso | Métodos | | ------ | ------ | | events | retrieve, list |

API Finanzas

| Recurso | Métodos | | ------ | ------ | | balance_transactions | retrieve, list | | payouts | retrieve, list |

Promesas

Los métodos provistos por la librería retornan siempre una Promesa (Promise), por lo que puedes utilizar async/await o then/catch según tu preferencia.

Versionamiento

Utilizamos SemVer para el versionamiento, por lo que puedes actualizar de manera segura cambios a nivel minor y patch.

Changelog

Utilizamos la página de releases de GitHub para documentar cada release.

License

MIT