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
  • expiring_card
  • customer_update
  • subscription_deletion
  • component_allocation_change
  • metered_usage
  • upgrade_downgrade_success
  • upgrade_downgrade_failure
  • trial_end_notice
  • upcoming_renewal_notice
  • statement_closed
  • statement_settled
  • subscription_card_update
  • subscription_bank_account_update
  • subscription_paypal_account_update
  • refund_success
  • refund_failure
  • expiration_date_change
  • account_transaction_changed – Transaction Deleted
  • zferral_revenue_post_success – Specific to the Zferral integration
  • zferral_revenue_post_failure – Specific to the Zferral integration
  • 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: filter – any type listed above, 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: filter – any type listed above, 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 20 responses per page. Get additional pages or more results per page (up to 200) by passing the page and per_page parameters:

https://[@subdomain].chargify.com/subscriptions/[@subscription.id]/events.json?per_page=100&page=3