Create a Pix QR Code

Valid for integration with the "Cielo2" provider.

This is the new Pix integration you should follow from 09/01.

ℹ️

Learn more about this feature in the documentation.

To generate a Pix QR code through Gateway de Pagamento, integrate according to the specification below.

The required field Payment.Type must be sent as "Pix". The response will return the base64 code of the Pix QR Code image, which the store must provide to the buyer.

⚠️

The maximum expiration time for the Pix QR Code by Cielo is 24 hours. This expiration time can be changed in the Payment.QrCodeExpiration field.

Request

EnvironmentMethodEndpoint
Productionhttps://api.braspag.com.br/v2/sales/

The new Pix integration does not yet have a sandbox environment available.

{
    "MerchantOrderId": "1234567890",
    "Customer": {
        "Name": "Aline de Souza",
        "Identity": "077...",
        "IdentityType": "CPF"
    },
    "Payment": {
        "Type": "Pix",
        "Amount": 100,
        "Provider": "Cielo2"       
    }
}

Header parameters

PropertyDescriptionTypeSizeRequired
MerchantIdMerchant identifier in Gateway de Pagamento.Text36Yes
MerchantKeyPublic key for dual authentication in Gateway de Pagamento.Text40Yes
RequestIdRequest identifier, used when the merchant uses different servers for each GET/POST/PUT.Text36No

Body parameters

FieldTypeDescription
MerchantOrderIdtextOrder identification number. Special characters are not allowed.
Size: 25
Customer.NametextShopper's name.
Size: 255.
Customer.IdentitytextShopper's CPF or CNPJ number.
Size: 18.
Payment.TypetextPayment method type. In this case, enter “Pix”.
Size: 15.
Payment.ProvidertextPayment provider name. In this case, "Cielo2"
Payment.AmountnumberOrder amount, in cents.
Payment.QrCodeExpirationnumberQR Code expiration time, in seconds. (E.g.: 30 minutes = 1800).
This field is optional; if not informed, the default value is 86400 (24h).

Response

{
    "MerchantOrderId": "7a8...",
    "Customer": {
        "Name": "Aline de Souza",
        "Identity": "211...",
        "IdentityType": "CPF"
    },
    "Payment": {
        "QrCodeBase64Image": "iVB...",
        "QrCodeString": "00020...",
        "SentOrderId": "f72...",
        "PaymentId": "f72...",
        "Type": "Pix",
        "Amount": 100,
        "ReceivedDate": "2024-11-25 11:30:33",
        "Currency": "BRL",
        "Country": "BRA",
        "Provider": "Cielo2",
        "ReasonCode": 0,
        "ReasonMessage": "Successful",
        "Status": 12,
        "ProviderReturnCode": "0",
        "ProviderReturnMessage": "QRCode gerado com sucesso",
        "Links": [
            {
                "Method": "GET",
                "Rel": "self",
                "Href": "https://apiquerysandbox.braspag.com.br/v2/sales/f72965cb-e5d3-42fd-8fc3-4eaa51c9427e"
            }
        ]
    }
}

Response parameters

The table below presents the main parameters that can be returned by Gateway de Pagamento when generating a QR code for Pix payment:

FieldTypeDescription
Payment.QrCodeBase64ImagetextBase64 of the QRCode image generated for Pix payment.
Payment.QrCodeStringtextPix code (Copy and paste) that can be used for payment.
Payment.SentOrderIdtextPix transaction identifier, represents the txid.
Payment.ReturnCodenumberReturn code.
Payment.ReturnMessagetextReturn message.
Payment.PaymentIdtextTransaction identifier used for query.
Payment.ProviderReturnCodetextProvider return code.
Payment.ProviderReturnMessagetextProvider return message.

Field Changes

See the changes in the fields returned when updating the provider from Cielo30 to Cielo2:

FieldsPrevious integrationNew integration (Cielo2)
AcquirerOrderIdRepresented the QR Code ID.No longer exists.
ProofOfSaleRepresented the Pix NSU.No longer exists.
SentOrderIdRepresented the MerchantOrderId.Now represents the txid.

All other fields remain the same.