API: Events
Chargify Events include various activity that happens around a Site.
The following fields are returned from GET (read) operations. Note, all events are read only.
idkeymessagesubscription_idevent_specific_datacreated_at
The following are different types of events you may see in the `key` field:
payment_successpayment_failuresignup_successsignup_failurebilling_date_changerenewal_successrenewal_failuresubscription_state_changesubscription_product_changezferral_revenue_post_successSpecific to the Zferral integrationzferral_revenue_post_failureSpecific to the Zferral integrationexpiring_cardcustomer_updaterenewal_success_recreatedCreated as result of this incidentrenewal_failure_recreatedCreated as result of this incidentpayment_success_recreatedCreated as result of this incidentpayment_failure_recreatedCreated as result of this incident
Methods
List Events for a Subscription
URL: https://<subdomain>.chargify.com/subscriptions/<subscription_id>/events.<format>
Method: GET
Formats: JSON, XML
Optional Parameters: page, per_page, since_id, max_id, direction – values asc and desc are valid, desc by default
Response: An array of Events
List Events for a Site
URL: https://<subdomain>.chargify.com/events.<format>
Method: GET
Formats: JSON, XML
Required Parameters: id
Optional Parameters: page, per_page, since_id, max_id, direction – values asc and desc are valid, desc by default
Response: An array of Events
Event Specific Data
Each event type has its own `event_specific_data` specified.
Here’s an example event for the `subscription_product_change` event:
{
"event": {
"id": 351,
"key": "subscription_product_change",
"message": "Product changed on Marky Mark's subscription from 'Basic' to 'Pro'",
"subscription_id": 205,
"event_specific_data": {
"new_product_id": 3,
"previous_product_id": 2
},
"created_at": "2012-01-30T10:43:31-05:00"
}
}
Here’s an example event for the `subscription_state_change` event:
{
"event": {
"id": 353,
"key": "subscription_state_change",
"message": "State changed on Marky Mark's subscription to Pro from trialing to active",
"subscription_id": 205,
"event_specific_data": {
"new_subscription_state": "active",
"previous_subscription_state": "trialing"
},
"created_at": "2012-01-30T10:43:33-05:00"
}
}
Pagination
Results are paginated and return 30 responses per page. Get additional pages by passing a `page` parameter:
https://[@subdomain].chargify.com/subscriptions/[@subscription.id]/events.json?page=3