Consulta de devoluciones

En esta sección se podrá comprender cómo consultar las devoluciones de una orden y conocer los diferentes estados en que puede estar una devolución.

Consultar devoluciones de una orden

Podemos consultar las devoluciones de una orden de la siguiente manera.

curl --location --request GET 'https://api.conekta.io/orders/ord_XXXXXXXXXXX' \
--header 'Content-Type: application/json' \
--header 'Accept: application/vnd.conekta-v2.0.0+json' \
--header 'Authorization: Basic YOUR_PRIVATE_API_KEY'
{
    "livemode": true,
    "amount": 50000,
    "currency": "MXN",
    "payment_status": "paid",
    "amount_refunded": 0,
    "customer_info": {
        "email": "[email protected]",
        "phone": "5555555555",
        "name": "User",
        "object": "customer_info"
    },
    "object": "order",
    "id": "ord_2tV3dPk9GgaNB9xT8",
    "metadata": {},
    "is_refundable": true,
    "created_at": 1678220457,
    "updated_at": 1678220631,
    "line_items": {
        "object": "list",
        "has_more": false,
        "total": 1,
        "data": [
            {
                "name": "Box of Cohiba S1s",
                "unit_price": 50000,
                "quantity": 1,
                "object": "line_item",
                "id": "line_item_2tV3dPk9GgaNB9xT6",
                "parent_id": "ord_2tV3dPk9GgaNB9xT8",
                "metadata": {},
                "antifraud_info": {}
            }
        ]
    },
    "charges": {
        "object": "list",
        "has_more": false,
        "total": 1,
        "data": [
            {
                "id": "64079ca9d6014f0001bff56c",
                "livemode": true,
                "created_at": 1678220457,
                "currency": "MXN",
                "device_fingerprint": "bQ1LRyesr68DTLXqED6PM6R43zzHxu5A",
                "payment_method": {
                    "service_name": "OxxoPay",
                    "barcode_url": "https://pt-common-s3-stg.s3.amazonaws.com/b82841dcf44ae5065f8cd0085e61269317a6bf02.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MM6EA7VM7%2F20230307%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230307T202057Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH0aCXVzLWVhc3QtMSJIMEYCIQCv3Fsz63Um%2B0Vn38NocHbSYpEzsX9VNykW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ature=aebed155ad9c2abbc44546fc92363d77f8dfb8f79e893db8ced76ae89bf6c2eb",
                    "store": "10MON50EDI",
                    "auth_code": 991466079,
                    "object": "cash_payment",
                    "type": "oxxo",
                    "expires_at": 1680825600,
                    "store_name": "OXXO",
                    "reference": "93000262280777"
                },
                "object": "charge",
                "description": "Payment from order",
                "status": "paid",
                "amount": 50000,
                "paid_at": 1678220631,
                "fee": 1160,
                "customer_id": "cus_2tV3frEGmADZsH31P",
                "order_id": "ord_2tV3dPk9GgaNB9xT8",
                "refunds": {
                    "object": "list",
                    "has_more": false,
                    "total": 1,
                    "data": [
                        {
                            "object": "cash_refund",
                            "amount": -50000,
                            "id": "64079d6bd6014f0001bff582",
                            "created_at": 1678220651,
                            "reference": "1021466226004832",
                            "payout_id": "74c81ffd-07f3-47c6-9b0a-ff7a03XXXXX",
                            "status": "pending",
                            "expires_at": 1678393450
                        }
                    ]
                }
            }
        ]
    }
}

La respuesta contiene la orden con sus cargos, dentro de los cargos encontramos la llave refunds.

Estados de una devolución

EstadoDescripción
pendingSe ha generado una nueva devolución pero aún no se ha retirado.
canceledSe muestra cuando una devolución ha sido cancelado por el comercio.
expiredSe muestra cuando una devolución fue expirado y esta no fue cobrada por el usuario.
withdrawnSe muestra cuando una devolución ha sido retirada exitosamente.