Introduction

Development of the Pix API (Application Programming Interface) by Cielo as payment service provider and transactional account provider and direct participant of Pix, considering the standards defined by the Central Bank of Brazil (“Central Bank”) in the Pix Regulation and other related documents.

The Pix API is an application programming interface standardized by the Central Bank to enable the end user to automate the interaction with the Pix participant that provides payment services.

The Pix API includes the necessary functionalities to enable the receipt of charges in business cases focused on immediate payments, such as points of sale in physical stores and e-commerce solutions.

The Cielo API’s responsibility is to generate a QR Code for payments via Pix, following the security standards required by the Central Bank and identifying some information during the transaction: date and time of the transaction, name of the person carrying out the transaction, as well as the name of the recipient and the amount involved.

Main audience

Customers who have TEF, LIO Integrated and E-commerce capture solutions and wish to transact Pix through these capture solutions.

What is Pix?

Pix is ​​the payment method created by the Central Bank in which resources are transferred between accounts in a few seconds, at any time or day. Pix is ​​a new way of selling in a instant, secure and simple way through Cielo solutions.

How does receiving Pix work at Cielo?

To use Pix, Cielo customers can choose the Pix Account option they prefer, being Simplified Management or Free Movement Management.

Important: all customers enabled for Pix Cielo, as well as new customers, will have the Simplified Management option automatically activated. If desired, Cielo customers can change this option at any time.

If the Cielo customer opts for Free Movement Management, the automatic transfer functionality will be deactivated.

The Pix API includes the necessary features to enable:

Receiving charges in business cases focused on immediate payments, such as points of sale in physical stores and e-commerce solutions;

We are making the APIs available

The Cielo-Pix-v1 API works as follows: The automation/Front-end software used by the receiving user (EC) will access the Cielo-Pix-v1 API and, with the data received as an API response, will present a Dynamic QR Code on a device so that the paying user can read the QR Code through their mobile device to make the payment.

Pix API context

Fluxo PIX

The Pix API is the component of the arrangement that aims to enable the paying or receiving user, in the P2B64 or B2B65 context, to automate the interaction with their payment service provider (PSP), in order to carry out or receive transactions within the scope of the arrangement Pix.

In this context, this version of the Pix API seeks to automate the receiving user’s interaction with their payment service provider (PSP), in order to generate charges and confirm receipt of payment of these charges through Pix.

In the figure above, you can see possible integration paths for the receiving user’s systems with the API PSP Pix.

The receiving user will be able, via the Pix API:

The general aspects relating to the Pix API are detailed below.

General concepts

For the purposes of this document, related expressions and terms are defined as follows:

Pix API features

Entity definitions

The Pix API is structured around some business entities, which group sets of attributes, as defined below:

I - Billing (/cob): represents each of the charges generated through the Pix API, in order to allow the paying user to make an identified payment to the receiving user. Billing is characterized by a set of information that is used for the paying user to make a payment through Pix, generally as a result of a commercial agreement between the paying user and the receiving user, without being confused with the Pix payment itself. . The billing model used is for immediate payment.

Billing states:

II - Pix (/pix): represents a payment received through the Pix payment arrangement.

III - Return: represents a request to return a Pix made, the funds of which are already available in the receiving user’s transactional account.

Return status:

Cardinality between entities

TransactionID lifecycle (txid)

There are two usage situations for the TransactionId (txid) field, which involve different rules for filling it out, as discussed below.

txid in the context of Collections:

Charges for immediate or due payments created through the Pix API are uniquely identified using a txid. The txid can be sent by the receiving user when the charge is generated, and cannot be repeated between different charges, in order to guarantee the correct reconciliation of payments. Alternatively, in the case of charges for immediate payment, it is possible for the receiving user to delegate the generation of the txid to their PSP.

Once a charge is requested to be created through the Pix API, the Receiving PSP must ensure that there is no repetition of the txid for the same receiving user, whether sent by the user or generated by the PSP itself. Therefore, the set of CNPJ or CPF and txid must be unique for a given PSP.

The txid must be a minimum of 26 characters and a maximum of 35 characters in length. The characters accepted in this context are: A-Z, a-z, 0-9.

Feature groups

Features and respective endpoints

The Pix API functionalities, in the current version, are defined in six groups:

I – Collection Management with immediate payment (Cob), which deals with the life cycle of the Billing entity:

