Discussing APIs and development related to customers, discounts, and order management.
Hello!
I have a Shopify store where clients will place orders and would pay manually but there is a web hook attached to the order creation which works well. I would like to mark the order as PAID when manual payment is done using REST API.
When someone does an order the transaction type is sale as per my observation from the API. I am trying to update the transaction but I only get HTML response with a continue button
I am POSTing to this URL https://rwmomotest.myshopify.com/admin/api/orders/917885812833/transactions.json
with this JSON payload
{ "transaction": { "currency": "RWF", "amount": "4730", "gateway": "MTN MOMO", "kind": "sale", "parent_id": 1128723841121, "status" : "success" } }
But the response I am getting is an HTML content with a continue button
which is below
<html> <body> <noscript> <a href="https://app.shopify.com/services/login/identity?destination_uuid=6e156790-8b40-4662-ac08-461b27fdc1bf&return_to=https%3A%2F%2Fapp.shopify.com%2Fservices%2Flogin%2Fidentity_callback%3Fshop_name%3Drwmomotest%26state%3D1R9Lp0vWElSDwov7iYc3DeTP7IX7v-dwNj-nhK0tEYeheCPAu5TN1jeXhl9cavu_pkqV3iKpZTsDBmFOrFEIkalEqOUmu0FoGJ4uYzrI-L_1ZvXTLLH3X1WYffnNr69PLQR_JeYy1uhWyRuZWNIcOwM3qLU2iCWJ5sTmFi2t4BQ8m0H4EtfqpjVYwXLxAmF12u-3CCIOgz5djnLViVO4z31V3x8a1LZ3xTpIlukHbvY%253D&ui_locales=en&upgradeable=false&ux=shop">Continue</a> </noscript> <script type="text/javascript"> window.location = "https:\/\/app.shopify.com\/services\/login\/identity?destination_uuid=6e156790-8b40-4662-ac08-461b27fdc1bf\u0026return_to=https%3A%2F%2Fapp.shopify.com%2Fservices%2Flogin%2Fidentity_callback%3Fshop_name%3Drwmomotest%26state%3D1R9Lp0vWElSDwov7iYc3DeTP7IX7v-dwNj-nhK0tEYeheCPAu5TN1jeXhl9cavu_pkqV3iKpZTsDBmFOrFEIkalEqOUmu0FoGJ4uYzrI-L_1ZvXTLLH3X1WYffnNr69PLQR_JeYy1uhWyRuZWNIcOwM3qLU2iCWJ5sTmFi2t4BQ8m0H4EtfqpjVYwXLxAmF12u-3CCIOgz5djnLViVO4z31V3x8a1LZ3xTpIlukHbvY%253D\u0026ui_locales=en\u0026upgradeable=false\u0026ux=shop"; </script> </body> </html>
and it renders like this
This turned out really weird as I have been following several guides with the same result.
Please help mark these transactions as PAID with REST API
Regards,
Plac
Solved! Go to the solution
This is an accepted solution.
This Method doesn't work. I have tried it to mark an order as paid but it doesn't work like this. To verify my statement, I went on to add a note in an order and that was successfully updated in my orders as specified in the docs. So please fellas don't waste time using this method
Hi Plac,
If you only want to make the "Financial Status" as Paid then you should consider making a PUT request like this -
PUT
/admin/api/2019-04/orders/#{order_id}.json
{ "order": { "id": order_id, "financial_status": "Paid" } }
Hello,
Thanks for great solution. However, trying it I the financial status never changed and I get the response of the order only but sincerely the financial_status does not change. Also It's described in the documentation that financial_status can only be set when the order is created
This is an accepted solution.
This Method doesn't work. I have tried it to mark an order as paid but it doesn't work like this. To verify my statement, I went on to add a note in an order and that was successfully updated in my orders as specified in the docs. So please fellas don't waste time using this method
you are right! Shopify REST API stated that only a few fields can be made to Order, which doesn't include the status, which is the key part that Shopify takes over control for the platform profit driven purpose: https://help.shopify.com/en/api/reference/orders/order.
One helpful link goes here: https://community.shopify.com/c/Shopify-APIs-SDKs/How-to-mark-order-as-paid-through-REST-Admin-API/t....
Have you tried it ?
i did through this method and status is not changing.
Looking at the latest API version docs (https://shopify.dev/docs/admin-api/rest/reference/orders/order?api[version]=2020-04), it doesn't appear that the Order endpoint supports setting the financial_status property after the fact. In other words, you can set it with a new POST request that creates an order, but you cannot set it with a PUT request for an existing order. Perhaps someone on the Shopify side can speak to this?
In other words, you can set (financial_status) with a new POST request that creates an order, but you cannot set it with a PUT request for an existing order.
This is correct. The status can only be manually set when creating a new order, once an order exists the financial_status will update automatically based on the state of transactions attached to the order (eg. an authorization being captured, or a pending payment being "Marked as Paid" from the admin).
JB | Solutions Engineer @ Shopify
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
So there is no way to "Mark as paid" via Transactions API?
I am trying to convert the draft order to order using order API. The Problem is either the order can be mark as paid and achieve or is unpaid. Can you please help me out to figure out solution for this ?