Orders API > Cancelled Order still 'payment pending'

Orders API > Cancelled Order still 'payment pending'

Ceri-Waters
Shopify Partner
98 6 30

Hiya,

So this is an interesting one.. when performing a cancel call on an order, it is left with 'payment_pending' as the Financial Status, but an overall status of cancelled.

I've followed this up with a refund in the same call, but the same happens.

When trying to call a refund on it's own I get "Required parameter missing or invalid"

Here is my json:

{
  "refund": {
    "note": "Customer made a mistake",
		"currency": "GBP",
    "shipping": {
      "full_refund": true
    },
    "refund_line_items": [
      {
        "line_item_id": 6071127310489,
        "quantity": 1,
        "restock_type": "cancel",
        "location_id": 55286497433
      }
    ],
    "transactions": [
      {
        "parent_id": 3437206929561,
        "amount": "1000.01",
        "kind": "void",
        "gateway": "Finance"
      }
    ]
  }
}


The only thing I can think of is the parent_id on the transaction. When looking this value up, it actually returns null. (These Orders are done either by a Manual Payment Method via the Checkout, or alternatively created initially via the Drafts Order API, in both cases I get the same problem).

Here is the result of me retrieving the transactions:

{
  "transactions": [
    {
      "id": 3437206929561,
      "order_id": 2802937725081,
      "kind": "sale",
      "gateway": "Hitachi Finance",
      "status": "pending",
      "message": "Pending the Hitachi Finance payment from the buyer",
      "created_at": "2020-10-07T19:36:47+01:00",
      "test": false,
      "authorization": null,
      "location_id": null,
      "user_id": null,
      "parent_id": null,
      "processed_at": "2020-10-07T19:36:47+01:00",
      "device_id": null,
      "receipt": {},
      "error_code": null,
      "source_name": "580111",
      "amount": "1000.01",
      "currency": "GBP",
      "admin_graphql_api_id": "gid:\/\/shopify\/OrderTransaction\/3437206929561"
    }
  ]
}

 

Any ideas?

Thanks in Advance,

Ceri.

Replies 6 (6)

Not applicable

Hi @Ceri-Waters ,

 

Creating a refund before cancelling the order sounds right. Since you're stuck at the POST call to refunds endpoint try adding these fields to your transactions object:

"currency": "GBD",
        "maximum_refundable": "1000.01" 

 Best,

Achieve Team

Ceri-Waters
Shopify Partner
98 6 30

Hi @Anonymous ,

Thanks for the response - appreciate it.

Hmm no luck I'm afraid 😕

POST: https://xxxx.myshopify.com/admin/api/2020-10/orders/2802937725081/refunds.json

{
  "refund": {
    "note": "Customer made a mistake",
		"currency": "GBP",
    "shipping": {
      "full_refund": true
    },
    "refund_line_items": [
      {
        "line_item_id": 6071127310489,
        "quantity": 1,
        "restock_type": "cancel",
        "location_id": 55286497433
      }
    ],
    "transactions": [
      {
        "parent_id": 3437206929561,
        "amount": "1000.01",
        "kind": "void",
        "gateway": "Finance",
				"currency": "GBP",
        "maximum_refundable": "1000.01" 
      }
    ]
  }
}

 Response:

{
  "errors": {
    "refund": "Required parameter missing or invalid"
  }
}

Thanks,
Ceri.

Ceri-Waters
Shopify Partner
98 6 30

Still no luck, have tried ALOT of different options, including copying and pasting the examples in the Shopify Documentation (replacing ids) and still no luck. Could a Shopify Staff member check one of our requests to see if anything unusual is happening?

x-request-id: 7aa484d3-face-470a-8876-8ebf88638a01

Thanks,

Ceri.

Not applicable

@Ceri-Waters 

Shopify staff are constantly monitoring the forums, but throwing an SOS out there doesn't hurt.

Can you tell us if you are refunding more than the amount paid? And are you refunding through the same payment gateway that you used to receive the funds?

Best,

Achieve Team

Ceri-Waters
Shopify Partner
98 6 30

Hi @Anonymous,

Thank you for the response again.

Yes, and yes to to your queries.

On another one of our custom apps, the Order gets Cancelled and Re-Stocked but again, payment is left as pending 😕

screen.png

The above calls I've been testing with a tool called Insomnia (similar to Postman) to try and get more desirable behaviour.

Frustratingly it seems that I'm getting a 400 Error with any post request 😞 so something else is going on there..

Thanks,
Ceri.

Ceri-Waters
Shopify Partner
98 6 30

Hi @Anonymous,

Finally getting somewhere..

I provided my colleague with an Export from Insomnia of the same export and it worked for him!

Deleting my workspace, and importing it seems to have brought it back to life.

!!!!

Thanks,
Ceri.