Webhooks Reference

Webhooks are sent as HTTP POST requests to your URL with a form-encoded body (content-type: application/x-www-form-urlencoded) for easy parsing in almost any programming language.

All webhooks contain the following keys:

id A unique, numeric identifier for the webhook. You can use this value to record which webhooks you’ve already seen, recorded, or acted on.
event An identifier for the type of event that occurred. See the list of events.
payload

A “hash” of pertinent data about the event. Keys and sub-keys in the hash are denoted using square bracket notation in the key. For example, the product name would be included as the following form-encoded key/pair value in the content body of a signup_success webhook:

payload[subscription][product][name]=Basic

Webhook Limitations

Advanced Billing places two limitations on your site for how webhooks can be used. These limitations include data retention (the amount of time old webhooks are stored) and the number of endpoints allowed per site. For more information, refer to how webhooks are limited.

Webhook Timestamps

Webhooks sent from Advanced Billing use EST for all content in the payload body. In contrast, API responses from Advanced Billing use the timezone of the current site.

Webhook Acknowledgment and Automatic Retries

Upon receiving a webhook, you should accept it by returning an HTTP "200 OK" response as quickly as possible. Sending any other response (e.g., "500 Internal Server Error," "404 Not Found") or failing to respond within approximately 15 seconds will trigger automatic retries.

Advanced Billing will attempt to send each webhook event up to five times before giving up. The retries follow a backoff schedule:

Attempt Approximate timing
1 As soon as possible after the original event
2 10 seconds after the most recent failure
3 15 seconds after the most recent failure
4 90 seconds after the most recent failure
5 180 seconds after the most recent failure

If you use the webhook replay feature via the webhook API or the webhook panel, avoid duplicate actions by following these suggestions:

  • Use the unique webhook ID to track which webhooks you’ve already processed.
  • Do not replay webhooks until the last_attempt_at timestamp is well outside the automatic retry intervals.

Inoperative Endpoints

Merchants often set up temporary webhook endpoints for testing purposes but forget to deactivate them. Inoperative endpoints can cause significant system strain as Advanced Billing attempts to deliver webhooks.

If repeated failures occur, Advanced Billing may pause or disable the endpoint. Below are examples of failure counts and their associated states:

Failure count State System behavior
1 to 25 Enabled Retries proceed automatically
26 to 50 Paused Webhooks are generated in a paused state and must be manually sent using the webhooks panel. The endpoint is checked every two hours for responsiveness and re-enabled if functional.
51 and over Disabled Webhooks are no longer generated for this endpoint
If you delete an endpoint from Advanced Billing, paused webhooks referencing the deleted endpoint cannot be resent.

 

Events

The following events are monitored within Advanced Billing and can generate Webhooks:

Event Key Trigger Payload
billing_date_change

Any change to the billing date that is initiated explicitly by altering the billing date through the application or the API. This will not be triggered by a normal renewal and period advancement, or a migration.

Payload Example

event_id, site, subscription1 (with previous_billing_date)
component_allocation_change

Any change to the Subscription quantity-based component allocation, enabled status of an on/off component, or a purchase of a prepaid component allocation that is made after signup.

This webhook does not fire if allocations are set as a part of the Subscription creation (that is, signup). It only fires upon subsequent changes. previous_allocation and new_allocation give the allocation,values before and after the change. These will be either 0 or 1 for On/Off Components to represent off and on, respectively. timestamp provides the date and time the allocation was recorded and is listed in ISO8601 format in the UTC timezone.

Note, this timestamp format differs slightly from the format of existing timestamps in other event types and represents our new direction for webhook timestamps.

Payload Example

event_id, site, component, subscription, product, previous_allocation, new_allocation, memo,timestamp
custom_field_value_change A change to any custom field value, whether adding a custom field at signup, or updating a custom field on an existing Subscription or Customer record. Payload Example
customer_create A new customer is created.

Payload Example

event_id, site, customer
customer_delete

When a customer is deleted.

Note, this webhook is not triggered by the deletion of a Subscription and Customer simultaneously; it is only triggered by explicitly deleting the customer as a single action.

Payload Example
customer_update Any change to the following Customer fields: first_name, last_name,organization, email, reference, address, address 2, city,state, zip, country, phone, vat_number, parent_id, cc_email.

Payload Example

event_id, site, customer

delayed_subscription_creation_failure A failure to create a delayed Subscription.

Payload Example

event_id, site, subscription
delayed_subscription_creation_success Successful creation of a delayed Subscription in an awaiting signup state.

Payload Example

event_id, site, subscription
direct_debit_payment_paid_out When Direct Debit Payment was successfully processed in the gateway (currently, only Stripe and GoCardless are supported).

Payload Example

event_id, site, subscription, transaction
direct_debit_payment_pending When Direct Debit Payment was created in the gateway and it is waiting for being processes (currently, only Stripe and GoCardless are supported).

Payload Example

event_id, site, subscription, transaction
direct_debit_payment_rejected When Direct Debit Payment was rejected in the gateway, e.g. insufficient funds on the customer account (currently, only Stripe and GoCardless are supported).

Payload Example

event_id, site, subscription, transaction
dunning_step_reached When a subscription reaches any step of the dunning process, a webhook will be generated.

Payload Example

event_id, site, subscription,product, dunner, current_step, next_step
expiration_date_change Any change to an existing expiration_date for a subscription.

Payload Example

event_id, site, subscription
expiring_card A periodic event sent by Advanced Billing.

Payload Example

event_id, site, subscription 1, 6
invoice_issued Invoices issued towards a subscription on Relationship Invoicing site.

Payload Example

event_id, site, subscription1, invoice
metered_usage

Any reported usage for a Subscription's metered components.

This webhook will not fire when the unit balance is reset to 0 at the time of renewal.timestamp provides the date and time the usage was recorded and is listed in ISO8601 format in the UTC timezone. Note: this timestamp format differs slightly from the format of existing timestamps in other event types and represents our new direction for webhook timestamps.

Payload Example

event_id, site,component, subscription, product, previous_unit_balance, new_unit_balance, usage_quantity, memo, timestamp
payment_failure

Any failed payment attempt.4

Payload Example

event_id, site, subscription, transaction
payment_success Any payment attempt 4 that does not result in an immediate failure. 

Payload Example

event_id, site, subscription, transaction
pending_cancellation_change When a subscription is canceled with delay (cancel at end of period) or delayed pending cancellation is cleared.

Payload Example

event_id, site, subscription1 , cancellation_state, cancels_at
pending_payment_created When a Pending Payment was created in the gateway and it is waiting for being processes.

Payload Example

event_id, site, subscription, transaction
pending_payment_completed When a Pending Payment was successfully processed in the gateway.

Payload Example

event_id, site, subscription, transaction
pending_payment_failed When a Pending Payment was rejected in the gateway.

Payload Example

event_id, site, subscription, transaction
prepaid_subscription_balance_change Any change to a prepaid Subscription’s usage or prepayment balance.

Payload Example

event_id, site, subscription, prepaid_configuration, customer, product, product_family, credit_card, group
prepaid_usage

Any recorded usage for a Subscription’s prepaid component will fire off this webhook.

Note, changes in allocation are reflected in a component_allocation_change webhook.

Payload Example

event_id, site, component, subscription, product, previous_unit_balance, usage_quantity, previous_overage_unit_balance, new_overage_unit_balance, overage_usage_quantity, price_point_id
renewal_failure A failed periodic renewal, i.e. the credit card is declined.3

Payload Example

event_id, site, subscription1, transaction
renewal_success A successful periodic renewal.3

Payload Example

event_id, site, subscription, transaction
signup_success Any successful signup (Subscription created) through the API, application, or Public Pages.

Payload Example

event_id, site, subscription1,8
signup_failure Any failed signup (Subscription failed to begin) through the API, application, or Public Pages.2

Payload Example

