events

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 1 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL