Docs
Create Pix

Create Pix

This is the main endpoint to generate QR Codes to receive payments in USDt.

This endpoint has some optional parameters and some extra parameters that specific type of integrations would require.

By default you should add one address to receive payments to. That address needs to be previously whitelisted with kamiPay to receive payments. Then you can also setup the duration of the QR code and the amount in BRL to be charged to the payor.

Body Parameters

address
required
string

Specifies where to deposit the payment in USDt

expire
required
integer

Expressed in seconds. Note: Cannot exceed 24 hours duration.

amount
required
float

The amount to charge in BRL. Note: Cannot have more than 2 decimals.

external_reference
optional
str

In this value you can pass any string that you consider relevant. It can be an internal identification in your system or any other text. The idea is to use it as link in case we need to do some verifications with your database.

Extra Body Parameters

There are two ways of integrating kamiPay APIS. One is where the Api User sends all the money to its own wallets to then distribute that to its users, and another way where the Api User is sending to each of its client’s wallets. In that case the Api User can leverage kamipay data model and generate stores and checkouts so when generating pix it'll need to add.

If you are using store/checkout configuration remember to adjust the "address" key to the corresponding one.

store_id
optional
int

Store Id corresponds to an internal kamipay mapping to your api_user. Default value is 1 if this key is empty.

checkout_id
optional
int

Checkout Id corresponds to an internal kamipay mapping to your api_user. Default value is 1 if this key is empty.

chain
optional
str

Default value is polygon. In case you are operating with Tron you can add 'tron'.

As a result of this process, you will get two very important inputs:

  • emv: This is what you will need to render into a QR code, so the payor can scan.

  • operation_id: this is the tracking number so you can then monitor status of this payment

const url = "baseURL/v2/charge/create_dynamic_pix_b2b"
 
const body = {
  address: "0x46d52020**********1fbdcc297d",
  expire: 300,
  amount: 150,
};
 
const response = await fetch(url, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${access_token}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(body),
});

Response samples

{
  emv: "b74eb616ab32414aba182b58232e823a5204000053039865802BR592kamiPayInc",
  operation_id: "1697640236643",
  amount_brl: 150,
  amount_usdt: 28.60243,
  rate: 5.24431,
  date: 1697640243,
  expiration: 1697640543
}