event_id, site, subscription1
subscription_bank_account_update When a Subscription adds or updates a bank account. Payload Example
subscription_card_update Any change to the active credit card type payment profile. This includes partial card/billing address updates. Deletion of PayPal payment profiles.7

Payload Example

event_id, site, subscription,product, previous_payment_profile, updated_payment_profile, customer
subscription_group_card_update Any change to the active credit card type payment profile on the Subscription group.

Payload Example

event_id, site, subscription_group, previous_payment_profile, updated_payment_profile, customer
subscription_group_signup_failure When a Subscription group signup fails via the Subscription Group Signup endpoint. Payload Example
subscription_group_signup_success When a Subscription group signup is successful via the Subscription Group Signup endpoint. Payload Example
subscription_prepayment_account_balance_changed

When a Subscription prepayment account balance changes. This occurs when a prepayment is applied to a Subscription (increase the balance), or when a prepayment is used to make a payment on an invoice (decrease the balance).

Payload Example
subscription_product_change

A successful change from an old product to a new product for a subscription.

This webhook will fire for a product version change.

Payload Example

event_id, site, previous_product, subscription1
subscription_service_credit_account_balance_changed Any change to the Subscription service credit account balance. This occurs when a service credit is applied to a Subscription (increase the balance), or when a service credit is used to make a payment on an invoice (decrease the balance). Payload Example
subscription_state_change Any change to the Subscription state. This is the "workhorse" of the events. Watching this event can tell you if a Subscription moves to a “bad” state, i.e. past_due

Payload Example

event_id, site, subscription1,5
upcoming_renewal_notice A webhook will be generated 3 days before a Subscription is set to renew.

Payload Example

event_id, site, customer, email_sent, estimated_renewal_amount_in_cents, message, payment_profile, product,subscription (condensed)
upgrade_downgrade_failure Any failed upgrade/downgrade.

Payload Example

event_id, site, subscription1, previous_product
upgrade_downgrade_success Any successful upgrade/downgrade.

Payload Example

event_id, site, subscription1, previous_product

1 The subscription object also contains information on the Customer and Product.
2 This is usually caused by a failure at the payment gateway. This event is not generated for input validation errors (i.e. forgetting to fill in a field).
3 At the end of every recurring interval, either a renewal_success or a renewal_failure event is triggered once. If a card is declined and a renewal_failure is triggered, a subsequent payment that brings the account current will not generate a renewal_success (although it will generate a payment_success and a subscription_state_change)
4 payment_success or payment_failure are triggered for every payment attempted, whether it is for a normal renewal, a One-time Charge, a retry after failure, or a payment applied to an Invoice. Note that in some cases the payment may fail later, most commonly with ACH/eCheck and Direct Debit.
5 Note that the subscription object you are given contains keys for both previous_state and state so you can track the changes.
6 The expiring_card webhook is sent on the 1st, 15th and 7 days before the end of the month. This will identify all cards expiring in the current month.
7Additions of new PayPal accounts, changes/deletions of bank account / ACH type payment profiles do not currently generate any webhooks.
8 Component allocations are not currently included in the signup_success webhook.

Multiple webhook events may be triggered by a single system event. For example, the creation of a new Subscription will typically fire both a `signup_success` and `payment_success` event (if a payment was necessary to start the Subscription).

 

Statement Events

At the end of every period (e.g., at renewal), a statement_closed or statement_settled webhook is triggered. The statement_settled webhook indicates that the statement closed and payment was successfully received (or payment was not required). The statement_closed webhook indicates that the statement closed but payment was not successfully received.

For example, if you receive a statement_closed webhook for statement #3, you will also receive a statement_settled webhook for statement #3 at a later time if the statement becomes paid (e.g., after a dunning retry or card update).

Payloads

The resource objects sent as payloads typically contain the same information as the corresponding API resource. Site payload objects include the site’s id and subdomain. For payload examples for each type of event, refer to the Payload Examples article.

Webhook Verification

Using your Site shared key and a “signature” (signature_hmac_sha_256) that is calculated and sent with the webhook, you can verify the authenticity and integrity of a webhook.

Deprecation

Previously, the signature was calculated using the MD5 hex digest. This method is now deprecated. We include both the old signature (signature) and the new signature (signature_hmac_sha_256) for backward compatibility. Ignore signature. The MD5 signature will be removed in a future update.

Protect your site’s shared key as you would your password. A compromised shared key could allow malicious actors to generate falsified webhooks that pass signature verification.

Webhook Signature

Webhooks are signed using an HMAC-SHA-256 hex digest of the raw HTTP body of the webhook post, with your shared key as the secret. In Ruby:

OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), site.shared_key, webhook.body)

For example, if your shared key is 123 and the webhook request body is payload[chargify]=testing&event=test, then the signature_hmac_sha_256 is: 19826d51b9f866b26eda1f154de192593360f8d0bcb63df8a28540a5dcf733f1.

This signature is sent with the webhook in the header X-Chargify-Webhook-Signature-Hmac-Sha-256. Alternatively, it can be appended to your URL as a query parameter using {signature_hmac_sha_256}.

For instance, providing the URL http://example.com/?signature_hmac_sha_256={signature_hmac_sha_256} would result in the following webhook being posted:

http://example.com/?signature_hmac_sha_256=19826d51b9f866b26eda1f154de192593360f8d0bcb63df8a28540a5dcf733f1
When in doubt, verify webhook data by checking the current resource state using the API.

Payments - Direct Debit

There are three webhooks in Advanced Billing that are related to payments status change:

  • direct_debit_payment_pending - This webhook is sent when payment was created in Stripe (payment is waiting for being processes).
  • direct_debit_payment_paid_out - This webhook is sent when payment was successfully processed in Stripe.
  • direct_debit_payment_rejected - This webhook is sent when payment was rejected in Stripe (e.g. insufficient funds on the customer account).

Finding Your Site Shared Key

Your site’s shared key is automatically generated when the site is created. You can view or update it by selecting “Edit current Site” from the Site dropdown menu in the utility bar.

Configuring Webhooks

Configure webhooks in the Settings tab for each site. Enable webhooks, provide a target URL, and subscribe to specific events. Note: the target URL can only use ports 80 and 443, specified via http or https.

Webhook Testing

Use the Webhook Testing tab (located under Tools) to send test webhook data to any configured endpoint. This feature ensures the operational status of your endpoint, though the payload may not match production webhooks. Test webhooks include the following payload:

id=123456&event=test&payload[chargify]=testing

For comprehensive testing, use a sandbox account to create test subscriptions and perform actions that trigger live webhooks. Refer to the Payload Examples article for full examples.

Testing Tip: Use tools like UltraHook or RequestBin to inspect webhook contents and headers during development.

 

Webhook Metadata

Webhook records include metadata about their acceptance or rejection by your application, as well as details about errors encountered during delivery attempts. Metadata attributes include:

  • id: Unique identifier for the webhook, consistent across retries/replays.
  • successful: Boolean indicating whether the webhook was accepted on its last attempt.
  • created_at: Timestamp for when the webhook was created.
  • accepted_at: Timestamp for when the webhook was successfully accepted.
  • last_sent_at: Timestamp for the most recent delivery attempt.
  • last_error_at: Timestamp for the last failed delivery attempt.
  • last_error: Description of the error from the last failed attempt.

Webhooks retain their event and payload data. Refer to the Webhook API for detailed attribute documentation.

Once a webhook is accepted, the accepted_at timestamp will be filled. This timestamp can be viewed via the webhooks API or in the webhooks panel, if available for your plan.

Population of Webhook Data

Each event in Advanced Billing generates a unique webhook payload containing relevant subscriber data. However, not all values may be populated in the payload. Use discretion to determine whether the data is available and how to handle missing information.

For instance, the reason_code data is not delivered in a signup_success webhook. Future updates to this documentation will provide additional examples of nil results in payload data.

Was this article helpful?
0 out of 0 found this helpful