MagenMagen Docs

Send Pix

Path 1: by Pix key

Look up the key in DICT

Before paying, validate the recipient by querying DICT via GET /pix/key. It confirms the key exists and returns the holder so you can compare with what you expect.

curl "https://api.magen.processamento.com/v1/pix/key?key=joao@example.com" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json"
const url = new URL('https://api.magen.processamento.com/v1/pix/key');
url.searchParams.set('key', 'joao@example.com');

const res = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.MAGEN_TOKEN}`,
    'Content-Type': 'application/json',
  },
});
const dict = await res.json();
res = requests.get(
    'https://api.magen.processamento.com/v1/pix/key',
    params={'key': 'joao@example.com'},
    headers={
        'Authorization': f'Bearer {os.environ["MAGEN_TOKEN"]}',
        'Content-Type': 'application/json',
    },
)
dict_info = res.json()

More details at DICT Lookup.

Execute the withdrawal

Use POST /withdraw with the validated key. pixType accepts: cpf, cnpj, phone, email, evp.

curl -X POST https://api.magen.processamento.com/v1/withdraw \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 250.00,
    "pixKey": "joao@example.com",
    "pixType": "email",
    "callbackUrl": "https://seusite.com.br/webhooks/magen",
    "clientReference": "payout-2025-08-001",
    "description": "Pagamento referente ao pedido #1234"
  }'
const res = await fetch('https://api.magen.processamento.com/v1/withdraw', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MAGEN_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    amount: 250.00,
    pixKey: 'joao@example.com',
    pixType: 'email',
    callbackUrl: 'https://seusite.com.br/webhooks/magen',
    clientReference: 'payout-2025-08-001',
    description: 'Pagamento referente ao pedido #1234',
  }),
});
const withdraw = await res.json();
res = requests.post(
    'https://api.magen.processamento.com/v1/withdraw',
    headers={
        'Authorization': f'Bearer {os.environ["MAGEN_TOKEN"]}',
        'Content-Type': 'application/json',
    },
    json={
        'amount': 250.00,
        'pixKey': 'joao@example.com',
        'pixType': 'email',
        'callbackUrl': 'https://seusite.com.br/webhooks/magen',
        'clientReference': 'payout-2025-08-001',
        'description': 'Pagamento referente ao pedido #1234',
    },
)

Path 2: by QR Code

Read the QR first (optional)

If the QR was scanned from an external client, extract the data before paying via POST /pix/qrcode/read.

curl -X POST https://api.magen.processamento.com/v1/pix/qrcode/read \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "qrCode": "00020126870014br.gov.bcb.pix..." }'

Magen supports only dynamic QR Code. Static QR is not processed.

Execute the payment

POST /withdraw/qrcode. If the QR already has an embedded amount, amount can be omitted.

curl -X POST https://api.magen.processamento.com/v1/withdraw/qrcode \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "qrCode": "00020126870014br.gov.bcb.pix...",
    "amount": 100.00,
    "callbackUrl": "https://seusite.com.br/webhooks/magen",
    "clientReference": "payout-qr-2025-08-001"
  }'

Track status

The withdrawal starts as PENDING and progresses to COMPLETED, CANCELED, or ERROR. The callback arrives at each transition. To query manually via GET /withdraw:

curl "https://api.magen.processamento.com/v1/withdraw?clientReference=payout-2025-08-001" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json"

Receipt

After COMPLETED, download the official receipt via GET /withdraw/proof/{id}:

curl "https://api.magen.processamento.com/v1/withdraw/proof/MAGEN2025..." \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json"

Common errors

ErrorResolution
Insufficient balanceCheck GET /user/balance first
Invalid Pix keyValidate via DICT first
Amount below minimumamount ≥ R$ 0.01 (key) or ≥ R$ 0.10 (QR)
Different recipientCompare dict.name with what you expect before paying

On this page