Skip to content

PIX Cash In -- Generate QR Code

Generates a PIX charge with a QR Code for receiving payments into the account associated with your API Key.

Endpoint

POST /api/external/pix/cash-in

Headers

HeaderTypeRequiredDescription
AuthorizationStringYesApiKey {client_id}:{client_secret}
Content-TypeStringYesapplication/json
hmacStringYesHMAC-SHA512 signature of the body (learn more)
Idempotency-KeyStringNoUnique key to prevent duplicate processing (max 256 chars)

Request Body

FieldTypeRequiredDescriptionExample
amountIntegerYesAmount in centavos (R$ 30.00 = 3000)3000
descriptionStringNoCharge description (max 140 characters)"Pedido #1234"
external_idStringNoYour system identifier for tracking. Max 128 chars. Only a-zA-Z0-9._:-. Returned in responses and webhooks."order-9876"

Monetary values

Request values are in centavos (R$ 1.00 = 100). Response values are in base units (R$ 1.00 = 10000). To convert the response to BRL, divide by 10,000. Never use floating point.

Example

bash
BODY='{"amount":3000,"description":"Pedido #1234","external_id":"order-9876"}'
HMAC=$(echo -n "$BODY" | openssl dgst -sha512 -hmac "$CLIENT_SECRET" | awk '{print $2}')

curl -X POST https://api.owem.com.br/api/external/pix/cash-in \
  -H "Authorization: ApiKey $CLIENT_ID:$CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -H "hmac: $HMAC" \
  -d "$BODY"

Success Response (200)

json
{
  "worked": true,
  "transaction_id": "7popu57v6us7p6pcicgq12345",
  "qr_code": "00020126580014br.gov.bcb.pix...",
  "qr_code_image": "data:image/png;base64,iVBORw0KGgo...",
  "external_id": "order-9876",
  "amount": 300000,
  "status": "active",
  "expires_at": "2026-03-07T16:30:00Z"
}
FieldTypeDescription
workedBooleantrue indicates operation success
transaction_idStringUnique charge identifier (QR Code tx_id)
qr_codeStringEMV copy-and-paste code for payment
qr_code_imageStringQR Code image encoded in base64 (PNG)
external_idStringYour identifier, returned as sent. null if not provided
amountIntegerCharge amount in base units (/ 10,000 for BRL). 300000 = R$ 30.00
statusStringInitial status: active (QR Code active for payment)
expires_atStringQR Code expiration date/time (ISO 8601)

Error Response (400)

json
{
  "worked": false,
  "detail": "O campo amount e obrigatorio"
}

Error Response (401)

json
{
  "error": {
    "status": 401,
    "message": "Missing API key credentials. Use Authorization: ApiKey <client_id>:<client_secret>"
  }
}

Error Response (422)

json
{
  "worked": false,
  "detail": "Invalid HMAC signature"
}
  1. Generate the charge with this endpoint
  2. Display the QR Code (qr_code_image) or the copy-and-paste code (qr_code) to the payer
  3. Receive confirmation via Webhook when payment is made
  4. Or query the status: by ID, by E2E, by Tag

QR Code Validity

The generated QR Code is valid for 24 hours. After this period, the charge expires automatically and the status changes to cancelled.

Owem Pay Instituição de Pagamento — ISPB 37839059