https://github.com/jonoise/onvo-client
Object Oriented Node.js HTTP Client for the OnvoPay API
https://github.com/jonoise/onvo-client
Last synced: 8 months ago
JSON representation
Object Oriented Node.js HTTP Client for the OnvoPay API
- Host: GitHub
- URL: https://github.com/jonoise/onvo-client
- Owner: jonoise
- License: mit
- Created: 2024-04-23T06:38:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-15T06:31:19.000Z (over 1 year ago)
- Last Synced: 2025-01-15T08:45:41.751Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 228 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Onvo Client
Onvo Client es un cliente de HTTP orientado a objetos para **Node.js** escrito en Typescript para interactuar de forma fácil con la [API de Onvo](https://docs.onvopay.com).
## Installation
### npm
```bash
npm install onvo-client
```
### yarn
```bash
yarn add onvo-client
```
### Usage
La librería está diseñada para ser usada en un entorno de servidor, no incluya esta librería en el frontend de su aplicación ya que expondría su clave secreta.
La clave secreta deber ser guardada en una variable de entorno.
#### Create client and export it
@lib/onvo.ts
```typescript
import { OnvoClient } from 'onvo-client'
export const onvo = new OnvoClient({ api_key: 'YOUR_SECRET_KEY' })
```
#### Use the client in your endpoints
@routes/onvo/customers.ts
```js
import { onvo } from '../lib/onvo'
export const getCustomer = async (id) => {
try {
const customer = await onvo.customers.get(id)
return customer
} catch (error) {
return error
}
}
```
## Resources
Todos los recursos disponibles en la API de Onvo están disponibles como métodos en el cliente excepto el recurso bajo el path `shoppers`. Entre ellos
- `customers`
- `checkouts`
- `payment-intents`
- `payments-methods`
- `products`
- `prices`
- `subscriptions`
- `refunds`
- `shipping-rates`
Para más información sobre los métodos disponibles en cada recurso, puedes consultar la [documentación oficial de Onvo](https://docs.onvopay.com).