Refund API - Calculate Refund Partial Payment Capture, after Partial Refud, wrong Transaction ID

As-LW
Tourist
8 0 1

Take the case that an order has 2 payment Capture transactions and you want to refund both captures individually.

Action | Item | Transaction
Order | Item 1 (2 quantity) | Transaction 1 ($1.50 Authorization)
Order  | Item 1 (1 quantity) | Transaction 2 ($0.75 Capture)
Order  | Item 1 (1 quantity) | Transaction 3 ($0.75 Capture)
Refunds/Calculate | Order | Parent Transaction 2 (maximum_refundable=($1.50))
Refund 1 | Item 1 | Transaction 4 ($0.75 Refund, Parent Transaction 2)
Refunds/Calculate | Order | Parent Transaction 2 (maximum_refundable=($0.75)) 

The final Refund calculation here is returning the wrong Parent transaction ID (2 instead of 3)

Transactions after first refund:

 

 

 

{
    "transactions": [
        {
            "id": 4795862974632,
            "order_id": 3828248445096,
            "kind": "authorization",
            "gateway": "firstdata_e4",
            "status": "success",
            "message": "Transaction Normal - Approved",
            "created_at": "2021-05-11T14:37:32-04:00",
            "test": false,
            "authorization": "******;**********;***",
            "location_id": null,
            "user_id": null,
            "parent_id": null,
            "processed_at": "2021-05-11T14:37:32-04:00",
            "device_id": null,
            "error_code": null,
            "source_name": "web",
            "payment_details": {
                "credit_card_bin": "******",
                "avs_result_code": "Y",
                "cvv_result_code": "M",
                "credit_card_number": "•••• •••• •••• ••••",
                "credit_card_company": "Visa"
            },
            "receipt": "****"
            "amount": "1.50",
            "currency": "USD",
            "admin_graphql_api_id": "gid://shopify/OrderTransaction/4795862974632"
        },
        {
            "id": 4795870740648,
            "order_id": 3828248445096,
            "kind": "capture",
            "gateway": "firstdata_e4",
            "status": "success",
            "message": "Transaction Normal - Accepted by E-xact",
            "created_at": "2021-05-11T14:41:07-04:00",
            "test": false,
            "authorization": "******;**********;***",
            "location_id": null,
            "user_id": null,
            "parent_id": 4795862974632,
            "processed_at": "2021-05-11T14:41:07-04:00",
            "device_id": null,
            "error_code": null,
            "source_name": "5126879",
            "receipt": "****"
            "amount": "0.75",
            "currency": "USD",
            "admin_graphql_api_id": "gid://shopify/OrderTransaction/4795870740648"
        },
        {
            "id": 4795871396008,
            "order_id": 3828248445096,
            "kind": "capture",
            "gateway": "firstdata_e4",
            "status": "success",
            "message": "Transaction Normal - Accepted by E-xact",
            "created_at": "2021-05-11T14:41:24-04:00",
            "test": false,
            "authorization": "******;**********;***",
            "location_id": null,
            "user_id": null,
            "parent_id": 4795862974632,
            "processed_at": "2021-05-11T14:41:24-04:00",
            "device_id": null,
            "error_code": null,
            "source_name": "5126879",
            "receipt": "****"
            "amount": "0.75",
            "currency": "USD",
            "admin_graphql_api_id": "gid://shopify/OrderTransaction/4795871396008"
        },
        {
            "id": 4795903049896,
            "order_id": 3828248445096,
            "kind": "refund",
            "gateway": "firstdata_e4",
            "status": "success",
            "message": "Transaction Normal - Accepted by E-xact",
            "created_at": "2021-05-11T14:56:38-04:00",
            "test": false,
            "authorization": "RETURN;**********;**",
            "location_id": null,
            "user_id": null,
            "parent_id": 4795870740648,
            "processed_at": "2021-05-11T14:56:38-04:00",
            "device_id": null,
            "error_code": null,
            "source_name": "4633533",
            "receipt": "****"
            "amount": "0.75",
            "currency": "USD",
            "admin_graphql_api_id": "gid://shopify/OrderTransaction/4795903049896"
        }
    ]
}

 

 

 

 

Refund/Calculate.json transactions response for 1st refund:

As-LW_0-1620822328523.png

 


Refund/Calculate.json transactions response for 2nd refund:

As-LW_1-1620822238263.png

 

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 182

Hey @As-LW,

Thanks for raising this, we're investigating now. I'll post back here once we have an update to share.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes