Cancel an Order with payment status - pending

Highlighted
New Member
2 0 2

Hi , 

I have an order paid using shopify_payments and has its status as pending in the shop. I'm trying to build a function to cancel such orders with pending status. My normal approach was to call a calculate api and then I would do a subsequent call to the refund api (i do this so that the customer would be able to cancel not just an entire order but also line item wise)

 

But for orders with pending status - there is no transaction response from calculate api (which is understandable). So this what i tried

1.reconstructing the transactions part by fetching information from the order api

2.then changed the transaction 'kind' to void (i looked this up in the transactions api documentation) 

3.and finally called the refund api using this built json but I get no response.

 

I know this seems complicated and there must be a simpler solution and I'm obviously going wrong in all aspects here! Need help!

1 Like
Highlighted
Shopify Staff
Shopify Staff
587 71 128

Hey @TejaswineeKuder,

 

Can you provide the order_id for the order you mentioned? I've used Shopify Payments for years but I've only ever seen paid, authorized, or refunded status. It might be different if you're using Klarna or Sofort, so I'll need to see the order and should be able to make a recommendation from there.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

2 Likes
Highlighted
New Member
2 0 2

Hello @_JB ,

Thank you for your reply. Since we did not have a quick solution back in march we had to park this task for few weeks. We are back at it again and i hope we can pick this up from here! 

when we place an order via shopify_payments (klarna ) the payment status would be 'pending' until we get a pay out and once the pay out is done the payment status is changed to 'paid', what we want to achieve is to be able to cancel orders with status 'pending' .

And since the status is subjected to change within a short span of time (like 2 to 3 days)- it would be great if you could provide me a timeline when you can look into our issue.

I will try to create an order accordingly so that you can look into our request when the status is still 'pending'

1 Like