Creation and update of billing PUT/cob/{txid}
Creating a charge without passing txid POST/cob
Query a charge GET/cob/{txid}
Charge list query GET/cob
Changing a charge PATCH/cob/{txid}

II – Management of Pix Received (Pix), which deals with the life cycle of Pix and Return entities:

Return request PUT/pix/{e2eid}/devolucao/{id}
Return query GET/pix/{e2eid}/devolucao/{id}

Use cases

The objective of this section is to provide examples of how the Pix API can be used to automate interactions between receiving users and their respective PSPs in transactions associated with Pix. These use cases are NOT intended to exhaust the ways of using or functions made available by the Pix API.

Immediate payment (at the time of purchase) with Dynamic QR Code

Application: Merchants with medium or high sales volumes. Online commerce.

1. The paying user, when making the purchase, informs that they wish to pay with Pix;

2. The automation software used by the receiving user accesses the Pix API to create a charge and, with the data received in response, generates a Dynamic QR Code, which is displayed on any display device:

Service invoked: PUT /cob/{txid}  All data necessary to create the billing payload must be entered, according to the detailed specification. Alternatively, if the receiving user does not want to identify the immediate charge with their own {txid} number, they can choose to use the POST /cob method.

3. The paying user then reads the QR Code with their PSP App and makes the payment;

4. The receiving user, in an automated way, through a new query to the Pix API, checks whether the payment was made: Service invoked: GET /cob/{txid};

5. The receiving user releases the products to the paying user or, in the case of online purchases, confirms receipt of payment. Alternatively, step 4 can be performed using webhooks configured in the corresponding service. In this case, the receiving user would be informed by the Receiving PSP of the credit of a Pix associated with a txid in their transactional account.

Make a return

Application: various (product returns, billing error, product unavailability in stock, etc.) Premise: When the buyer and seller agree, it will be possible to carry out the return process for a Pix transaction. This process must be initiated by the seller, that is, by the person who received the Pix transaction. It is important to pay attention to the deadlines (in accordance with Central Bank regulations).

Important: the return is available exclusively to customers who have free movement of the account and must be carried out through the Cielo Gestão App or, if the customer has one, through the means of capture via the Central Bank Pix API (TEF, LIO Integrada or E-commerce) or via API 3.0 (E-commerce). Customers who choose automatic transfer will not be able to complete the return operation due to lack of balance in their account. To access the promotion, you must change your profile to Free Movement.

The paying user requests the receiving user, via some suitable means of communication, to return all or part of a payment made;

The receiving user agrees and identifies the original payment made by Pix. There are two possible situations:

A. When Pix is ​​associated with a Charge:

B. When Pix is ​​not associated with a Charge. In this case, it is necessary to know, by other means, the EndToEndId of the original Pix. Alternatively, it can be a broad query, bringing a list of Pix received.

The receiving user’s automation software activates the Pix API to perform the return.

Membership Day

The subscription journey is understood as the process through which a receiving user begins to use the services of a specific PSP. From the Pix API point of view, this process must include providing access credentials (Client_IDs and passwords) and certificates to the receiving user.

In the subscription process, the Client_ID provided by the PSP must have a set of scopes that will determine the functionalities to which the Receiving User will have access. The authorization criteria in the scopes are the responsibility of the PSP, which can create different criteria depending on the characteristics of the Receiving User.

In this way, it is possible, for example, that certain functionalities are only accessible by users who meet additional security requirements stipulated by each PSP.

Credential request for development/integration

To use the PIX API, requests must be executed using the respective credentials from the Approval and Production environments.

Environment description:

Production: is the transactional environment integrated into Cielo’s environment. The operations carried out in this environment are real and cannot be undone.

Approval: is the environment intended for testing. Operations are performed in a real, but non-productive, environment.

Homologation

Credentials for the approval environment are requested directly on our Developers Portal

Simply select the APIs below:

API_PIX_My_Apps

After creation, you will be able to view your client_id and client_secret, access: My Credentials

Production

Production: For partners to access Cielo’s customer data, customers need to provide the “keys” to the partner.

And how does the credential creation flow work in production?

Important: New credentials must be generated for each commercial establishment.

