I am using WooCommerce Subscriptions, and have created a web hook for when a customer cancels their subscription...
I want to update a MySQL database record from 'Publish' to 'Delete' upon this event occurring. I have created a new page for it etc. in a delivery URL.
FORM/POST PARAMETERS
webhook_id: 4099
HEADERS
Cf-Connecting-Ip: 212.227.29.24
Content-Length: 15
Total-Route-Time: 0
Host: requestb.in
Accept: */*
Cf-Visitor: {"scheme":"https"}
Accept-Encoding: gzip
Referer: https://requestb.in/sqwf1tsq
User-Agent: WooCommerce/3.1.2 Hookshot (WordPress/4.8.1)
Connect-Time: 1
Content-Type: application/x-www-form-urlencoded
Cf-Ray: 39d5a75dc8980f45-FRA
X-Request-Id: e1b16cd7-fb41-471b-9c47-dce0dd7260cc
Cf-Ipcountry: DE
Via: 1.1 vegur
Connection: close
RAW BODY
webhook_id=4099
But... how do I get any variables from a web hook payload? Its so confusing (newbie here!). I'd like to get either the username or a variable called 'barcode' which is stored for each user/customer, which I can then identify in the separate database and make the change.
Hope that makes sense..!
Help would be appreciated, Many thanks!!
The function you have responding to the webhook should listen for the php input stream.
From here, you can see which properties you'll want to grab.