Cobranças
Criar Cobrança
Cria uma cobrança no cartão de crédito, com suporte a 3DS, antifraude, moeda estrangeira e pagamento recorrente.
Autorização
BearerAuth MutualTLS AutorizaçãoBearer <token>
Token JWT obtido em POST /token
Em: header
Corpo da requisição
application/json
Definições TypeScript
Use o tipo request body no TypeScript.
Corpo da resposta
application/json
curl --request POST \ --url 'https://api.payzu.io/v1/charges' \ --header 'Authorization: Bearer $PAYZU_TOKEN' \ --cert "$PAYZU_CLIENT_CERT" --key "$PAYZU_CLIENT_KEY" \ --header 'Content-Type: application/json' \ --data '{ "amount": 10000, "customer": { "name": "Maria Souza", "identity": "12345678909", "identityType": "CPF", "email": "maria.souza@example.com", "birthdate": "1990-05-20", "phone": "+5511999998888", "address": { "street": "Avenida Paulista", "number": "1000", "complement": "Conjunto 101", "zipCode": "01310100", "city": "Sao Paulo", "state": "SP", "country": "BR", "district": "Bela Vista" } }, "postbackUrl": "https://sualoja.com.br/webhooks/cartao", "paymentType": "creditcard", "cart": [ { "name": "Camiseta PayZu", "quantity": 1, "sku": "CAM-PZ-001", "unitPrice": 10000 } ], "creditCardPayment": { "installments": 1, "card": { "number": "4111111111111111", "holder": "MARIA SOUZA", "expiration": "12/2030", "cvv": "123" }, "currency": "BRL", "authenticate": false, "externalAuthentication": { "cavv": "AAABCZIhcQAAAABZlyFxAAAAAAA=", "xid": "MDAwMDAwMDAwMDAwMDAwMTIzNDU=", "eci": "05", "version": "2.2.0", "referenceId": "8c1b3e2a-1234-4a56-9b78-abcdef012345" }, "fraudAnalysis": { "fingerPrintId": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6", "browser": { "cookiesAccepted": true, "email": "maria.souza@example.com", "hostName": "www.sualoja.com.br", "ipAddress": "200.201.202.203", "type": "Chrome" }, "definedFields": [ { "id": 2, "value": "Web" } ] } }, "recurrence": { "interval": "Monthly", "endDate": "2027-06-12" }, "externalId": "pedido-2025-001"}'// A API PayZu Cartao exige certificado mTLS do cliente em todas as rotas.const url = 'https://api.payzu.io/v1/charges';const response = await fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${process.env.PAYZU_TOKEN}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ amount: 10000, customer: { name: 'Maria Souza', identity: '12345678909', identityType: 'CPF', email: 'maria.souza@example.com', birthdate: '1990-05-20', phone: '+5511999998888', address: { street: 'Avenida Paulista', number: '1000', complement: 'Conjunto 101', zipCode: '01310100', city: 'Sao Paulo', state: 'SP', country: 'BR', district: 'Bela Vista' } }, postbackUrl: 'https://sualoja.com.br/webhooks/cartao', paymentType: 'creditcard', cart: [ { name: 'Camiseta PayZu', quantity: 1, sku: 'CAM-PZ-001', unitPrice: 10000 } ], creditCardPayment: { installments: 1, card: { number: '4111111111111111', holder: 'MARIA SOUZA', expiration: '12/2030', cvv: '123' }, currency: 'BRL', authenticate: false, externalAuthentication: { cavv: 'AAABCZIhcQAAAABZlyFxAAAAAAA=', xid: 'MDAwMDAwMDAwMDAwMDAwMTIzNDU=', eci: '05', version: '2.2.0', referenceId: '8c1b3e2a-1234-4a56-9b78-abcdef012345' }, fraudAnalysis: { fingerPrintId: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6', browser: { cookiesAccepted: true, email: 'maria.souza@example.com', hostName: 'www.sualoja.com.br', ipAddress: '200.201.202.203', type: 'Chrome' }, definedFields: [ { id: 2, value: 'Web' } ] } }, recurrence: { interval: 'Monthly', endDate: '2027-06-12' }, externalId: 'pedido-2025-001' }),});const data = await response.json();console.log(data);import osimport requestsresponse = requests.post( 'https://api.payzu.io/v1/charges', headers={ 'Authorization': f'Bearer {os.environ["PAYZU_TOKEN"]}', 'Content-Type': 'application/json', }, json={ 'amount': 10000, 'customer': { 'name': 'Maria Souza', 'identity': '12345678909', 'identityType': 'CPF', 'email': 'maria.souza@example.com', 'birthdate': '1990-05-20', 'phone': '+5511999998888', 'address': { 'street': 'Avenida Paulista', 'number': '1000', 'complement': 'Conjunto 101', 'zipCode': '01310100', 'city': 'Sao Paulo', 'state': 'SP', 'country': 'BR', 'district': 'Bela Vista' } }, 'postbackUrl': 'https://sualoja.com.br/webhooks/cartao', 'paymentType': 'creditcard', 'cart': [ { 'name': 'Camiseta PayZu', 'quantity': 1, 'sku': 'CAM-PZ-001', 'unitPrice': 10000 } ], 'creditCardPayment': { 'installments': 1, 'card': { 'number': '4111111111111111', 'holder': 'MARIA SOUZA', 'expiration': '12/2030', 'cvv': '123' }, 'currency': 'BRL', 'authenticate': False, 'externalAuthentication': { 'cavv': 'AAABCZIhcQAAAABZlyFxAAAAAAA=', 'xid': 'MDAwMDAwMDAwMDAwMDAwMTIzNDU=', 'eci': '05', 'version': '2.2.0', 'referenceId': '8c1b3e2a-1234-4a56-9b78-abcdef012345' }, 'fraudAnalysis': { 'fingerPrintId': 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6', 'browser': { 'cookiesAccepted': True, 'email': 'maria.souza@example.com', 'hostName': 'www.sualoja.com.br', 'ipAddress': '200.201.202.203', 'type': 'Chrome' }, 'definedFields': [ { 'id': 2, 'value': 'Web' } ] } }, 'recurrence': { 'interval': 'Monthly', 'endDate': '2027-06-12' }, 'externalId': 'pedido-2025-001' }, cert=(os.environ['PAYZU_CLIENT_CERT'], os.environ['PAYZU_CLIENT_KEY']),)print(response.json())200
{
"id": "e3b7a1f2-8c4d-4a09-9f1e-2b6c8d5a7e90",
"externalId": "pedido-1234",
"postbackUrl": "https://seusite.com.br/webhooks/payzu",
"amount": 10000,
"paymentType": "creditcard",
"createdAt": "2026-06-12T14:35:22.000Z",
"updatedAt": "2026-06-12T14:35:24.000Z",
"id": 501,
"name": "Maria Souza",
"identity": "11144477735",
"identityType": "CPF",
"email": "maria.souza@example.com",
"birthdate": "1990-04-15",
"phone": "11999998888",
},
],
"installments": 1,
"authenticate": false,
"currency": "BRL",
"acquirerTransactionId": "1049329871283a5d2b8e",
"authorizationCode": "128734",
"reasonCode": 0,
"reasonMessage": "Successful",
"status": 2,
"returnCode": "6",
"returnMessage": "Operação realizada com sucesso",
"externalAuthentication": {},
"reversedAmount": null,
"reversedDate": null,
"chargeId": "e3b7a1f2-8c4d-4a09-9f1e-2b6c8d5a7e90",
"chargebacks": []
}
}