### Install Node.js SDK
Source: https://developers.openpix.com.br/docs/sdk/node/sdk-node-usage
Install the necessary dependencies for the Node.js SDK using npm.
```bash
$ npm install @woovi/node-sdk
```
--------------------------------
### Run Docker Compose
Source: https://developers.openpix.com.br/docs/sdk/php/sdk-php-examples
Execute this command to start the integration environment using Docker Compose if you have it installed.
```bash
docker-compose up
```
--------------------------------
### Install OpenPix React Plugin
Source: https://developers.openpix.com.br/docs/plugin/plugin-react
Install the @openpix/react package using pnpm.
```bash
pnpm install @openpix/react
```
--------------------------------
### Install Core-JS for Polyfills
Source: https://developers.openpix.com.br/docs/plugin/plugin-react
Install core-js to provide polyfills for Promises, which is required by the plugin.
```bash
pnpm install core-js
```
--------------------------------
### Install HTTP Client and PSR-7
Source: https://developers.openpix.com.br/docs/sdk/php/frameworks/laravel/sdk-php-laravel-getting-started
Before installing the OpenPix SDK, ensure you have a compatible HTTP client and PSR-7 implementation. This command installs Guzzle and PSR-7.
```bash
composer require guzzlehttp/guzzle guzzlehttp/psr7
```
--------------------------------
### KYC Onboarding Request Body Example
Source: https://developers.openpix.com.br/docs/kyc/kyc-api-onboarding-create
This is an example of the JSON body required to create a new KYC onboarding record.
```json
{
"taxID": "XX.XXX.XXX/0001-XX",
"correlationID": "my-unique-id",
"representatives": [
{ "taxID": "XXX.XXX.XXX-XX" },
{ "taxID": "XXX.XXX.XXX-XX" }
]
}
```
--------------------------------
### Example API Response for Created Customer
Source: https://developers.openpix.com.br/docs/customer/how-to-create-customer-using-api
This is an example of the response body returned after successfully creating a customer.
```json
{
"customer": {
"name": "NOME DO CLIENTE",
"taxID": { "taxID": "360...", "type": "BR:CPF" },
"correlationID": "d1d46bbd-b010-4beb-b59e-cecf824efb43"
}
}
```
--------------------------------
### Example Error Response - Account Not Found
Source: https://developers.openpix.com.br/docs/account-limits/account-limits-api-limits-get
An example of an error response when the specified account cannot be found.
```json
{
"error": "Account not found"
}
```
--------------------------------
### Example API Response for Created Customer with Address
Source: https://developers.openpix.com.br/docs/customer/how-to-create-customer-using-api
This is an example of the response body returned after successfully creating a customer with an address.
```json
{
"customer": {
"name": "ana",
"correlationID": "6ffa...",
"address": {
"zipcode": "137...",
"street": "R...",
"number": "15",
"neighborhood": "Centro",
"city": "S...",
"state": "SP",
"complement": "Casa"
},
"taxID": { "taxID": "67...", "type": "BR:CPF" }
}
}
```
--------------------------------
### Example Error Response - No Limits Configured
Source: https://developers.openpix.com.br/docs/account-limits/account-limits-api-limits-get
An example of an error response when no limits have been configured for the specified account.
```json
{
"error": "No limits configured for this account"
}
```
--------------------------------
### Response Body Example for Created Subscription
Source: https://developers.openpix.com.br/docs/subscription-recurrence/subscription-with-interests-and-fines-create-api
This is an example of the JSON response received after successfully creating a subscription with overdue charges.
```json
{
"subscription": {
"customer": {
"name": "Fernando Silva",
"email": "fernando@woovi.com",
"phone": "+5531988472275",
"taxID": { "taxID": "13225476617", "type": "BR:CPF" },
"correlationID": "1b112444-6530-46dd-934b-71d50d6c84bc",
"address": {
"zipcode": "30421322",
"street": "Street",
"number": "100",
"neighborhood": "Neighborhood",
"city": "Belo Horizonte",
"state": "MG",
"complement": "APTO",
"country": "BR",
"location": { "coordinates": [] },
"_id": "64b7d32db5a5555c9b750bc0"
}
},
"dayGenerateCharge": 5,
"value": 1500,
"globalID": "UGF5bWVudFN1YnNjcmlwdGlvbjo2M2UzYjJiNzczZDNkOTNiY2RkMzI5OTM="
}
}
```
--------------------------------
### Get One Installment
Source: https://developers.openpix.com.br/api
Retrieves a specific installment using its global ID or the end-to-end ID from the transaction.
```APIDOC
## GET /api/v1/installments/{id}
### Description
Retrieves a specific installment using its global ID or the end-to-end ID from the transaction.
### Method
GET
### Endpoint
/api/v1/installments/{id}
### Parameters
#### Path Parameters
- **id** (string) - Required - The globalID of the installment or the endToEndId from transaction.
### Responses
#### Success Response (200)
The installment retrieved using the given ID
#### Error Response (400)
An error message
```
--------------------------------
### Creating the Client
Source: https://developers.openpix.com.br/docs/sdk/java/java-sdk-usage
Demonstrates how to instantiate the `WooviSDK` client, which is the main entry point for the SDK.
```APIDOC
## Creating the Client
The `WooviSDK` is the primary client for interacting with the OpenPix API.
### Basic Initialization
```java
package br.com.openpix;
import br.com.openpix.sdk.WooviSDK;
public class Main {
public static void main(String[] args) {
// Initialize the SDK with your App ID obtained from OpenPix
WooviSDK sdk = new WooviSDK(System.getenv("APP_ID"));
}
}
```
### Advanced Configuration
The `WooviSDK` constructor can be overloaded to provide custom configurations, such as:
* **Base URL**: Specify a different API endpoint.
* **Executor**: Define the environment for dispatching threads.
* **JSON Instance**: Configure JSON serialization/deserialization parameters (e.g., `explicitNulls`).
* **HTTP Client Instance**: Configure underlying HTTP client parameters.
Refer to the SDK's source code for detailed documentation on these configurations.
```
--------------------------------
### Get a list of installments by subscription
Source: https://developers.openpix.com.br/api
Retrieves a list of installments associated with a specific subscription using its global ID. Supports authorization via AppID.
```APIDOC
## GET /api/v1/subscriptions/{id}/installments
### Description
Retrieves a list of installments for a given subscription.
### Method
GET
### Endpoint
/api/v1/subscriptions/{id}/installments
### Parameters
#### Path Parameters
- **id** (string) - Required - The globalID of the subscription.
### Request Example
```json
{
"example": ""
}
```
### Response
#### Success Response (200)
- **installments** (array) - A list of installment objects.
- **pageInfo** (object) - Information about the pagination of the results.
#### Response Example
```json
{
"installments": [
{
"dateGenerateCharge": "2019-08-24T14:15:22Z",
"expiration": 0,
"installmentNumber": 0,
"value": 0,
"status": "string",
"createdAt": "2019-08-24T14:15:22Z",
"cobr": {
"identifierId": "string",
"recurrencyId": "string",
"installmentId": "string",
"endToEndId": "string",
"rejectCode": "string",
"status": "string",
"value": 0,
"tries": [
{
"tryStatus": "string",
"finalityPurpose": "string",
"rejectCode": "string",
"value": 0,
"requestedExecutionDate": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
],
"paymentDate": "string",
"chargeDate": "string",
"expiryDate": "string",
"description": "string",
"createdAt": "string"
},
"paymentSubscriptionGlobalID": "string",
"correlationID": "string",
"globalID": "string"
}
],
"pageInfo": {
"errors": [
{
"message": "string",
"data": {
"skip": 0,
"limit": 0
}
}
],
"skip": 0,
"limit": 0,
"hasPreviousPage": true,
"hasNextPage": true
}
}
```
```
--------------------------------
### Initialize WooviSDK Client
Source: https://developers.openpix.com.br/docs/sdk/java/java-sdk-usage
Create an instance of WooviSDK using your application ID obtained from the OpenPix website. This is the main entry point for using the SDK.
```java
package br.com.openpix;
import br.com.openpix.sdk.WooviSDK;
import java.util.concurrent.ExecutionException;
public class Main {
public static void main(String[] args) {
// Para começar a usar o SDK Java
WooviSDK sdk = new WooviSDK(System.getenv("APP_ID"));
}
}
```
--------------------------------
### Get Subscription
Source: https://developers.openpix.com.br/docs/sdk/node/sdk-node-resources
Retrieve a subscription by its ID using the `get` method on the subscription resource. This allows you to fetch details of a specific recurring payment setup.
```APIDOC
## Get Subscription
### Description
Retrieves a subscription by its ID.
### Method
`get`
### Parameters
- **id** (string) - Required - The ID of the subscription to retrieve.
### Request Example
```javascript
const response = await woovi.subscription.get({ id: 'algum-id' });
```
```
--------------------------------
### Installation
Source: https://developers.openpix.com.br/docs/sdk/java/java-sdk-usage
Instructions on how to add the OpenPix Java SDK to your project using Maven or Gradle.
```APIDOC
## Installation
To use the Java SDK, ensure you have Java 8.0 or higher installed, along with Gradle or Maven.
### Maven
Add the following to your `pom.xml`:
```xml
mavenCentral
https://repo1.maven.org/maven2/
br.com.openpix
java-sdk
0.0.13
```
### Gradle
Add the following to your `build.gradle`:
```gradle
repositories {
mavenCentral()
}
dependencies {
implementation 'br.com.openpix:java-sdk:0.0.13'
}
```
```
--------------------------------
### Manage OpenPix Subscriptions with Ruby SDK
Source: https://developers.openpix.com.br/docs/sdk/ruby/ruby-sdk-resources
This code example shows how to create and find Subscriptions using the OpenPix Ruby SDK. It details the parameters needed for subscription creation.
```ruby
require 'openpix/ruby_sdk'
app_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
client = Openpix::RubySdk::Client.new(app_id)
# Criar um Subscription
subscription_params = {
client: {
name: "Cliente Legal",
tax_id: "123456"
},
value: 1234
}
# inicializar o body
client.refunds.init_body(params: subscription_params)
# faz o request para criar o recurso
response = client.subscriptions.save
# Buscar um Subscription específico
response = client.subscriptions.find(id: "id-do-subscription")
```
--------------------------------
### Get Installment Request (Node.js)
Source: https://developers.openpix.com.br/api
This Node.js code snippet demonstrates how to retrieve a specific installment using its ID. Remember to replace 'REPLACE_BEARER_TOKEN' with your valid token.
```javascript
const http = require('https');
const options = {
method: 'GET',
hostname: 'api.openpix.com.br',
port: null,
path: '/api/v1/installments/UGF5bWVudFN1YnNjcmlwdGlvbjo2M2UzYjJiNzczZDNkOTNiY2RkMzI5OTM=',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
```
--------------------------------
### KYC Onboarding Response Example
Source: https://developers.openpix.com.br/docs/kyc/kyc-api-onboarding-create
This is an example of the successful response received after creating a KYC onboarding record, including the onboarding link and account details.
```json
{
"linkOnboarding": "https://kyc.woovi.com/onboarding/QWNjb3VudFJlZ2lzdGVyOjY5...",
"accountRegister": {
"status": "PENDING",
"officialName": "RAZAO_SOCIAL_DA_EMPRESA",
"tradeName": "NOME_FANTASIA_DA_EMPRESA",
"taxID": {
"taxID": "XXXXXXXXXXXXXX",
"type": "BR:CNPJ"
},
"correlationID": "my-unique-id",
"representatives": [
{
"name": "NOME_DO_SOCIO",
"taxID": {
"taxID": "XXXXXXXXXXX",
"type": "BR:CPF"
}
}
]
}
}
```
--------------------------------
### Get List of Charges
Source: https://developers.openpix.com.br/openpixPostman.json
Retrieves a list of charges. Supports filtering by start and end date-time.
```json
{
"start": "",
"end": ""
}
```
--------------------------------
### Making a GET Request to Account Limits API
Source: https://developers.openpix.com.br/docs/account-limits/account-limits-api-getting-started
Example of how to make a GET request to retrieve account limits using curl. Ensure you replace placeholders with your actual credentials and account ID.
```bash
curl -X GET https://api.woovi.com/api/v1/limits/SEU_ACCOUNT_ID \
-H "Content-Type: application/json" \
-u "SEU_CLIENT_ID:SEU_CLIENT_SECRET"
```
--------------------------------
### Subscription Creation Response Example
Source: https://developers.openpix.com.br/docs/subscription-recurrence/subscription-recurrence-create-api
This is an example of the response body received after successfully creating a subscription. It includes details of the created subscription.
```json
{
"subscription": {
"globalID": "UGF5bWVudFN1YnNjcmlwdGlvbjo2M2UzYjJiNzczZDNkOTNiY2RkMzI5OTM=",
"value": 100,
"customer": {
"name": "Dan",
"email": "email0@example.com",
"phone": "5511999999999",
"taxID": {
"taxID": "31324227036",
"type": "BR:CPF"
}
},
"dayGenerateCharge": 5
}
}
```
--------------------------------
### Node.js GET Request for Subscription Installments
Source: https://developers.openpix.com.br/api
This Node.js snippet demonstrates how to fetch a list of installments for a given subscription ID using the https module. Ensure you replace 'REPLACE_BEARER_TOKEN' with your actual authorization token.
```javascript
const http = require('https');
const options = {
method: 'GET',
hostname: 'api.openpix.com.br',
port: null,
path: '/api/v1/subscriptions/UGF5bWVudFN1YnNjcmlwdGlvbjo2M2UzYjJiNzczZDNkOTNiY2RkMzI5OTM=/installments',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
```
--------------------------------
### Get a list of charges
Source: https://developers.openpix.com.br/openpixPostman.json
Retrieves a list of charges within a specified time range. Supports filtering by start and end dates.
```APIDOC
## GET /api/v1/charge
### Description
Retrieves a list of charges. You can filter the results by providing `start` and `end` query parameters.
### Method
GET
### Endpoint
/api/v1/charge
### Parameters
#### Query Parameters
- **start** (dateTime) - Optional - The start of the period to filter charges.
- **end** (dateTime) - Optional - The end of the period to filter charges.
```
--------------------------------
### Initiate KYC Onboarding
Source: https://developers.openpix.com.br/docs/tags/kyc
Use this endpoint to start the KYC (Know Your Customer) process for a merchant.
```APIDOC
## POST /api/v1/kyc/onboarding
### Description
Initiates the KYC (Know Your Customer) process for a merchant.
### Method
POST
### Endpoint
/api/v1/kyc/onboarding
### Parameters
This endpoint does not have explicit path, query, or request body parameters documented in the source.
```
--------------------------------
### Close Account (PHP cURL)
Source: https://developers.openpix.com.br/redocusaurus/plugin-redoc-1.yaml
Example of how to close an account using PHP and cURL. This snippet demonstrates the initial setup for the cURL request.
```php
"https://api.openpix.com.br/api/v1/account/6290ccfd42831958a405debc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
```
--------------------------------
### Create KYC Onboarding with cURL
Source: https://developers.openpix.com.br/docs/kyc/kyc-api-onboarding-create
This cURL command demonstrates how to send a POST request to create a KYC onboarding, including optional representative data.
```shell
curl 'https://api.woovi.com/api/v1/kyc/onboarding' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SEU_APPID_AQUI" \
--data-binary '{ \
"taxID": "XX.XXX.XXX/0001-XX", \
"correlationID": "my-unique-id", \
"representatives": [ \
{ "taxID": "XXX.XXX.XXX-XX" } \
] \
}'
```
--------------------------------
### Node.js GET Request for List of Disputes
Source: https://developers.openpix.com.br/api
Example of how to fetch a list of disputes within a date range using Node.js. Remember to replace 'REPLACE_BEARER_TOKEN' with your actual token.
```javascript
const http = require('https');
const options = {
method: 'GET',
hostname: 'api.openpix.com.br',
port: null,
path: '/api/v1/dispute?start=2020-01-01T00%3A00%3A00Z&end=2020-12-01T17%3A00%3A00Z',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
```
--------------------------------
### Node.js GET Request for Single Dispute
Source: https://developers.openpix.com.br/api
Example of how to fetch a single dispute using Node.js and the native 'https' module. Ensure you replace 'REPLACE_BEARER_TOKEN' with your actual token.
```javascript
const http = require('https');
const options = {
method: 'GET',
hostname: 'api.openpix.com.br',
port: null,
path: '/api/v1/dispute/Ea9c291526ae54b4cb41d9909bdf6d792',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
```
--------------------------------
### POST /api/v1/kyc/onboarding
Source: https://developers.openpix.com.br/docs/tags/api
Initiate the Know Your Customer (KYC) process for a merchant.
```APIDOC
## POST /api/v1/kyc/onboarding
### Description
Initiates the Know Your Customer (KYC) process for a merchant.
### Method
POST
### Endpoint
/api/v1/kyc/onboarding
```
--------------------------------
### Example HTML with OpenPix Plugin
Source: https://developers.openpix.com.br/docs/plugin
An example of how to include the OpenPix plugin script within an HTML file, such as in a React application's index.html.
```html
Demo OpenPix Plugin
```
--------------------------------
### Get Subaccount Details with JavaScript Fetch
Source: https://developers.openpix.com.br/docs/subaccount/how-to-get-balance-and-details-of-subaccount-using-api
This JavaScript Fetch example demonstrates how to request subaccount balance and details from the API. Replace 'AUTHORIZATION' with your actual API key.
```javascript
fetch('https://api.openpix.com.br/api/v1/subaccount/chave-pix-subconta', {
method: 'GET',
headers: {
Authorization: 'AUTHORIZATION',
'Content-Type': 'application/json',
},
}).then((res) => res.json());
```
--------------------------------
### Get All Charge Refunds using JavaScript Fetch
Source: https://developers.openpix.com.br/docs/refund/charge-refund-get-all-api
This JavaScript Fetch API example demonstrates how to request all refunds for a charge. Ensure you replace {correlationID} and provide your 'AUTHORIZATION' token.
```javascript
fetch('https://api.woovi.com/api/v1/charge/{correlationID}/refund', {
headers: {
Authorization: 'AUTHORIZATION',
},
}).then((res) => res.json());
```
--------------------------------
### Access SDK Resources
Source: https://developers.openpix.com.br/docs/sdk/php/sdk-php-usage
Demonstrates how to access different resources (e.g., customers) provided by the SDK client.
```php
$client->customers();
```
--------------------------------
### Access Webhook Data in Laravel
Source: https://developers.openpix.com.br/docs/sdk/php/frameworks/laravel/sdk-php-laravel-receiving-webhooks
Retrieve specific data parameters from the incoming webhook request using Laravel's `Request` object's `input` method. This example shows how to get the 'event' parameter.
```php
// Obtém o parâmetro `event` da requisição.
$event = $request->input("event");
```
--------------------------------
### Create Customer Resource
Source: https://developers.openpix.com.br/docs/sdk/node/sdk-node-usage
Example of creating a customer resource using the SDK. Pass the customer creation payload.
```javascript
const client = woovi.customer.create({}); //lembre-se de passar o payload de criação de cliente
```
--------------------------------
### Create Client (CommonJS)
Source: https://developers.openpix.com.br/docs/sdk/node/sdk-node-usage
Initialize the OpenPix SDK client using CommonJS syntax. Requires your application ID.
```javascript
const WooviSdk = require("@woovi/node-sdk");
// Para inicializar
const woovi = WooviSdk.createClient({appId: "seu-app-id"});
```
--------------------------------
### Get Transaction List
Source: https://developers.openpix.com.br/openpixPostman.json
Retrieves a list of transactions within a specified date range or related to a specific charge. Supports filtering by start and end dates, or by charge ID, correlation ID, or transaction ID.
```http
GET /api/v1/transaction?start=&end=&charge=
```
--------------------------------
### Get Account Limits with JavaScript Fetch API
Source: https://developers.openpix.com.br/docs/account-limits/account-limits-api-limits-get
This JavaScript snippet demonstrates how to fetch account limits using the Fetch API. It includes basic authentication setup and logs the daily Pix limit from the response.
```javascript
const clientId = 'SEU_CLIENT_ID';
const clientSecret = 'SEU_CLIENT_SECRET';
const accountId = 'SEU_ACCOUNT_ID';
const credentials = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
const response = await fetch(`https://api.woovi.com/api/v1/limits/${accountId}`, {
method: 'GET',
headers: {
'Authorization': `Basic ${credentials}`,
},
});
const data = await response.json();
console.log(data.limits.pixDayLimit);
// 4000000
```
--------------------------------
### Node.js HTTPS Request for Static QR Code
Source: https://developers.openpix.com.br/api
Example of making an HTTPS GET request to the OpenPix API to retrieve static QR code information using Node.js's built-in 'https' module. Ensure you replace 'REPLACE_BEARER_TOKEN' with your actual token.
```javascript
const http = require('https');
const options = {
method: 'GET',
hostname: 'api.openpix.com.br',
port: null,
path: '/api/v1/qrcode-static',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
```
--------------------------------
### Initialize OpenPix Ruby SDK Client
Source: https://developers.openpix.com.br/docs/sdk/ruby/ruby-sdk-installation
Require the SDK and initialize the client with your application ID obtained from the Woovi platform.
```ruby
require 'openpix/ruby_sdk'
# Seu AppID via https://app.woovi.com/home/applications/tab/list
app_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
client = Openpix::RubySdk::Client.new(app_id)
```
--------------------------------
### Create Client (TypeScript/Module)
Source: https://developers.openpix.com.br/docs/sdk/node/sdk-node-usage
Initialize the OpenPix SDK client using TypeScript or ES Module syntax. Requires your application ID.
```typescript
import { createClient } from "@woovi/node-sdk"
// Para inicializar
const woovi = createClient({appId: "seu-app-id"})
```