如何从WooCommerce API Webhooks接收数据

时间:2016-04-29 02:35:31

标签: json wordpress api woocommerce webhooks

交付方式是秘密邮寄;
送货地址:www.domain2.com/wc_back.php
数据是json:

{
    "order":{
        "id":623,
        "order_number":623,
        "order_key":"wc_order_57224dc67c4ec",
        "created_at":"2016-04-28T17:52:06Z",
        "updated_at":"2016-04-28T17:52:06Z",
        "completed_at":"2016-04-28T17:52:06Z",
        "status":"on-hold",
        "currency":"USD",
        "total":"23.00",
        "subtotal":"23.00",
        "total_line_items_quantity":1,
        "total_tax":"0.00",
        "total_shipping":"0.00",
        "cart_tax":"0.00",
        "shipping_tax":"0.00",
        "total_discount":"0.00",
        "shipping_methods":"",
        "payment_details":{
            "method_id":"bacs",
            "method_title":"u4ebau6c11u5e01u4ed8u6b3euff08u5faeu4fe1/u652fu4ed8u5b9duff09",
            "paid":false
        },
        "billing_address":{
            "first_name":"test",
            "last_name":"test",
            "company":"",
            "address_1":"",
            "address_2":"",
            "city":"",
            "state":"",
            "postcode":"",
            "country":"US",
            "email":"test@163.com",
            "phone":""
        },
        "shipping_address":{
            "first_name":"test",
            "last_name":"test",
            "company":"",
            "address_1":"",
            "address_2":"",
            "city":"",
            "state":"",
            "postcode":"",
            "country":"US"
        },
        "note":"",
        "customer_ip":"192.200.194.126",
        "customer_user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36",
        "customer_id":0,
        "view_order_url":"http://www.domain.com/my-account/view-order/623",
        "line_items":[
            {
                "id":151,
                "subtotal":"23.00",
                "subtotal_tax":"0.00",
                "total":"23.00",
                "total_tax":"0.00",
                "price":"23.00",
                "quantity":1,
                "tax_class":null,
                "name":"u5251u7075u7f8eu670du91d1u5e01100G",
                "product_id":26,
                "sku":"bnsus100g",
                "meta":[

                ]
            }
        ],
        "shipping_lines":[

        ],
        "tax_lines":[

        ],
        "fee_lines":[

        ],
        "coupon_lines":[

        ],
        "customer":{
            "id":0,
            "email":"test@163.com",
            "first_name":"test",
            "last_name":"test",
            "billing_address":{
                "first_name":"test",
                "last_name":"test",
                "company":"",
                "address_1":"",
                "address_2":"",
                "city":"",
                "state":"",
                "postcode":"",
                "country":"US",
                "email":"test@163.com",
                "phone":""
            },
            "shipping_address":{
                "first_name":"test",
                "last_name":"test",
                "company":"",
                "address_1":"",
                "address_2":"",
                "city":"",
                "state":"",
                "postcode":"",
                "country":"US"
            }
        }
    }
}

我在另一个网站www.domain2.com/wc_back.php上收到了数据。
我不知道怎么做,我需要有人帮助我做到。

我希望将存储在txt文件中的数据作为格式化的json变量接收 如果您需要补偿,我们可以协商。

0 个答案:

没有答案