Webhooks

A webhook is a URL eCurring will call when an object’s status changes, for example when a subscription is activated (the status changes from unverified to active). You're responsible for creating a script that will fetch the object's status once the webhook is called.

Subscription and transaction webhooks

Both subscriptions and transactions can have their own webhook. The subscription webhook will be called when the subscription status changes and the transaction webhook will be called when the transaction status changes.

When creating a subscription it's also possible to provide a webhook for all of the transactions that will be created automatically by our system (in accordance with the collection cycles in your subscription plan). This webhook will also automatically be added to any transactions you manually create using the API.

For subscription's the following statuses will trigger the webhook:

  • active
  • cancelled
  • paused
  • resumed

For transactions they are the following:

  • succeeded
  • fulfilled
  • charged_back
  • payment_failed
  • rescheduled
  • failed
  • payment_reminder_scheduled
  • payment_reminder_sent
  • payment_reminder_overdue

Keep in mind that it's possible for the webhook not to be called for a status that is changed within a very short period of time. For example, when the status changes from fulfilled to charged_back, it's possible the transaction will immediately be rescheduled. In this case we will only call your webhook once, as you would only see rescheduled upon retrieving the transaction status. The full transaction status history is included in every transaction, should you require this information.

Subscription webhook

A POST request will be made with a JSON body containing the subscription_id as it's only property, which for example will contain the value 534532113. You should use that ID to fetch the subscription and retrieve the latest status. For security reasons we don't provide any information in the call to your webhook.

Example

{
  "subscription_id": "534532113"
}

Transaction webhook

A POST request will be made with a JSON body containing the transaction_id and the subscription_id of the subscription the transaction belongs to.

Example

{
  "subscription_id": "534532113",
  "transaction_id": "348fbaea-950f-4db0-8cc4-36deb1a932ec"
}