У меня есть POS-программа, написанная на платформе codeigniter. Я хотел интегрировать URBAN PIPER API в свое программное обеспечение, чтобы я мог разместить свой выход на публикуемых c платформах, таких как swiggy, zomato, et c. Я добавил розетки и меню еды на приборную панель с помощью скручивания. Далее я хочу сделать заказ со спутникового инструмента и получить детали заказа на мою панель. Это может быть сделано обратным вызовом webhook. Но я не знаю, как получить ответ на мое программное обеспечение.
Итак, теперь мой вопрос заключается в том, как получить детали заказа через обратный вызов через webhook и список в моем ПО pos?
Предоставленный код По городским пайперам это выглядит так:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://YOUR-WEBHOOK-URL.com/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n\t\"customer\": {\n\t\t\"address\":
{\n\t\t\t\"city\": \"Bengaluru\",\n\t\t\t\"is_guest_mode\":
false,\n\t\t\t\"landmark\": null,\n\t\t\t\"latitude\":
\"12.9261382\",\n\t\t\t\"line_1\": \"7 Ram Nagar barathi
street\",\n\t\t\t\"line_2\": null,\n\t\t\t\"longitude\":
\"77.6199204\",\n\t\t\t\"pin\": \"\",\n\t\t\t\"sub_locality\": \"Koramangala
Water Tank\",\n\t\t\t\"tag\": null\n\t\t},\n\t\t\"email\":
\"8047499241@example.com\",\n\t\t\"name\": \"Targaryen\",\n\t\t\"phone\":
\"9999999999\"\n\t},\n\t\"order\": {\n\t\t\"details\": {\n\t\t\t\"channel\":
\"zomato\",\n\t\t\t\"charges\": [{\n\t\t\t\t\"title\": \"Delivery
Charge\",\n\t\t\t\t\"value\": 30.0\n\t\t\t}],\n\t\t\t\"coupon\":
\"\",\n\t\t\t\"created\": 1552503413663,\n\t\t\t\"delivery_datetime\":
1552506113662,\n\t\t\t\"discount\": 122.0,\n\t\t\t\"ext_platforms\":
[{\n\t\t\t\t\"delivery_type\": \"partner\",\n\t\t\t\t\"extras\":
{},\n\t\t\t\t\"discounts\": [\n {\n
\"is_merchant_discount\": true,\n \"rate\":
30.0,\n \"title\": \"Restaurant Promo\",\n
\"value\": 72.0,\n \"code\": \"\"\n
},\n {\n
\"is_merchant_discount\": false,\n \"rate\": 0,\n
\"title\": \"Zomato NEW50 Signup offer\",\n
\"value\": 50,\n \"code\": \"NEW\"\n
}\n ],\n\t\t\t\t\"id\": \"6756-bytr\",\n\t\t\t\t\"kind\":
\"food_aggregator\",\n\t\t\t\t\"name\": \"zomato\"\n\t\t\t}],\n\t\t\t\"id\":
6427675,\n\t\t\t\"instructions\": \"Address Instructions: Winter is coming!
serve food fast! \",\n\t\t\t\"item_level_total_charges\":
15,\n\t\t\t\"item_level_total_taxes\": 8.4,\n\t\t\t\"item_taxes\":
0.0,\n\t\t\t\"merchant_ref_id\": null,\n\t\t\t\"order_level_total_charges\":
30,\n\t\t\t\"order_level_total_taxes\": 0,\n\t\t\t\"order_state\":
\"Placed\",\n\t\t\t\"order_subtotal\": 240.0,\n\t\t\t\"order_total\":
171.4,\n\t\t\t\"order_type\": \"delivery\",\n\t\t\t\"state\":
\"Placed\",\n\t\t\t\"taxes\": [],\n\t\t\t\"total_charges\":
45.0,\n\t\t\t\"total_external_discount\": 50.0,\n\t\t\t\"total_taxes\":
8.4\n\t\t},\n\t\t\"items\": [{\n\t\t\t\t\"charges\": [{\n\t\t\t\t\t\"title\":
\"Packaging charge\",\n\t\t\t\t\t\"value\":
5.0\n\t\t\t\t}],\n\t\t\t\t\"discount\": 0.0,\n\t\t\t\t\"food_type\":
\"1\",\n\t\t\t\t\"id\": 61810,\n\t\t\t\t\"image_landscape_url\":
null,\n\t\t\t\t\"image_url\": null,\n\t\t\t\t\"merchant_id\": \"I-
1\",\n\t\t\t\t\"options_to_add\": [{\n\t\t\t\t\t\"id\":
11262,\n\t\t\t\t\t\"merchant_id\": \"opt-1\",\n\t\t\t\t\t\"price\":
200.0,\n\t\t\t\t\t\"title\":
\"Small\"\n\t\t\t\t}],\n\t\t\t\t\"options_to_remove\":
[],\n\t\t\t\t\"price\": 0,\n\t\t\t\t\"quantity\": 1,\n\t\t\t\t\"taxes\":
[{\n\t\t\t\t\t\t\"rate\": 2.5,\n\t\t\t\t\t\t\"title\":
\"CGST\",\n\t\t\t\t\t\t\"value\":
3.5\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"rate\":
2.5,\n\t\t\t\t\t\t\"title\": \"SGST\",\n\t\t\t\t\t\t\"value\":
3.5\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\t\"title\": \"Veg
Biryani\",\n\t\t\t\t\"total\": 200.0,\n\t\t\t\t\"total_with_tax\":
152.0,\n\t\t\t\t\"unit_weight\": 0.0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"charges\":
[{\n\t\t\t\t\t\"title\": \"Packaging charge\",\n\t\t\t\t\t\"value\":
5.0\n\t\t\t\t}],\n\t\t\t\t\"discount\": 0.0,\n\t\t\t\t\"food_type\":
\"1\",\n\t\t\t\t\"id\": 61793,\n\t\t\t\t\"image_landscape_url\":
null,\n\t\t\t\t\"image_url\": null,\n\t\t\t\t\"merchant_id\": \"I-
2\",\n\t\t\t\t\"options_to_add\": [],\n\t\t\t\t\"options_to_remove\":
[],\n\t\t\t\t\"price\": 20.0,\n\t\t\t\t\"quantity\": 2,\n\t\t\t\t\"taxes\":
[{\n\t\t\t\t\t\t\"rate\": 2.5,\n\t\t\t\t\t\t\"title\":
\"CGST\",\n\t\t\t\t\t\t\"value\":
0.7\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"rate\":
2.5,\n\t\t\t\t\t\t\"title\": \"SGST\",\n\t\t\t\t\t\t\"value\":
0.7\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\t\"title\":
\"Coke\",\n\t\t\t\t\"total\": 40.0,\n\t\t\t\t\"total_with_tax\":
39.4,\n\t\t\t\t\"unit_weight\": 0.0\n\t\t\t}\n\t\t],\n\t\t\"next_state\":
\"Acknowledged\",\n\t\t\"next_states\":
[\n\t\t\t\"Acknowledged\",\n\t\t\t\"Food
Ready\",\n\t\t\t\"Dispatched\",\n\t\t\t\"
Completed\",\n\t\t\t\"Cancelled\"\n\t\t
],\n\t\t\"payment\": [{\n\t\t\t\"amount\": 171.4,\n\t\t\t\"option\":
\"payment_gateway\",\n\t\t\t\"srvr_trx_id\": null\n\t\t}],\n\t\t\"store\":
{\n\t\t\t\"address\": \"Koramangala water tank\",\n\t\t\t\"id\":
2235,\n\t\t\t\"latitude\": 12.9354922,\n\t\t\t\"longitude\":
77.6146828,\n\t\t\t\"merchant_ref_id\":
\"POS_STORE_ID\",\n\t\t\t\"name\":
\"Koramangala\"\n\t\t}\n\t}\n}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;