Documentation
¶
Overview ¶
Package events defines canonical, gateway-agnostic payment events and maps each gateway's raw webhook types onto them — so paywall logic (grant/revoke) is written once regardless of which gateway delivered the event.
Index ¶
Constants ¶
View Source
const ( PaymentSucceeded = "payment.succeeded" PaymentFailed = "payment.failed" SubscriptionActivated = "subscription.activated" SubscriptionCancelled = "subscription.cancelled" Unknown = "unknown" )
Canonical event names.
Variables ¶
This section is empty.
Functions ¶
func Normalize ¶
func Normalize(e contracts.WebhookEvent) string
Normalize maps a verified gateway webhook onto a canonical event.
switch events.Normalize(evt) {
case events.PaymentSucceeded: paywall.Grant(subject, plan, expiry)
case events.SubscriptionCancelled: paywall.Revoke(subject, plan)
}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.