Skip to main content
Localpayment enables merchants to process instant payments through Brazil’s Pix system, the country’s revolutionary instant payment platform developed by the Central Bank of Brazil. This guide outlines the process for initiating Pix payments through Localpayment’s API, detailing required parameters, handling responses, and interpreting status codes for seamless integration with Brazil’s real-time payment infrastructure. Pix is Brazil’s instant payment system, developed by the Central Bank of Brazil (BCB). It enables individuals and businesses to send and receive payments in seconds, 24/7, 365 days a year. Localpayment supports two primary Pix payment methods:
  • Pix QR Code: Customers scan a dynamic QR code with their banking app.
  • Pix Copy and Paste (Copia e Cola): Customers copy a Pix code and paste it into their banking or digital wallet app to initiate the transfer.
Both methods use the same API endpoint and provide a fast, secure payment experience.

Before You Begin

Ensure you have:

Step 1. Create Pix Payment

To generate a Pix payment for collection in Brazil, send a POST request to the Create Payin endpoint with Pix-specific parameters.

Key Request Parameters

The request requires several key objects specific to QR payments: See all available parameters in the request.
Same endpoint for both methods: This single API request is used to generate a payment for both Pix QR Code and Pix Copy and Paste (Copia e Cola). The method used by the customer is determined by how you present the payment details returned in the response.

Example Request

Below is an example using curl:
curl

Step 2. Handle the Response

Successful Response

A successful Pix payment creation includes the Pix code data and payment details:

Key Response Fields

Error Response

When Pix generation fails for Brazil, you’ll receive specific error information:

Step 3. Present the Pix Payment

You can present the Pix payment to your customer in one of two ways. The API response provides the necessary data for both.

Option A: Display as a QR Code

  1. Render the QR Code: Use the string from the qr.code field in the API response to generate a scannable QR code image using any QR library.
  2. Customer Scans: The customer scans the QR code with their banking app.
  3. Authorize: The customer confirms the payment details and authorizes the transfer within their app.
  4. Real-time Confirmation: Localpayment receives instant payment notification.
  5. Status Update: Your system receives webhook with payment confirmation.

Best Practices for QR Display

  • Minimum display size: 250x250 pixels for mobile scanning.
  • Maintain 1:1 aspect ratio without distortion.
  • Ensure high contrast (dark on light background).
  • Add quiet zone (white border) around QR code.
  • Include alt text (e.g. “QR Code Payment”).
  • Show Clear Payment Instructions.
  • Handle Time-to-Live (TTL) and Expiration.

Option B: Display as a Copy-and-Paste Code (Copia e Cola)

  1. Present the Code: Display the full string from the qr.code field to your customer as selectable text.
  2. Customer Copies and Pastes: The customer copies the entire code and opens their banking or digital wallet app.
  3. Paste and Pay: The customer pastes the code into the app’s “Pay with Pix Code” or similar field to load the payment details.
  4. Authorize: The customer reviews and authorizes the transfer.
  5. Real-time Confirmation: Localpayment receives instant payment notification.
  6. Status Update: Your system receives webhook with payment confirmation.


Step 4. Track Transaction Status

Monitor Pix payment progress through these methods:

Webhooks (Recommended)

Receive real-time notifications when transaction status changes. Most efficient for production environments.

Status API Endpoint

Query transaction status programmatically. Useful for polling or recovering lost webhook notifications.

Business Portal View

Visual interface for monitoring transactions. Great for manual oversight and detailed transaction analysis.

Common Status Codes

The Localpayment API provides various status codes to indicate the progress and outcome of the payment in the response.
Complete ReferenceView all status codes in our Transaction Status Documentation.

Testing Your Integration

Sandbox Environment

Use the staging environment for testing:

Test QR Scenarios

Verify your integration handles these scenarios:
  1. Successful Payment: Complete Pix payment with instant settlement.
  2. QR Expiration: Handle expired Pix payments gracefully.
  3. Multiple Payment Attempts: Same QR scanned multiple times.
  4. Status Updates: Webhook handling and status polling.

Next Steps

After implementing Pix payments, consider these additional capabilities:

Refund the transaction

If necessary, you can refund the payment to the customer. Refer to the documentation for details.

Review transaction details

You can retrieve transaction information using the Localpayment API for detailed insights.
Last modified on November 10, 2026