FROM CACHE - en_header

Change Status of Order

Henrique3
Shopify Partner
4 0 1

Hi guys, i need to change the status of order.. But it like impossible, anybody know how can i do this?

I create the order with the status pending.

POST

{
  "order": {
    "email": "foo@example.com",
    "fulfillment_status": "fulfilled",
    "line_items": [
      {
        "variant_id": 44765498,
        "quantity": 1,
        "name" : "teste",
        "price" : "10.00",
        "title" : "teste title"        
      }
    ],
    "financial_status": "pending"
  }
}

 

Now i need to change to “paid”.

PUT

{

  "order": {

    "id": "3311344838",

    "financial_status": “paid"

   }

}

This ins’t to working, the status remains “pending”.

 

Thanks and regards.

 

Replies 26 (26)
Adam_Schaffer
Shopify Partner
29 0 3

This topic is closed but I have the same question. What is the proper way to update the financial status for an order where the money was captured outside of shopify.

 

HunkyBill
Shopify Expert
4793 56 562

Did you try the simple action of creating a transaction?

https://help.shopify.com/api/reference/transaction

You might have some success with that to change the financial status of an order.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Adam_Schaffer
Shopify Partner
29 0 3

That did the change.

It wasn't clear to me that I could pass a transaction even though I was using an external gateway. This is good to know.

Thanks for your answer.   I appreciate your help. 

Adam_Schaffer
Shopify Partner
29 0 3

An update on this.

I am not clear why but this is not working consistently.  On some orders it did work, and yet on others I am getting:

"No capturable transaction was found"

I can't find enough information in the api reference page to help me debug this. I've tried sending

    {transaction: { kind: 'capture' } }

    {transaction: { kind: 'capture', amount: "NN.NN" } }

and other combinations where I send more data (order number, authorization id, etc).  It's puzzling. What kind of validation does shopify do on the background when one sends a transaction?

I also tried passing kind: 'sale', which should be valid according to the reference page but I then get:

"sale is not a valid transaction"

which makes absolutely no sense to me based on the api spec.

 

Adam_Schaffer
Shopify Partner
29 0 3

Ok. another update. The orders that work are those where I mark as pending via the shopify admin web interface. The ones that are not working are those I created via the API.  I need to now figure out what parameter the web interface is setting that I am not setting and that causes this failure.  Unfortunately I don't see what it could be based on reading the API documentation.  Comparing parameters side by side I see that the following are set by the web page:

  •       payment_gateway_names: [ "manual" ],
  •       processing_method: "manual"

Unfortunately when I try to set these when creating the order via the API (or after order creation) these are not set. Similarly, when I try passing these values as part of the transaction.

So I still have problems with changing the pending status for orders created via the API.

 

Adam_Schaffer
Shopify Partner
29 0 3

Can anyone from Shopify comment on this issue? I can create an order via the API as listed above but I can not then get transactions to this order to be accepted.  I've also tried sending the gateway and payment_gateway_names when I create the order but this makes no difference. Basically any time I try to send a transaction for an order sent via the API I always get "no capturable transactions".  Can someone from shopify confirm is this is simply not supported, or which values in the api I need to set to be able to support this.

One additional point: If I go to the web admin and I push "Mark as Paid" I get the popup to mark as paid but it does not show me a drop down to select any of the configured payment methods.  

This is different from when I hit "Mark as pending" from a Draft order where it asks "Are you going to receive payment outside of shopify?"  

I think *THIS* step is what is missing - what can I do via the API to converts and order into a 'pay outside of shopify' transaction?

Jamie_D_
Shopify Staff (Retired)
Shopify Staff (Retired)
533 1 107

The error "no capturable transaction" would indicate that you can't create a capture transaction for an order that doesn't already have an existing transaction.

Orders created via the API do not have any transactions attached to them by default, so you'll need to create an authorization transaction first, or specify a sale transaction which is an authorization and capture all in one.

Hope this helps!

Jamie | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Adam_Schaffer
Shopify Partner
29 0 3

Thanks for getting back to me.

As I mentioned in a previous post, when I use sale the response is:

-> "{\"errors\":{\"kind\":[\"sale is not a valid transaction\"]}}"

It's not clear why it would not accept sale as a transaction. I get the 'not a valid transction error for everything but capture.

Adam_Schaffer
Shopify Partner
29 0 3

Can anyone from shopify help me figure out why the transaction "kind: sale" would respond with "sale is not a valid transaction"?

Here's a sample of my post request:

POSTing to: /admin/orders/3980863237/transactions.json

{
"transaction":{
  "amount":"113.42",
  "kind":"sale",
  "user_id":72,
  "currency":"USD",
  "gateway":"manual"
  }
}

I've tried with and without passing the last 3 fields.

