Comunidade

Ask a Question
Back to All

Erro em realizar devoluções

Olá, estou gerando cobranças e pagando elas corretamente ( sandbox)
Porém não consigo realizar uma devolução válida. Seguem exemplos
Consultando cobrança para verificar ID ;

"id": "CHAR_2F84E068-815F-4E09-82EB-625025319654",
"reference_id": "24",
"status": "PAID",
"created_at": "2022-06-22T16:17:47.431-03:00",
"paid_at": "2022-06-22T16:17:47.000-03:00",
"description": "Mauá",
"amount": {
    "value": 1500,
    "currency": "BRL",
    "summary": {
        "total": 1500,
        "paid": 1500,
        "refunded": 0
    }
},
"payment_response": {
    "code": "20000",
    "message": "SUCESSO",
    "reference": "032416400102"
},
"payment_method": {
    "type": "CREDIT_CARD",
    "installments": 2,
    "capture": true,
    "card": {
        "brand": "visa",
        "first_digits": "411111",
        "last_digits": "1111",
        "exp_month": "12",
        "exp_year": "2030",
        "holder": {
            "name": "nome"
        }
    },
    "soft_descriptor": "empresa"
},
"links": [
    {
        "rel": "SELF",
        "href": "https://sandbox.api.pagseguro.com/charges/CHAR_2F84E068-815F-4E09-82EB-625025319654",
        "media": "application/json",
        "type": "GET"
    },
    {
        "rel": "CHARGE.CANCEL",
        "href": "https://sandbox.api.pagseguro.com/charges/CHAR_2F84E068-815F-4E09-82EB-625025319654/cancel",
        "media": "application/json",
        "type": "POST"
    }
],
"notification_urls": [
    "https://meusite.com/notifications"
],
"metadata": {}

}

Request de devolução:
POST /charges/CHAR_2F84E068-815F-4E09-82EB-625025319654/cancel HTTP/1.1
Content-Type: application/json
x-api-version: 4.0
Authorization: Bearer {{token_secreto_aqui}}
User-Agent: PostmanRuntime/7.29.0
Accept: /
Postman-Token: 55584ad4-211c-4c96-916b-a4250e2f9597
Host: sandbox.api.pagseguro.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 39

{
"amount": {
"value": 1500
}
}

HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
Content-Length: 75
Connection: keep-alive
Date: Fri, 24 Jun 2022 16:36:58 GMT
x-amzn-RequestId: 7a4de20d-1354-45e2-95ce-6f43cc2e03da
x-amzn-Remapped-Connection: keep-alive
X-Request-ID: 62537927e5514305
x-amz-apigw-id: UPE2lH_JIAMFq7A=
x-amzn-Remapped-Date: Fri, 24 Jun 2022 16:36:58 GMT
X-Cache: Error from cloudfront
Via: 1.1 f0c1e077419cdb0ce2c159407ed3cbf0.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: GRU3-C1
X-Amz-Cf-Id: _bnKo6DruuqEOjtRPlO8Ow2EHoDLEI1Bp_UVwG-lJGZqVxD06KDPUQ==

{"error_messages":[{"code":"14008","message":"transaction is not found."}]}

O CHAR_ID é o mesmo, já tentei todos IDS disponíveis em diversas formas de conseguir informações sobre a cobrança, o valor é o mesmo também.