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/v2/external/pix/cash-inHeaders
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | String | Yes | Bearer {access_token} |
Content-Type | String | Yes | application/json |
hmac | String | Yes | HMAC-SHA512 signature of the body (learn more) |
Request Body
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
amount | Integer | Yes | Amount in cents | 10000 (BRL 100.00) |
description | String | No | Charge description (max 140 characters) | "Order #1234" |
Values in cents
All monetary values are integers in cents. BRL 100.00 = 10000. Divide by 100 to get the value in BRL.
Example
bash
BODY='{"amount":10000,"description":"Order #1234"}'
HMAC=$(echo -n "$BODY" | openssl dgst -sha512 -hmac "$CLIENT_SECRET" | awk '{print $2}')
curl -X POST https://api.owem.com.br/api/v2/external/pix/cash-in \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "hmac: $HMAC" \
-d "$BODY"Success Response (200)
json
{
"worked": true,
"transaction_id": "PIXIN20260307a1b2c3d4e5f6",
"end_to_end_id": "E37839059202603071530000001",
"qr_code": "00020126580014br.gov.bcb.pix...",
"qr_code_image": "data:image/png;base64,iVBORw0KGgo...",
"amount": 10000,
"status": "pending"
}| Field | Type | Description |
|---|---|---|
worked | Boolean | true indicates operation success |
transaction_id | String | Unique transaction identifier |
end_to_end_id | String | BACEN End-to-End ID (E2E) |
qr_code | String | EMV copy-and-paste code for payment |
qr_code_image | String | QR Code image encoded in base64 (PNG) |
amount | Integer | Charge amount in cents |
status | String | Initial status: pending (awaiting payment) |
Error Response (400)
json
{
"worked": false,
"detail": "The amount field is required"
}Error Response (401)
json
{
"worked": false,
"detail": "Invalid or expired token"
}Error Response (422)
json
{
"worked": false,
"detail": "Invalid HMAC"
}Recommended Flow
- Generate the charge with this endpoint
- Display the QR Code (
qr_code_image) or the copy-and-paste code (qr_code) to the payer - Receive confirmation via Webhook when payment is made
- 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.