receipt

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	StatusValid               = 0
	StatusUnreadable          = 21000
	StatusReceiptMalformed    = 21002
	StatusNotAuthenticated    = 21003
	StatusMismatchedSecret    = 21004
	StatusUnreachable         = 21005
	StatusSubscriptionExpired = 21006
	StatusReceiptFromTest     = 21007
	StatusReceiptFromProd     = 21008
	StatusUnauthorized        = 21010
)

https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1

Variables

This section is empty.

Functions

This section is empty.

Types

type IOS6ReceiptInfo

type IOS6ReceiptInfo struct {
	// contains filtered or unexported fields
}

func (IOS6ReceiptInfo) ExpiresAt

func (info IOS6ReceiptInfo) ExpiresAt() time.Time

func (IOS6ReceiptInfo) IsTrialPeriod

func (info IOS6ReceiptInfo) IsTrialPeriod() bool

func (IOS6ReceiptInfo) OriginalPurchaseDate

func (info IOS6ReceiptInfo) OriginalPurchaseDate() time.Time

func (IOS6ReceiptInfo) OriginalTransactionID

func (info IOS6ReceiptInfo) OriginalTransactionID() string

func (IOS6ReceiptInfo) PaidAt

func (info IOS6ReceiptInfo) PaidAt() time.Time

func (IOS6ReceiptInfo) ProductID

func (info IOS6ReceiptInfo) ProductID() string

type Info

type Info interface {
	Status() int
	AutoRenewStatus() bool
	CancelledAt() time.Time
	ExpiresAt() time.Time
	IsTrialPeriod() bool
	OriginalTransactionID() string
	OriginalPurchaseDate() time.Time
	PaidAt() time.Time
	ProductID() string
}

func Validate

func Validate(secret, receipt string) (Info, error)

type Millistamp added in v1.2.0

type Millistamp int64

func (Millistamp) Time added in v1.2.0

func (m Millistamp) Time() time.Time

type ReceiptInfoBody

type ReceiptInfoBody struct {
	Quantity              string      `json:"quantity"`
	ProductID             string      `json:"product_id"`
	TransactionID         string      `json:"transaction_id"`
	OriginalTransactionID string      `json:"original_transaction_id"`
	PurchaseDate          Millistamp  `json:"purchase_date_ms,string"`
	OriginalPurchaseDate  Millistamp  `json:"original_purchase_date_ms,string"`
	CancellationDate      *Millistamp `json:"cancellation_date_ms,string,omitempty"`
	IsTrialPeriod         bool        `json:"is_trial_period,string"`
	ExpiresDate           Millistamp  `json:"expires_date_ms,string"`

	InApp []ReceiptInfoBody `json:"in_app,omitempty"`
}

type Unified added in v1.2.0

type Unified struct {
	Environment     UnifiedEnv           `json:"environment"`
	LatestReceipts  []latestReceiptInfo  `json:"latest_receipt_info"`
	PendingRenewals []pendingRenewalInfo `json:"pending_renewal_info"`
	Status          int                  `json:"status"`
}

func ParseUnified added in v1.2.0

func ParseUnified(data []byte) (Unified, error)

func (Unified) GracePeriodExpiresDate added in v1.2.0

func (u Unified) GracePeriodExpiresDate() (time.Time, bool)

func (Unified) LatestReceiptInfo added in v1.2.0

func (u Unified) LatestReceiptInfo() (latestReceiptInfo, bool)

func (Unified) PendingRenewalInfo added in v1.2.0

func (u Unified) PendingRenewalInfo() (pendingRenewalInfo, bool)

type UnifiedEnv added in v1.2.0

type UnifiedEnv string
const (
	Sandbox    UnifiedEnv = "Sandbox"
	Production UnifiedEnv = "Production"
)

type VerifyReceiptRequest

type VerifyReceiptRequest struct {
	ReceiptData            string `json:"receipt-data"`
	Password               string `json:"password"`
	ExcludeOldTransactions bool   `json:"exclude-old-transactions,string"`
}

Jump to

Keyboard shortcuts

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