For the complete documentation index, see llms.txt. This page is also available as Markdown.

🚀Creating a transaction

Service

  • Sends a JSON containing the data required to create an instant charge.

  • Returns a JSON containing the data of the created charge, including the Pix Copy-and-Paste code.

Registration/transaction request

The request to create/register a transaction must have, as the JSON request body, the information required to register the transaction.

Payload example

{
  "cpf": "01234567899", // Change this key to "cnpj" for a legal entity / CNPJ.
  "email": "user@example.com",
  "amount": 1.10,
  "expires": 3600,
  "custom_id": "PN123",
  "custom_data": {
    "chain": "Arbitrum", // Optional (Default: Arbitrum)
    "asset": "USDT", // Optional (Default: USDT)
    "receiver_wallet": "0x4328...edFB995B6I"
  },
  "description": "Subscription charge #PN123",
  "notification_url": "https://your-webhook-domain.com/param=tes&token=abcd-dfg"
}

Request

Requests the creation/registration of a transaction.

PUT https://api.4p.finance/v1/pix/transaction

Submits the request to register a transaction.

Headers

Name
Type
Description

x-api-key*

String

Your API key.

Request Body

Name
Type
Description

expires*

Integer

Lifetime of the charge, in seconds, starting from the creation date. Must be equal to or greater than 300. Maximum: 259200 seconds.

amount*

Number

Original amount of the charge. Must be a value greater than or equal to 0.01, with decimal places.

custom_id *

String

Transaction Id or Pix Id. Allows the receiving user to reconcile payments. Must be unique per Pix transaction and contain a maximum of 255 characters.

description*

String

Represents a text (the Pix solicitacaoPagador field) to be shown to the paying user so they can enter related, free-form information to be sent to the receiving user. Maximum 140 characters.

notification_url *

String

URL that will receive the POST notifications sent by the webhook service right after the Pix payment is made.

custom_data*

Object

Parent object for custom data.

receiver_wallet*

String

Child key of custom_data used to send the wallet of the customer paying via Pix, which will receive the cryptocurrency. Used for cryptocurrency purchases through the PIX API (P2P).

Response

Note that the data object contains the Pix data, including the Copy-and-Paste key (pixCopiaECola). When creating a Pix charge, the receiving user gets the information needed to generate the dynamic QR Code image, along with its representation as a Pix Copy-and-Paste code.

Please note that the QR Code image itself is not generated by the API — that is left up to each implementer.

Conclusion

After the payment is confirmed, the amount converted into cryptocurrency will be automatically sent to the wallet provided in the request payload.

The average time to send and finalize the transaction is approximately 10 seconds, and may vary depending on the selected blockchain network and that network's conditions at the time of the operation.

Learn more about notifications and callbacks in the next section.