ตัวอย่าง Callback Webhook (Order, Product, Variant)
เมื่อมีการ Subscribe Webhook กับทางระบบ เมื่อมีการเปลี่ยนแปลงของข้อมูล ระบบจะทำการส่งข้อมูลที่อัพเดทไปยังปลายทางที่ได้ลงทะเบียนไว้ ด้านล่างคือตัวอย่างข้อมูลที่ส่งไป เป็นในรูปแบบ JSON
Product - add / update / delete
Product variant - add / update / delete
Order - new / paid / cancel
Product - add / update / delete
{
"product_id": 53717,
"store_id": 5442,
"type": 1,
"name": "Product 22",
"description": "",
"prepend_description_id": null,
"append_description_id": null,
"meta_keyword": "",
"meta_description": "",
"seo_url": "seo-22",
"short_url": "",
"price": 1000,
"label": "new",
"length": 0,
"width": 0,
"height": 0,
"length_class_id": 0,
"weight": 1,
"override_loyalty": false,
"loyalty_points": 0,
"remain_stock": 500,
"seq": 1140,
"copy_product_id": 0,
"active": false,
"brand_id": 0,
"product_attribute": null,
"shipping_method": [],
"activate_category_attribute": 0
}
Product variant - add / update / delete
{
"product_id": 53716,
"name": "Product 21",
"variant_id": 753758,
"variant_name": "ascascasc",
"sku": "",
"barcode": "",
"price": "100.00",
"loyalty_points": "0",
"cost": "",
"old_stock": 0,
"new_stock": 0,
"active": 0
}
Order - new / paid / cancel
{
"status": 1,
"data": {
"order": {
"order_id": 432580,
"date_created": "2023-05-02 13:42:00",
"date_modified": "2024-07-11 14:27:46",
"date_cancelled": "-0001-11-30 00:00:00",
"receipt_datetime": "2023-05-02 20:36:00",
"ref_code": "********",
"langs": "th",
"store_id": 5442,
"fb_store_id": 0,
"customer_id": 0,
"discount_id": 0,
"order_from": 19,
"firstname": "********",
"lastname": "********",
"email": "********@gmail.com",
"phone": "**********",
"idcard": "",
"country_id": 5,
"shipping_firstname": "********",
"shipping_lastname": "********",
"shipping_email": "",
"shipping_phone": "**********",
"shipping_address_1": "********",
"shipping_address_2": "",
"shipping_subdistrict": "********",
"shipping_district": "********",
"shipping_province": "**************",
"shipping_zipcode": "*****",
"shipping_country_id": 5,
"shipping_method": "sstp:282",
"shipping_content": null,
"payment_method": "transfer",
"payment_content": "",
"special_req": "",
"currency_id": 2,
"vat_amount": 0,
"has_wholesale": 0,
"has_discount": false,
"has_super_discount": false,
"has_points_discount": false,
"has_custom_discount": false,
"has_free_shipping": false,
"has_payment_fee": 0,
"sub_total": "1999.00",
"before_vat": "2119.00",
"discount": "0.00",
"super_discount": "0.00",
"loyalty_points_discount": "0.00",
"custom_discount": "0.00",
"sub_total_after_discount": "0.00",
"vat": "0.00",
"shipping": "120.00",
"shipping_excl_vat": "0.00",
"original_shipping": null,
"payment_fee": "0.00",
"payment_fee_excl_vat": "0.00",
"grand_total_before_cash_discount": "0.00",
"grand_total": "2119.00",
"cash_coupon_discount": "0.00",
"loyalty_points_discount_over_amount": null,
"cash_coupon_discount_over_amount": null,
"receive_cash": "0.00",
"change_cash": "0.00",
"vat_include": false,
"vat_document": 0,
"vat_product_incl_vat": 1,
"vat_discount_incl_vat": 1,
"vat_shipping_incl_vat": 1,
"vat_payment_incl_vat": 1,
"loyalty_points_discount_type": "p",
"custom_discount_type": "p",
"weight_total": 0,
"order_status_id": 3,
"shipping_id": 0,
"shipping_method_real": "",
"shipping_ems": "",
"shipping_ems_status": 0,
"shipping_gps": "",
"shipping_status": 0,
"shipping_datetime": "-0001-11-30 00:00:00",
"payment_id": 470052,
"payment_method_real": "transfer",
"payment_status": true,
"payment_datetime": "2023-05-02 20:36:00",
"stock_mgt": 0,
"stock_minus_stock": 0,
"return_order": 0,
"cancel_order": 0,
"cancel_order_notify": 0,
"cancel_order_notify_send": 0,
"custom_invoice": 0,
"ip_address": "********",
"note": "********",
"admin_note": "",
"customer_group_id": 0,
"pos_customer_id": 0,
"is_anonymous": false,
"is_cod": false,
"guest_id": 934892,
"is_warehouse_send": 1,
"full_order_code": "***********",
"full_receipt_code": "***********",
"invoice_url": "http://********",
"schedule_at": null,
"shipping_method_name": "********",
"payment_method_name": "********************",
"count_order": null,
"latest_order_payment": null,
"country_name": "*******",
"shipping_country_name": "*******",
"full_name": "******** ********",
"is_paid": true,
"is_credit_term": false,
"aff_order_short": null,
"order_line_shopping": null,
"order_shopee_api": [],
"order_tik_tok_shop": null,
"shopee_api_transaction": null,
"order_lazada": [],
"order_tag": [],
"order_social": null,
"get_point": null,
"sub_order": [],
"order_additional_data": null,
"order_item": [
{
"order_item_id": 543850,
"order_id": 432580,
"product_variant_id": 744800,
"product_id": 71212,
"category_id": 9354,
"name": "********",
"pv_name": "********",
"category_name": "********",
"sku": "********",
"qty": 1,
"price": 1999,
"total": 1999,
"weight": 7000,
"has_wholesale": false,
"wholesale_qty": "0",
"wholesale_price": "0.00",
"wholesale_subtotal": "0.00",
"loyalty_points": "0",
"seq": 1,
"customer_group_id": 0,
"original_price": "1020.00",
"cost": null,
"unit": null,
"is_product_set_main": false,
"is_product_set_child": false,
"from_product_set_oi_id": null,
"from_product_set_pv_id": null,
"length": "0.00",
"width": "0.00",
"height": "0.00",
"barcode": "***************",
"product": {
"product_id": 71212,
"date_created": "2023-04-03 13:26:30",
"date_modified": "2023-04-03 13:27:06",
"stock_modified": "0000-00-00 00:00:00",
"ping_datetime": "0000-00-00 00:00:00",
"store_id": 5442,
"type": 1,
"name": "********",
"description": "",
"prepend_description_id": null,
"append_description_id": null,
"meta_keyword": "",
"meta_description": "",
"seo_url": "********",
"short_url": "",
"price": 1020,
"label": "",
"length": 20,
"width": 20,
"height": 2,
"length_class_id": 0,
"weight": 7000,
"override_loyalty": false,
"loyalty_points": 0,
"remain_stock": 0,
"seq": 47,
"added_to_es": 1,
"copy_product_id": 0,
"active": false,
"deleted": 0,
"brand_id": 0,
"product_attribute": null,
"shipping_method": null,
"activate_category_attribute": 0
}
}
],
"currency": {
"currency_id": 2,
"date_created": "2013-02-20 14:00:00",
"date_modified": "2013-02-20 14:00:00",
"name": "US Dollar",
"iso4217": "USD",
"num": "840",
"symbol": "$",
"symbol_left": "$ ",
"symbol_right": "",
"decimal_place": "2",
"active": true
},
"order_attachment": null,
"order_billing": null,
"discount_obj": null,
"country": {
"country_id": 5,
"date_created": "2012-04-25 10:50:00",
"date_modified": "2012-04-26 10:06:33",
"country_name": "********",
"country_short_name": "TH",
"country_code": "66",
"flag": "img/country_flag/th.png",
"weight_limit": 20000,
"zone_id": 7,
"active": 1
},
"shipping_country": {
"country_id": 5,
"date_created": "2012-04-25 10:50:00",
"date_modified": "2012-04-26 10:06:33",
"country_name": "********",
"country_short_name": "TH",
"country_code": "66",
"flag": "img/country_flag/th.png",
"weight_limit": 20000,
"zone_id": 7,
"active": 1
}
}
}
}
อัปเดตเมื่อ: 29/10/2024
ขอบคุณ!