Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Cant cancel and refund a COD order: Shopify Admin REST API

Cant cancel and refund a COD order: Shopify Admin REST API

rohanrajpal
Shopify Partner
42 0 14

If I want to cancel and refund an order, i first would hit the calculate endpoint

```
POST https://{{store-name}}/admin/api/{{api-version}}/orders/5322564469010/refunds/calculate.json

```

and then we dump its response to the "refund" object in this endpoint

```
POST https://{{store-name}}/admin/api/{{api-version}}/orders/5322570367250/cancel.json?reason=customer&email=true
```

Now this works great for paid orders, but for COD order, the `transactions` array from the `calculate` endpoint is empty! 

My X-Request-ID is 3764232d-79a2-4975-9b2c-a64fbdf3a7a3


Founder | Spur Feel free to reach out to me at @rohanrajpal98 on Twitter
Replies 2 (2)

rohanrajpal
Shopify Partner
42 0 14

I know there is no "transaction" done for a COD order, but if i cancel the order without refund, then the order amount shows up in the order vs if i cancel a cod order directly using the shopify dashboard, the order amount is set to 0.

So there is definitely some internal API to mark the value of a cancelled cod order as zero, i guess its not just exposed yet.

Founder | Spur Feel free to reach out to me at @rohanrajpal98 on Twitter
rohanrajpal
Shopify Partner
42 0 14

Could anyone find a way? Still stuck on this

Founder | Spur Feel free to reach out to me at @rohanrajpal98 on Twitter