Solved

Editing the risk level of an order via REST or GraphQL

Johannes_H
Visitor
2 0 0

Hello,

 

I am working on a remote fraud checking system for my company. So far so good but I am at a point where I cant really find an answer for my problem.

 

If a user on my interface accepts an order I want to either change the risk score of an order to 0.0 or just delete the existing order risks so the order is not flagged anymore in shopify admin dashboard. I've tried already to delete the existing order risks created by Shopify itself, but it seems like my app is  not authorized to do so. 

 

I'm using the PHP REST API and GraphQL API 

 

Is there any other possible way to do this?

 

Thanks in advance!

Accepted Solution (1)

Shayne
Shopify Staff
254 20 64

This is an accepted solution.

Unfortunately, you cannot modify or delete an order risk created by another application or Shopify itself. This restriction is noted in the Shopify API documentation.

However, you can create a new order risk with a low risk score and a recommendation to "accept" the order. This way, your app will provide additional information to the merchant, indicating that the order has been reviewed and is legitimate. Here's an example of how to create a new order risk with a low score using the REST API:

POST /admin/api/2023-04/orders/{order_id}/risks.json

{
"risk": {
"message": "After further review, this is a legitimate order",
"recommendation": "accept",
"score": 0.0,
"source": "External",
"cause_cancel": false,
"display": true
}
}

 

This new order risk will be visible to the merchant alongside the existing risks, and they can make a decision based on the information provided. Remember to replace `{order_id}` with the actual order ID in your API call.




 

Shayne | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 2 (2)

Shayne
Shopify Staff
254 20 64

This is an accepted solution.

Unfortunately, you cannot modify or delete an order risk created by another application or Shopify itself. This restriction is noted in the Shopify API documentation.

However, you can create a new order risk with a low risk score and a recommendation to "accept" the order. This way, your app will provide additional information to the merchant, indicating that the order has been reviewed and is legitimate. Here's an example of how to create a new order risk with a low score using the REST API:

POST /admin/api/2023-04/orders/{order_id}/risks.json

{
"risk": {
"message": "After further review, this is a legitimate order",
"recommendation": "accept",
"score": 0.0,
"source": "External",
"cause_cancel": false,
"display": true
}
}

 

This new order risk will be visible to the merchant alongside the existing risks, and they can make a decision based on the information provided. Remember to replace `{order_id}` with the actual order ID in your API call.




 

Shayne | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

Johannes_H
Visitor
2 0 0

Thank you very much for your reply! This solution is already integrated.

 

Then I guess theres nothing to do here for me.