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.

  • id
  • key
  • message
  • subscription_id
  • event_specific_data
  • created_at

The following are different types of events you may see in the `key` field:

  • payment_success
  • payment_failure
  • signup_success
  • signup_failure
  • billing_date_change
  • renewal_success
  • renewal_failure
  • subscription_state_change
  • subscription_product_change
  • zferral_revenue_post_success Specific to the Zferral integration
  • zferral_revenue_post_failure Specific to the Zferral integration
  • expiring_card
  • customer_update
  • renewal_success_recreated Created as result of this incident
  • renewal_failure_recreated Created as result of this incident
  • payment_success_recreated Created as result of this incident
  • payment_failure_recreated Created 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