1st: On the Cielo website, the Cielo customer accesses the [My Account] portal (https://minhaconta2.cielo.com.br/minha-conta/home) and clicks on My Registration.

2nd: In the Authorizations tab, click on Pix.

3rd: To create credentials, select the New access option.

IMG_PIX_02

4th: Then, click on Create credential.

IMG_PIX_03

5th: Select the partner.

IMG_PIX_04

6th: And click Create.

IMG_PIX_05

7th: Accept the terms of use and check the box.

IMG_PIX_06

8th: And then click the Authenticate and continue button.

IMG_PIX_07

9th: Insert the security token.

Important: token activation must be carried out through Cielo Gestão.

IMG_PIX_08

10th: Ready! Credential created successfully.

IMG_PIX_09

After this step, the customer will be able to copy the Customer ID, Client Secret and Transactional Key to perform onboarding on the partner portal.

Important: Credentials need to be copied/downloaded within 3 minutes. Otherwise, you will need to generate a new credential.

IMG_PIX_10

Pix API: Technical Specification

Protocols and technologies

The Pix API will adopt the following protocols and technologies:

API Definition: The Pix API is detailed in the OpenAPI 3.077 format. Format: The data format used is JSON. Protocol: the receiving user’s automation interacts with the API using web services based on REST over HTTPS.

Security

PSPs must develop and implement the API following good security practices, meeting the mandatory requirements below and the recommendations detailed in this section.

Mandatory security requirements

The PSP must comply with the following requirements:

  1. The customer registration/onboarding process for access to the API must be carried out in an environment logged into the PSP, and must include a secure channel for sending credentials to the user, in order to allow traceability of the actions performed.
  2. The API must support multiple authorization levels or roles, segregating functionalities according to profiles (OAuth scopes) of client users.
  3. The PSP must implement technology that ensures the high availability of the API.
  4. The API must guarantee the confidentiality and integrity of user information and transactions, both in transit and at rest.
  5. The PSP must maintain audit logs of API access for a minimum period of 1 year.
  6. The access credential used in authentication (Client_ID) must be linked to the CNPJ or CPF of the receiving user and must allow access to resources only from transactional accounts held by the associated CNPJ or CPF.

Security

They must be observed to develop and implement the API following good security practices, meeting the mandatory requirements below.

Mandatory security requirements:

  1. The connection to the API must be encrypted using the TLS protocol version 1.2 or higher, only allowing cipher suites that meet the forward secrecy requirement.
  2. The PSP must implement the OAuth 2.0 framework (RFC 6749) with mutual TLS (mTLS – RFC 8705) for API authentication, according to the specifications below:

A. Digital certificates for API clients may be issued by the PSP itself or by external CAs, as defined by each PSP. Certificates self-signed by the client should not be accepted. B. Each PSP must have its own Authorization Server and Resource Server associated with the Pix API, and both must implement mutual TLS. w. The PSP Authorization Server must implement the technique for linking the client certificate to the issued access tokens (“Client Certificate-Bound Access Tokens”), according to section 3 of RFC 8705. d. The PSP Resource Server must confirm that the thumbprint of the certificate associated with the access token presented by the client is the same as that used in TLS (proof-of-possession) authentication. It is. The OAuth flow to be used is the “Client Credentials Flow”. f. OAuth scopes will be defined in the Pix API Open API 3.0 specification and will allow different authorization profiles to be associated with the client software.

  1. The customer registration/onboarding process for access to the API must be carried out in an environment logged into the PSP, and must include a secure channel for sending credentials to the user, in order to allow traceability of the actions performed.
  2. The API must support multiple authorization levels or roles, segregating functionalities according to profiles (OAuth scopes) of client users.
  3. The PSP must implement technology that ensures the high availability of the API.
  4. The API must guarantee the confidentiality and integrity of user information and transactions, both in transit and at rest.
  5. The PSP must maintain audit logs of API access for a minimum period of 1 year.
  6. The access credential used in authentication (Client_ID) must be linked to the CNPJ or CPF of the receiving user and must allow access to resources only from transactional accounts held by the associated CNPJ or CPF.
  7. For the webhooks functionality, notifications from the receiving PSP to the receiving user will travel using an mTLS channel.

The. It is recommended that the certificates used for mutual authentication in the webhook’s TLS channel are the same as those used in the Pix API. In any case, there is no objection to the use of other certificates, subject to agreement between the PSP and the receiving user.

The BC understands that PSPs will be able to adopt the technologies and security solutions for the API that they deem most appropriate, as long as the mandatory security requirements are met and, whenever possible, the recommendations described above, also paying attention to the elements listed in the topics Next.

Swagger API PIX

Access our Developers Portal to view the technical specification of the API in Swagger format