curl --request POST \
--url https://api.pagstack.com/v1/transactions/{id}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"reason": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount: 123, reason: '<string>'})
};
fetch('https://api.pagstack.com/v1/transactions/{id}/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pagstack.com/v1/transactions/{id}/refund"
payload = {
"amount": 123,
"reason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "tx_7Fq2kM9xLp",
"object": "transaction",
"livemode": false,
"status": "pending",
"amount": 4990,
"fee": null,
"net_amount": null,
"amount_refunded": 0,
"payment_method": "pix",
"description": "Pedido #1042",
"external_id": "pedido_1042",
"buyer": null,
"pix": {
"code": "PAGSTACK-TESTE-NAO-PAGAVEL:tx_7Fq2kM9xLp",
"qrcode_base64": "data:image/png;base64,iVBORw0KGgo...",
"expires_at": "2026-12-02T14:30:00.000Z"
},
"end_to_end_id": null,
"tracking": {
"utm_source": "meta",
"utm_campaign": "black-friday"
},
"checkout_id": null,
"subscription_id": null,
"bucket": {
"id": "bkt_cm4x9q2k80001",
"name": "Assinaturas Premium",
"slug": "premium"
},
"coupon": null,
"metadata": {},
"dispute_reason": null,
"paid_at": null,
"created_at": "2026-12-02T14:00:00.000Z"
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Reembolsar transação
Devolve ao pagador todo o valor ou parte dele. Sai do seu saldo disponível. Não é possível reembolsar uma transação com contestação em andamento (under_dispute). Gera o evento transaction.refunded.
curl --request POST \
--url https://api.pagstack.com/v1/transactions/{id}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"reason": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount: 123, reason: '<string>'})
};
fetch('https://api.pagstack.com/v1/transactions/{id}/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pagstack.com/v1/transactions/{id}/refund"
payload = {
"amount": 123,
"reason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "tx_7Fq2kM9xLp",
"object": "transaction",
"livemode": false,
"status": "pending",
"amount": 4990,
"fee": null,
"net_amount": null,
"amount_refunded": 0,
"payment_method": "pix",
"description": "Pedido #1042",
"external_id": "pedido_1042",
"buyer": null,
"pix": {
"code": "PAGSTACK-TESTE-NAO-PAGAVEL:tx_7Fq2kM9xLp",
"qrcode_base64": "data:image/png;base64,iVBORw0KGgo...",
"expires_at": "2026-12-02T14:30:00.000Z"
},
"end_to_end_id": null,
"tracking": {
"utm_source": "meta",
"utm_campaign": "black-friday"
},
"checkout_id": null,
"subscription_id": null,
"bucket": {
"id": "bkt_cm4x9q2k80001",
"name": "Assinaturas Premium",
"slug": "premium"
},
"coupon": null,
"metadata": {},
"dispute_reason": null,
"paid_at": null,
"created_at": "2026-12-02T14:00:00.000Z"
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Autorizações
Cabeçalhos
Corpo
Resposta
Sucesso.
Transação: um pagamento Pix recebido.
pending aguardando pagamento, paid paga, expired, canceled, refunded, partially_refunded ou under_dispute: contestação MED aberta pelo pagador, o valor fica bloqueado até a decisão. Na decisão, volta a paid (valor liberado, evento transaction.dispute_released) ou vira refunded (devolvido ao pagador, evento transaction.refunded).
pending, paid, expired, canceled, refunded, partially_refunded, under_dispute Motivo da contestação MED mais recente: fraud (fraude), not_received (produto ou serviço não recebido), not_as_described (diferente do anunciado), duplicate (cobrança duplicada). Continua preenchido depois da decisão. null se a transação nunca foi contestada.
fraud, not_received, not_as_described, duplicate