Pular para o conteúdo principal

Generate QR Code

Generating PIX Charge

This endpoint creates a PIX charge and returns the QR Code that your customer will use to pay.

Create PIX Charge

Two versions are available (same payload, different error format).

POST /payins

Headers

NameTypeDescription
x-api-token *stringAuthentication token for your integration.
x-provider-id *stringProvider/partner identifier assigned by Lulipay.
x-provider *stringProvider name (company/partner name).
x-country-code *stringCountry code for the operation (for example, BR).
x-idempotency-key *stringUnique key per logical operation attempt to prevent duplication.

How to use x-idempotency-key correctly

This header protects your integration from duplicate processing during retries (timeouts, network instability, etc.).

Recommended rules:

  1. Generate a unique key per business operation (for example, UUID v4).
  2. Reuse the same key only when retrying the same operation.
  3. Never reuse the same key for different operations.
  4. Persist the key in your system for traceability and reconciliation.

Example:

x-idempotency-key: 6f5d8f77-2f5c-4219-a5c8-4d7742fcb3c5

Request Body

NameTypeRequiredDescription
valuenumberYesPIX charge amount
descriptionstringNoCharge description (up to 140 chars)
buyer_cpfstringYesCPF of the payer (only digits, length 11)
buyer_namestringYesPayer name
buyer_emailstringYesPayer e-mail
webhook_urlstringYesURL that will be triggered when the charge is paid
generate_qrcodebooleanNoWhen true, the response includes qr_code_base64; when false, qr_code_base64 is not returned.
expirationintNoTime in seconds before the QR Code expires (20 – 172800). Default 240 s

Successful response (200)

{
"id": "bac1b8d7-24ce-4b53-b6d9-babd3aa60968",
"pix_id": "61c21aet-3452-8644v-3vvb2-234886cc",
"acquirer_id": "LPAYTESTPIXQRCODE154",
"qr_code": "00000000000000000000br.gov.bcb.pix012...",
"qr_code_base64": "iVBORw0KGgoAAAANSUhEUgAAA..."
}

qr_code_base64 is returned only when generate_qrcode is true.

Error response example (Validation)

{
"message": "Erro na validação",
"code": "VALIDATION_ERROR",
"errors": [
{
"message": "Insira um email válido",
"code": "INVALID_VALUE",
"field": "email"
}
]
}

Error Codes

CodeDescription
VALIDATION_ERRORErrors found in request payload
INVALID_VALUEInvalid field value
NOT_PROCESSABLEValid payload but cannot be processed
NO_ACTIVE_CREDENTIALNo active credential configured
EXTERNAL_ERRORError in partner system
DUPLICATED_VALUEResource with given value already exists
REQUIRED_VALUEA required field was not sent
EMPTY_VALUEField sent empty

Examples

curl --request POST "https://gateway.lulipay.com/v1/payins" --header "Content-Type: application/json" --header "x-api-token: YOUR_API_TOKEN" --header "x-provider-id: YOUR_PROVIDER_ID" --header "x-provider: YOUR_PROVIDER_NAME" --header "x-country-code: BR" --header "x-idempotency-key: 6f5d8f77-2f5c-4219-a5c8-4d7742fcb3c5" --data '{
"value": 1,
"description": "",
"buyer_cpf": "",
"buyer_name": "",
"buyer_email": "",
"webhook_url": "",
"generate_qrcode": true,
"expiration": 172800
}'