Adam_Schaffer
Shopify Partner
29 0 3

Shopify Devs, what information do you need from me to help me debug this issue?

Adam_Schaffer
Shopify Partner
29 0 3

Ok. I have some progress on my investigation of this:

The step I was missing is that I needed to send, with the original message to create the order, an 'authorization' transaction. This apparently sets the state in the shopify object correctly to where I can send additional transactions and send additional transactions to the order object.  Apparently if the order object is created without any transactions then it won't accept any new transactions and we get the: "sale is not a valid transaction" message.

This seems to me like it's a bug in shopify. I should be able to create a pending order and send a "sale" transaction to mark the order as paid.

Shopify Devs, can you reproduce this situation?

Adam_Schaffer
Shopify Partner
29 0 3

Is anyone from shopify ever going to answer this?  What is the right support forum for this type of question? I've been told that phone and chat support does not work for API questions and to use this forum, but I can't get definitive answers from shopify.

piyush2
Shopify Partner
15 0 3

Have not seen any reply. 

Facing the same problem. Don't know if transaction api is working fine for other people?

 

PIyush S

thestiffcollar.com

Anatoly_S
Shopify Partner
8 0 1

Hi.

I have same problem.

Do you have any news?

HymnZ
Shopify Partner
398 6 66

If it is a full payment use 

POST /admin/orders/#{id}/transactions.json
{
  "transaction": {
    "kind": "capture"
  }
}

If it is a partial payment use

POST /admin/orders/#{id}/transactions.json
{
  "transaction": {
    "amount": "10.00",
    "kind": "capture"
  }
}

 

 

My speciality lies in making Shopify work for your requirements, not the other way round. HMU on email: hymnz@outlook.com or on skype: hymnzzy

If you like my work, consider supporting me 🙂 https://www.buymeacoffee.com/hymnz
Anatoly_S
Shopify Partner
8 0 1

Thanks for answer.

But this solutions doesn't work with orders created via API.

Joel12
Shopify Partner
4 0 0

I am having the same issue.  What ever I do to add a transaction of any status to an order via the api it comes back with the errors named above.

 

HunkyBill
Shopify Expert
4793 56 562

Would be very smart if you would include the data that fails for you. Otherwise no one can help you. I make Apps that create transactions via the API all the time. It works. But only if you do it according to the rules. And those rules are tricky. So showing off your data will expose what you are either missing or including to blow your API calls. 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Jeffrey1
Tourist
3 0 3

Face the same issue here, trying to find the solution but no luck.
 

After poking around API calls, I found that if the transaction is created in the same time with "create Order" API call, there's no way for you to marked the financial stauts from "pending" to "paid".

I'll show the steps as following:

1. Create Order with transaction ( financial status is pending ). # You can only create transaction within "create Order" API call. check https://help.shopify.com/api/reference/order#create (Create a more comprehensive order part).

POST /admin/orders.json

{
  "order": {
	"line_items": [
	  {
	    "variant_id": 1234567890,
	    "quantity": 1
	  }
	],
	"financial_status": "pending", 
	"email": "test@citiesocial.com", 
    "inventory_behaviour": "decrement_obeying_policy",
    "transactions": [
    	{
    		"kind": "authorization", 
    		"status": "pending", 
    		"amount": 10
    	}
    ]
  }
}

2. Check there's indeed transaction with the order I created through API. You will find that the source_name is string of numbers (here I've already masked it to 123456), I guess it means the transaction is created from API call.

GET /admin/orders/$order_id_that_created_through_API/transactions.json

{
    "transactions": [
        {
            "id": *******,
            "order_id": *******,
            "amount": "10.00",
            "kind": "authorization",
            "gateway": "",
            "status": "pending",
            "message": null,
            "created_at": "2017-09-15T11:52:47+08:00",
            "test": false,
            "authorization": null,
            "currency": "TWD",
            "location_id": null,
            "user_id": null,
            "parent_id": null,
            "device_id": null,
            "receipt": {},
            "error_code": null,
            "source_name": "123456"
        }
    ]
}

3. Trying to capture the transaction.

POST /admin/orders/$order_id_that_created_through_API/transactions.json

{
  "transaction": {
    "kind": "capture"
  }
}

Get error response as following:

{
    "errors": {
        "base": [
            "No capturable transaction was found"
        ]
    }
}


Recap all, I found that there's no way to capture a transaction if the source_name is string of numbers which means the transaction is created from API call.
However, if the source_name is "web" or "shopify_draft_order", which means the transaction is created through your shop or Shopify admin. You can capture the transaction with API call.

I believe Shopify lock the API so that the transaction that is created with "create Order" API calls, cannot be captured by API call.

Would be a great help if anyone shed light on the issue. Still can't find a way to work around it.