External API call on Order Placement

I need to make an external API call when the user place and order . The order must be created if the response from the API call

Hi @krishan_kk ,

You can use Shopify Flow(if your plan allows) to make an external HTTP request once an order is placed.

Hi Krishan__kk https://aviator-jeux.com/

The code will look like this

import requests

url = “https://api.example.com/orders
method = “POST”

data = {
“customer_name”: “John Doe”,
“customer_address”: “123 Main Street”,
“items”: [
{
“product_id”: 12345,
“quantity”: 1,
},
{
“product_id”: 56789,
“quantity”: 2,
},
],
}

response = requests.request(method, url, data=data)

if response.status_code == 200:

The order was created successfully.

else:

The order was not created successfully.