Webhooks are HTTP callbacks that are triggered when an event occurs. You can use webhooks to get notified when an event occurs in Lotus.

Here is a list of current webhooks.

Webhook Types

customer.created

This webhook is generated when a customer is created.

invoice.created

This webhook is generated when a subscription ends and an invoice is generated.

invoice.paid

This webhook is generated when a payment through a payment provider integration is successful (i.e. a payment through Stripe).

invoice.past_due

This webhook is generated when the due date of an invoice has passed and the invoice is still unpaid.

subscription.created

This webhook is generated when a subscription is created.

usage_alert.triggered

This webhook is generated when a usage alert is triggered. This is useful for notifying your users when they are approaching their usage limit.

subscription.renewed

This webhook is generated when a subscription is renewed.

Creating Webhooks

You can create webhooks from the Developer Settings tab of the Settings page. After creating a webhook, you will be able to see the folloowing information, including the webhook secret, which is used for verifying the authenticity of the request.

Creation

Consuming Webhooks

Lotus uses a service called Svix to handle the complexity behind webhooks, most importantly the signature verification so you can have peace of mind that the webhooks you receive are authentic. Once you have your webhook secret in hand, head over to this page to learn how to verify webhooks, with examples for all the most popular frameworks including Django, Next, Gin, Ruby, and more!.

Webhook Response Schema

{
  "attempt": 5,
  "created_at": "2023-01-20 08:33:35.310436+00:00",
  "properties": {
    "event_type": "invoice.created",
    "payload": {}
  }
}

event_type
string (WebhookTriggerEventEnum)
required

Enum: "customer.created" "invoice.created" "invoice.past_due" "invoice.paid" "subscription.created" "usage_alert.triggered" "subscription.renewed"

payload
object
required

The payload of the webhook. The structure of the payload depends on the event type. For customer.created, the response will be a customer. For invoice.*, the response will be an invoice. For subscription.created, the response will be a subscription. For usage_alert.triggered, the response will be a UsageAlertPayload, explained below. For subscription.renewed, the response will be a subscription.

UsageAlertPayload

Usage