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 ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// PackageName is what the app package is named in the Google Play Store.
PackageName string `koanf:"package_name" 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 VerifyAndAcknowledgeProduct ¶
func VerifyAndAcknowledgeProduct( ctx context.Context, user *models.User, sku, token string, ) (*Entitlement, error)
VerifyAndAcknowledgeProduct verifies a one-time product purchase and acknowledges it. Must be called within 3 days of purchase or Google will refund automatically.
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 )
Click to show internal directories.
Click to hide internal directories.