New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

asaas

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asaas

Unofficial Asaas Payment Gateway SDK

latest
npmnpm
Version
1.1.0
Version published
Weekly downloads
536
42.18%
Maintainers
1
Weekly downloads
 
Created
Source

Unofficial Asaas Payment Gateway SDK

❗SDK and documentation under development.

A simple sdk made to abstract most of the Asaas payment gateway api requests.

last update: 06/05/2024 Items updated:

  • Global: Added option to disable automatic error logging (printError)
  • Payments: Added support split array.

Author

  • Eduardo Matheus Bernardo Silva
  • Idxcode

Reference

Features

SDK Documentation

Get Start

Import the package and instantitate a new Client:

import { AsaasClient } from 'asaas';

const asaas = new AsaasClient(process.env.ASAAS_API_KEY);

Authentication

Every request to the Asaas API needs an API Key, which must be passed as the first parameter in the constructor. To obtain your API Key, access the Integration Tab in the Account Settings area.

Optionally you can set base url, enable sandbox mode and set sandbox mode base url.

import { AsaasClient } from 'asaas';

//Instantiate a new client
const asaas = new AsaasClient(process.env.ASAAS_API_KEY, {
  //baseUrl?: string (default: https://api.asaas.com/v3);
  //sandbox?: boolean;
  //sandboxUrl?: string (default: https://sandbox.asaas.com/api/v3);
  //printError?: boolean (default: true); // Determines whether errors will be automatically logged to the console
});

Sandbox Mode

To enable Sandbox Mode, pass to the client's constructor, as the second parameter, an object with sandbox information as true. The default sandbox URL is https://sandbox.asaas.com/api/v3

import { AsaasClient } from 'asaas';

const asaas = new AsaasClient(process.env.ASAAS_API_KEY, {
  sandbox: true;
  //sandboxUrl?: string (default: https://sandbox.asaas.com/api/v3);
  //baseUrl?: string (default: https://api.asaas.com/v3);
});

Error Logging

By default, the library automatically logs errors to the console when request failures occur. You can disable this behavior by setting the printError option to false:

import { AsaasClient } from 'asaas';

const asaas = new AsaasClient(process.env.ASAAS_API_KEY, {
  printError: false // Disables automatic error logging to the console
});

Customers

Return all customers

Returns customers. Filters can be applied, passing an object with the items allowed in the official documentation.

import { AsaasClient } from 'asaas';

const asaas = new AsaasClient(process.env.ASAAS_API_KEY, {
  // sandbox: boolean;
  //sandboxUrl?: string (default: https://sandbox.asaas.com/api/v3);
  //baseUrl?: string (default: https://api.asaas.com/v3);
});

//It lists all registered customers and makes a filter by email.
await asaas.customers.list({
  email: "email@email.com"
});
ParameterTypeDescription
namestringFilter by Name.
emailstringFilter by Email.
cpfCnpjstringFilter by CPF or CNPJ.
groupNamestringFilter by Group.
externalReferencestringFilter by External Reference.
offsetnumberOffset of search.
limitnumberLimit of results.

Return customer by ID

import { AsaasClient } from 'asaas';

const asaas = new AsaasClient(process.env.ASAAS_API_KEY, {
  // sandbox: boolean;
  //sandboxUrl?: string (default: https://sandbox.asaas.com/api/v3);
  //baseUrl?: string (default: https://api.asaas.com/v3);
});

//It returns a customer by ID.
await asaas.customers.getById("cus_123abcde456");
ParameterTypeDescription
idstringRequired. Customer ID

Payments

Return all payments

Returns payments. Filters can be applied, passing an object with the items allowed in the official documentation.

import { AsaasClient } from 'asaas';

const asaas = new AsaasClient(process.env.ASAAS_API_KEY, {
  // sandbox: boolean;
  //sandboxUrl?: string (default: https://sandbox.asaas.com/api/v3);
  //baseUrl?: string (default: https://api.asaas.com/v3);
});

//It lists all registered payments and makes a filter by customer ID.
await asaas.payments.list({
  customer: "cus_123abcde456"
});
ParameterTypeDescription
customerstringFilter by Customer ID.
customerGroupNamestringFilter by Customer group name.
billingTypestringFilter by Billing Type.
statusstringFilter by Status.
subscriptionstringFilter by Subscription ID.
installmentstringFilter by Installment ID.
externalReferencestringFilter by External Reference.
paymentDate`

Keywords

asaas

FAQs

Package last updated on 29 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts