Webhook Callbacks

After each event in Stripe, various webhook callbacks are triggered. These event's are used to notify other systems about what's just occurred, to allow the systems to respond.

For full functionality with Charge, you'll need to configure the webhooks to callback to your Craft install. This can be done very simply from the Stripe Dashboard > Settings.

Working Locally? Never fear - with an extra step you can receive webhooks on your local machine. Configuring Local Webhooks

Configuring the Webhook Callbacks #

The configuration for the callbacks is done from the Stripe Dashboard > Settings > Webhooks area.

You'll need some site and environment specific details which can be found in the Charge CP > Settings > Stripe > Webhooks area.

Take the value for Webhook Endpoint, and enter it in the Webhook settings on your Stripe account. The same url should be used for both test and live modes. The url will look something like : http://craft.dev/index.php/actions/charge/webhook/callback

Checking your config #

You'll see a helper indicator in the Charge CP > Settings that shows the current state of the webhooks.

This is 3 states :

  • Green Webhooks are configured and working.
  • Yellow We have a record of previous callbacks, but none have been received in the last 24 hours.
  • Red We've no record of receiving callbacks. You need to check your config on the Stripe dashboard.

What are they for? #

Charge uses Stripe's Webhook callbacks to receive notifications of events that are triggered outside of Craft.

These type of events include any recurring payment events, subscription change events, or anything that's been triggered from the Stripe dashboard or other external connected apps.

Do I need to configure the webhooks? #

Not always.

If you're using a very simple Charge setup you can safely skip configuring the webhooks. Without webhooks configured you'll still be able to take one-time payments, and trigger any onSuccess actions. However any later payments, refunds that are triggered externally and other off-site changes will not be available.

Typically the only setups we'd recommend you can skip setting up the webhooks are basic donation builds. Anything that involves purchases, or other additional logic, including recurring payments, should always have webhooks configured.

Working Locally with Webhooks #

Standard dev practises likely involve building and developing the site in a local environment. In those situations you'll need to take an extra step to receive the callbacks because your build isn't publicly accessible to Stripe.

We recommend using Ultrahook in these situations.