Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Cancel Checkout after webhook was triggered

Cancel Checkout after webhook was triggered

Alex_Beacon
Shopify Partner
26 0 3

Hi Shopify Team,

 

Is it possible to cancel or deny checkout (using ShopifyAPI), after customer passed checkout. And prevent payment process.

F.e. if customer has Fraud tag.

Thanks,
Alex 

Decrease fraudulent orders, stop chargebacks and expand globally with Beacon. https://apps.shopify.com/beacon
Replies 6 (6)

Nick
Shopify Staff (Retired)
4531 434 1028

Hi @Alex_Beacon,

 

Nick here from Shopify. 

 

Great question. While it's not possible to directly prevent a payment after the customer has gone through the checkout process, there are a couple of workarounds to help prevent this or modify it after a customer has checked out. Let's take a look at them below:

 

  • If you are on the Shopify Plus plan you could look into using Shopify Flow. Shopify Flow is an automation platform that helps you easily automate tasks and processes within your store and across your apps. Some of the main tasks of flow focus on preventing high-risk orders. Shopify_Flow__Shopify_Help_Center_2019-05-31_11-40-04
  • If you are not using Shopify Plus, something to remember is that once a customer has gone through the checkout process the best next step to do what you're looking to do would be to cancel the order and refund the customer. It's not possible to simply reverse the checkout process. 
  • Another workaround, if you are not on the Shopify Plus plan, would be using an app. There are a couple of different fraud protection apps, but the one which springs to my mind for your particular example is NoFraud Fraud Prevention. The feature which stuck out for me here that I think is actionable for you is "You can decide to manually cancel the orders we flagged as fraud (“Fail”) or you can set up the system to automatically cancel the fraudulent orders on your behalf."

Hopefully, this helps! 

 

All the best, Nick

To learn more visit the Shopify Help Center or the Community Blog.

Alex_Beacon
Shopify Partner
26 0 3

Hey Nick,

Thanks for your response! I'm a developer of the app, and I want to Merchant  who will use my app to be able to cancel the order if Customer has some tag. And my system will do it automatically.

 

I can cancel the order after webhook for "orders_create"  were triggerd and using ShopifyAPI to cancel the order.

But how can I refund the order? Cause Shopify API documenation says that I need to specify the location_id of the items that were in that order.  
So how can I get these location_ids ? Or can I refund the order without location id?

Thanks,
Alex

Decrease fraudulent orders, stop chargebacks and expand globally with Beacon. https://apps.shopify.com/beacon
Nick
Shopify Staff (Retired)
4531 434 1028

Hey @Alex_Beacon,

 

No problem at all. I understand what you're asking but I am not comfortable with direct API related questions personally. I did, however, discover you do need to have the location_ids of the items in the order to issue a refund from within an app. 

 

Refund__Shopify_Help_Center_2019-06-03_10-57-43

 

From looking into this further, this is because of the multi-location inventory. If your app is to comply with multi-location inventory it must include the location_ids which you can read more about here

 

Hopefully, this at least gives you more information as to why this might be.

To learn more visit the Shopify Help Center or the Community Blog.

Alex_Beacon
Shopify Partner
26 0 3

Thanks!
Probably I should create topic about getting location_ids of the items in the order!

Decrease fraudulent orders, stop chargebacks and expand globally with Beacon. https://apps.shopify.com/beacon
Nick
Shopify Staff (Retired)
4531 434 1028

No problem at all. Yes, that makes sense to create a topic more specific to exactly this and going into detail of it. 

 

Hopefully, someone with more knowledge than myself will see it and be able to add value for you. 

To learn more visit the Shopify Help Center or the Community Blog.

JohnAtBonify
Shopify Partner
136 7 34