android

package
v0.167.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigEnvPrefix is the prefix applied to environment variables for configuring Android Billing.
	ConfigEnvPrefix = "ANDROID_"
)

Variables

This section is empty.

Functions

func HandleRTDN added in v0.166.0

func HandleRTDN(res http.ResponseWriter, req *http.Request)

HandleRTDN handles Real-Time Developer Notifications from Google Pub/Sub. Configure a Pub/Sub push subscription pointing at /billing/rtdn in Play Console.

Types

type Config

type Config struct {
	// PackageName is what the app package is named in the Google Play Store.
	PackageName   string   `koanf:"packagename"   validate:"required"`
	PubSubEmail   string   `koanf:"pubsubemail"   validate:"required,email"`
	Subscriptions []string `koanf:"subscriptions" validate:"required"`
}

Config is the configuration for Android Billing.

type Entitlement

type Entitlement struct {
	UserID        string
	SKU           string
	PurchaseToken string
	ExpiresAt     *time.Time // nil for lifetime/one-time purchases
	GrantedAt     time.Time
}

Entitlement represents a verified, active entitlement for a user.

func VerifyAndAcknowledgeSubscription

func VerifyAndAcknowledgeSubscription(
	ctx context.Context,
	user *models.User, sku, token string,
) (*Entitlement, error)

VerifyAndAcknowledgeSubscription verifies a subscription purchase.

type PurchaseState

type PurchaseState int

PurchaseState mirrors the Play API integer values.

const (
	PurchaseStatePurchased PurchaseState = 0
	PurchaseStateCancelled PurchaseState = 1
	PurchaseStatePending   PurchaseState = 2
)

Jump to

Keyboard shortcuts

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