Hello, I need a simple PHP script that will capture the data from ZOHO Subsciptions webhook and insert it into a mysql table.
Here is a sample of what is delivered to the URL address for processing:
{
"event_id": "1234",
"event_type": "subscription_created",
"data": {
"subscription": {
"updated_time": "2017-09-15T19:18:45-0400",
"notes": [],
"reference_id": "",
"addons": [],
"created_at": "2017-09-15",
"next_billing_at": "2017-10-15",
"taxes": [],
"payment_terms": 0,
"last_billing_at": "2017-09-15",
"currency_code": "USD",
"subscription_id": "1234",
"expires_at": "2017-10-15",
"interval_unit": "months",
"end_of_term": false,
"product_id": "323316000000251022",
"can_add_bank_account": false,
"plan": {
"setup_fee": 0,
"quantity": 1,
"tax_name": "",
"setup_fee_tax_percentage": "",
"plan_code": "500B",
"description": "",
"discount": 0,
"tax_id": "",
"setup_fee_tax_id": "",
"total": 20,
"setup_fee_tax_name": "",
"tax_type": "",
"price": 20,
"name": "500 Subscribers",
"tax_percentage": "",
"setup_fee_tax_type": "",
"plan_id": "12345"
},
"pricebook_id": "",
"payment_gateways": [
{
"payment_gateway": "stripe"
}
],
"created_time": "2017-09-15T19:18:45-0400",
"amount": 20,
"exchange_rate": 1,
"currency_symbol": "$",
"current_term_starts_at": "2017-09-15",
"custom_fields": [],
"current_term_ends_at": "2017-10-15",
"product_name": "Base 500",
"activated_at": "2017-09-15",
"salesperson_name": "",
"salesperson_id": "",
"child_invoice_id": "12345",
"contactpersons": [
{
"zcrm_contact_id": "",
"phone": "",
"mobile": "",
"email": "rjett@.com",
"contactperson_id": ""
}
],
"auto_collect": false,
"name": "Base 500-500 Subscribers",
"sub_total": 20,
"interval": 1,
"status": "live",
"payment_terms_label": "Due on Receipt",
"customer": {
"website": "",
"zcrm_account_id": "",
"last_name": "",
"billing_address": {
"zip": "",
"country": "U.S.A",
"city": "",
"phone": "",
"street": "",
"attention": "",
"street2": "",
"state": "",
"fax": ""
},
"ip_address": "[login to view URL]",
"display_name": "Richard ",
"payment_terms": 0,
"zcrm_contact_id": "",
"company_name": "T2C",
"salutation": "",
"shipping_address": {
"zip": "",
"country": "U.S.A",
"city": "",
"phone": "",
"street": "",
"attention": "",
"street2": "",
"state": "",
"fax": ""
},
"customer_id": "123456",
"first_name": "Richard",
"email": "rjett@.com",
"payment_terms_label": "Due on Receipt"
}
}
},
"event_time_formatted": "15 Sep 2017",
"event_source": "user",
"event_time": "2017-09-15"
}