Issue with changing order status

khrystyna_zh
New Member
4 0 0

Hi there!
We have a manual payment app, it works fine for all our shops except for a new one.
For this specific case we can't capture payment. We're sending a request

{
  "transaction" : {
    "kind" : "capture",
    "gateway" : "manual",
    "status" : "success",
    "test" : false,
    "amount" : 22.92,
    "currency" : "CHF",
    "parent_id" : "#{transaction_id}"
  }
}

to

POST /admin/api/#{api_version}/orders/#{order_id}/transactions.json

 receive 200 and "status":"pending".

Also we cannot cancel order. We send

/admin/api/#{api_version}/orders/#{order_id}/cancel.json
headers=[X-Shopify-AccessToken:#{private_app_password}]}

and receive code=404, message=, body={"errors":"Not Found"}

Are there any shop settings that could potentially block our attempts to change order status or some other apps could do as well? Because the same requests work fine for other shops.

0 Likes
hassain
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 135

Hi @khrystyna_zh ,

 

Would it be possible for you to share the value of the X-Request-ID response header from the Shopify API response to your "POST transactions.json" request and your "POST cancel.json" request? With this information we can go through our platform logs and see why these errors or unexpected outcomes occurred.  

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

0 Likes
khrystyna_zh
New Member
4 0 0

Hi @hassain,

 

Here are request ids for these requests:

POST transactions.json: x-request-id=[114ecb69-53e5-466b-90ef-52ba8f0e11ec] (2020-04-23)

POST cancel.json: x-request-id=[3b33135b-9840-44ad-8a85-56b905a7a4cf] (2020-04-24)

 

0 Likes
hassain
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 135

Hi @khrystyna_zh ,

 

Thank you for sending these X-Request-IDs over, this was super helpful.

 

From our platform logs I can see in both cases, your app was sending GET requests instead of POST requests. 

 

E.g. on 04-23 you sent GET "/admin/api/2019-07/orders/2222173618312/transactions.json", which explains why you received a 200 instead of a 201, and the transaction was not created. And on 04-24 you sent a GET "/admin/api/2019-07/orders/2225895014536/cancel.json" - which is an endpoint that does not exist so therefore you got a 404 error.

 

Change these requests so you use a POST instead of a GET and they should begin to work as expected 

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

0 Likes
khrystyna_zh
New Member
4 0 0

Hi, @hassain

 

Thank you for looking into our issue.

But I don't know why you're seeing GET request. Because we sent POST requests, the same code that works perfectly fine for all other shops. If they were GET requests, I would receive the same errors with other shops, but it's not the case. Please take a look at our logs bellow.

Cancel request:

 

2020-04-24 14:31:15.634 [HttpClient.java:90] - Execute request: 
Request{method=POST, url=https://#{shop_url}/admin/api/#{api_version}/orders/#{order_id}/cancel.json, headers=[X-Shopify-Access-Token:#{private_app_password}]}

received response x-request-id=[22b11cfc-8a6a-4065-8f23-1b91462938d4]

 

 

Capture payment request:

Retrieve transaction:

 

2020-04-23 08:24:28.300 [HttpClient.java:51] - Execute request: 
Request{method=GET, url=https://#{shop_url}/admin/api/#{api_version}/orders/#{order_id}/transactions.json, headers=[X-Shopify-Access-Token:#{private_app_password}]}

 

received response x-request-id=[114ecb69-53e5-466b-90ef-52ba8f0e11ec]

 

Capture payment:

 

2020-04-23 08:24:28.847  [HttpClient.java:90] - Execute request: 
Request{method=POST, url=https://#{shop_url}/admin/api/#{api_version}/orders/#{order_id}/transactions.json, headers=[X-Shopify-Access-Token:#{private_app_password}, Content-Type:application/json]}

 

 

with body:

{
  "transaction" : {
    "kind" : "capture",
    "gateway" : "manual",
    "status" : "success",
    "test" : false,
    "amount" : 22.92,
    "currency" : "CHF",
    "parent_id" : "#{transaction_id}"
  }
}

received response x-request-id=[e714e0ae-99b2-4c44-ba38-89f7164a02d8]

I wouldn't be able to send json in GET request.

 

I think that the issue is in shop settings or another payment app, which blocks our attempts to change order status, precisely because the same code (it goes through exactly the same lines of code, not just the same code in a different place, in which case it could explain the errors) works for other shops, so I don't see a reason for it to work on some shops and don't work for others. 

 

0 Likes
khrystyna_zh
New Member
4 0 0

After researching this issue and doing tests we came to the conclusion that Stripe app blocks attempts to change order status via manual payment method.

As long as we don't have Stripe installed everything works fine, as soon as we install Stripe capture payment and cancel order api calls stop working.

 

Does anybody have any solution to that?

0 Likes