Re: Mark an order as paid thru REST API

Mark an order as paid thru REST API

Roman81
Tourist
12 0 2

Hi,

 

I would like to mark an order as PAID through REST API - is it possible or it is prohibited by Shopify?

I have found a few topics about this but they seem a bit old and do not work.

 

So what did I try:

  1. mark order as paid -> this does not work you can do this only when order is created
  2. I have found an approach to create and order with some transaction and then close this transaction - this I cannot do the order is created by Shopify checkout process
  3. I did try to create and transaction but the response seems like some Identity request
  4. I have created a private app did custom request with the private app credentials - same as point 3.

any tip what I'm doing wrong? I did invest quite a lot of time into it and do not want to switch to WooComerce.. 😞 (which seems the only solution for now)

 

Thx,

R.

Replies 20 (20)

Not applicable

Hi Roman,

 

Are you using a custom payment method? Pretty sure you don't need a custom app or a REST call for this. Try the following in SETTINGS > PAYMENT PROVIDERS: 

 

automatic_billing_shopify.PNG

 

Regards,


Sam

Roman81
Tourist
12 0 2

Hi,

 

we do have the manual payment method because the payment is provided to our bank account - then we use an Integromat to catch a new payment and we would like to mark the given order as paid.

 

So the automated payment method is mentioned for credit card payment or I can use it also for payment to the bank account?

 

Thx,

R

JonasR
Tourist
3 0 2

This is exactly my problem at the moment.

I havent found a way to mark an order with a manual payment method as paid through the api.

Not applicable

Has anyone tried to first create the order then POST a transaction?

 

POST /admin/api/2020-01/orders/#{order_id}/transactions.json
{
  "transaction": {
    "kind": "capture",
    "authorization": "authorization-key"
  }
}
Roman81
Tourist
12 0 2

Hi,

 

well yes, but I do have 2 issues - where to take authorization-key if I omit it either get invalid request error or link to "login" page as a response.

 

like described here: https://community.shopify.com/c/Shopify-APIs-SDKs/Marking-order-transaction-as-paid-with-REST-Admin-...

 

it seems that go for the shopify was a big mistake 😞 and due to their intelligent monetizing scenario, they do block this option by purpose - with no alternative how to handle payments to bank account automatically - they live in a world where credit cards are used only I guess (but maybe I'm wrong - or I hope I'm wrong).

 

R.

JonasR
Tourist
3 0 2

I tried two different payloads for the transaction

{'amount': '123.21',
'currency': 'EUR',
'gateway': u'Vorkasse',
'kind': 'capture',
'parent_id': '123456789',
'status': 'success'}

{'amount': '123.21',
'currency': 'EUR',
'gateway': u'Vorkasse',
'kind': 'sale',
'status': 'success'}

 

Both result in 

Parent transaction specified cannot be marked as paid

I already mailed the support regarding this and will keep you updated

 

JonasR
Tourist
3 0 2

@achieveapplabs

It seems like your solution works I was only sending to much information.

@Roman81 are you sending the json directly to the shopify API or are you using some API wrapper like https://github.com/Shopify/shopify_python_api ?

Roman81
Tourist
12 0 2

Hi,

 

I did use the Integromat and also tried with Postman - created my custom private app credentials - all with the same result - either 406 or 400 or 404 or "continue" login page.

 

Also, I do not know how to get parent id - for order created directly from Shopify, there is no such thing. If I try to get all transactions for order again "continue" login page result.

 

R.

Not applicable

Roman,

 

Make sure you're sending your private app key and secret along with the request. If you subscribe to the orders webhook the ID will be in the request body when an order is created. I also believe Checkout API can be used to capture the new order, but I would stick with webhooks.

Roman81
Tourist
12 0 2

Hi,

 

so I have tried to get all transactions for the given order - I used the private app

GetOrders.png

you can see that the private app should have rights for the transactions:

GetOrdersPermissions.png

 

the request result isn't list of transactions but an HTML page with "identity" login page with "continue button"

 

Any ideas? From my point of view, it is a bug or intention.

Am I wrong?

 

Thx,

R.

Not applicable

Hi @Roman81,

 

You did everything correctly just remove the hashtag # in your URL after /orders/#

/orders/#12312312

 

Regards,

 

-Sam

Roman81
Tourist
12 0 2

Hi @Anonymous (Sam),

 

thx so far it seems  I'm moving somewhere - finally I'm able to get transactions (the '#' in URL was the issue) but I'm not able to create one with payment.

I do get this:

GetOrderTransaction.png

and this is what I'm trying to post but again "identity continue"...

PostTransaction.png

Any idea what I do wrong this time?

 

Thx,

R.

Not applicable

Hi @Roman81,

 

I'm sure your permissions are correct. From testing it seems that if the URL is incorrect or the POST body is incorrect you will get this identity HTML response.  I strongly believe the issue is within the POST body. Try this: 

 

{
  "transaction": {
    "kind": "sale",
    "source": "external", 
"parent_id": yourIDhere } }

All the best,

 

Sam

 

Roman81
Tourist
12 0 2

Hi @Anonymous (Sam :)),

 

I have given a try and no success 😞 any tip on how to investigate where the issue, is?

 

Thx,

R.

Roman81
Tourist
12 0 2

Hi,

 

so finally I'm able to make an order as paid - sorry for my comments to Shopify - anyway I'm not able to do so thru rest api call - post man - but I'm able to do so thru integromat integrations - strange is that I'm doing the same api call.. 

 

So thx all and have a nice day,

R.

SaraDiazb82
Visitor
1 0 0

Hey @Roman81 this thread is already really old but I'm giving it a shot. I am trying to do the same thing with make (formerly integromat). The only solution I found is capturing a transaction but then I actually record a payment in shopify which I don't want to do. How did you do it through integromat?

Tnx

FredericVervill
Tourist
7 0 1

Have you found a way to do it in Make? Thank you!

Frederic Verville - Floèm
HMawla
Shopify Partner
1 0 0

The solution for me was (source: external)

Not applicable

Also Roman,

 

Wondering if creating a custom payment method and then setting the financial_status = "paid" would do the trick?

 

-Sam

Roman81
Tourist
12 0 2

Nope, as my point 1. this you can do just for the new order, not for the existing one