Hello
Is there a way to issue a partial refund of a customer’s order via API? In the UI it would simply be done using the input, into which an arbitrary value can be entered. According to the docs here, it seems like this is not possible via the API, and the only way is to build a list of refund_line_items. Am I correct here?
Many thanks
1 Like
Hi Gary
Yeh had already consulted docs, unfortunately at a dead end though. I’ve worked out it’s necessary to create a transaction first, and then you pass that transaction object in when creating the refund.
All prior steps seem fine and the transaction is creating correctly, however, when making the final call to create the refund with the below payload, I am returned the error 422 error - “An error occurred while processing your request”
{
"refund": {
"notify": true,
"transactions": [
{
"kind": "refund",
"amount": 10.12,
"gateway": "shopify_payments",
"currency": "GBP",
"parent_id": 6382484750500
}
]
}
}
1 Like
Hey there,
My workflow would be as follows:
- call calculate refund for the order id that you want to return, leave the refund_line_items blank
-
you will get back a refund object with an array of transactions - amount will probably be 0
-
modify the transaction object and change the kind from “sugested_refund” to “refund”
-
modify the amount to the fixed amount that you want to refund e.g. 10.12
-
call the create refund endpoint with the modified refund structure from step one
-
go for a pint cause you are done.
Cheers,
Gary
1 Like
I was really hoping this would work but unfortunately just get nil for transactions back from the refund calculate step.
Hi @PurpleMamba for me Gilbert’s suggestion worked for sure.
This will only work on an order that is paid, if the financial_status is pending and/or the order was created via the admin as of April (I think) then the original order has no transactions until the order has been marked as paid.
Also again, a refund can only be issued for an oder that has been paid 
1 Like