mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-08-31 23:36:57 +00:00
57 lines
2.2 KiB
Go
57 lines
2.2 KiB
Go
//go:build billing
|
|
|
|
package billing
|
|
|
|
// Stripe webhook event types the appview subscribes to.
|
|
//
|
|
// When adding or removing an entry here, update four places:
|
|
// 1. The switch in HandleWebhook (billing.go)
|
|
// 2. The SubscribedEvents slice below
|
|
// 3. The Stripe Dashboard endpoint subscription list
|
|
// 4. docs/BILLING.md "Webhook Events" table
|
|
const (
|
|
// EventCheckoutSessionCompleted fires when a customer finishes Stripe Checkout.
|
|
// No-op handler: customer.subscription.created does the actual tier work.
|
|
EventCheckoutSessionCompleted = "checkout.session.completed"
|
|
|
|
// EventSubscriptionCreated fires on initial subscription creation.
|
|
EventSubscriptionCreated = "customer.subscription.created"
|
|
|
|
// EventSubscriptionUpdated fires on plan change, renewal, status transition.
|
|
// Workhorse event: covers active→past_due, past_due→unpaid, resumes, plan
|
|
// upgrades/downgrades, etc.
|
|
EventSubscriptionUpdated = "customer.subscription.updated"
|
|
|
|
// EventSubscriptionDeleted fires when the subscription is fully canceled.
|
|
EventSubscriptionDeleted = "customer.subscription.deleted"
|
|
|
|
// EventSubscriptionPaused fires when a trial ended without a payment method.
|
|
EventSubscriptionPaused = "customer.subscription.paused"
|
|
|
|
// EventSubscriptionResumed fires when a paused subscription resumes.
|
|
EventSubscriptionResumed = "customer.subscription.resumed"
|
|
|
|
// EventInvoicePaymentFailed fires when a card declines (initial or renewal).
|
|
// Logged only. Stripe Smart Retries handle retries and email the customer.
|
|
// Tier stays put; subscription.updated handles past_due/unpaid transitions.
|
|
EventInvoicePaymentFailed = "invoice.payment_failed"
|
|
|
|
// EventChargeDisputeCreated fires when a chargeback is opened.
|
|
// Logged only. Stripe emails the account owner about disputes by default.
|
|
EventChargeDisputeCreated = "charge.dispute.created"
|
|
)
|
|
|
|
// SubscribedEvents is the full set of events that must be enabled on the
|
|
// Stripe Dashboard webhook endpoint. Use this when configuring a new endpoint
|
|
// or auditing an existing one.
|
|
var SubscribedEvents = []string{
|
|
EventCheckoutSessionCompleted,
|
|
EventSubscriptionCreated,
|
|
EventSubscriptionUpdated,
|
|
EventSubscriptionDeleted,
|
|
EventSubscriptionPaused,
|
|
EventSubscriptionResumed,
|
|
EventInvoicePaymentFailed,
|
|
EventChargeDisputeCreated,
|
|
}
|