apple

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnreadableJSON       = 21000
	MalformedData        = 21002
	AuthenticationError  = 21003
	UnmatchedSecret      = 21004
	ServerUnavailable    = 21005
	SubscriptionExpired  = 21006
	SandboxReceiptOnProd = 21007
	ProdReceiptOnSandbox = 21008
)

Error codes as they returned by the App Store

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

Error Error

func (*Error) Code

func (e *Error) Code() float64

Code Simple method to get the original error code from the error object

type ErrorWithCode

type ErrorWithCode interface {
	Code() float64
}

ErrorWithCode Simple interface to get the original error code from the error object

type PurchaseReceipt

type PurchaseReceipt struct {
	Quantity                  string `json:"quantity"`
	ProductId                 string `json:"product_id"`
	TransactionId             string `json:"transaction_id"`
	OriginalTransactionId     string `json:"original_transaction_id"`
	PurchaseDate              string `json:"purchase_date"`
	OriginalPurchaseDate      string `json:"original_purchase_date"`
	ExpiresDate               string `json:"expires_date"`
	AppItemId                 string `json:"app_item_id"`
	VersionExternalIdentifier string `json:"version_external_identifier"`
	WebOrderLineItemId        string `json:"web_order_line_item_id"`
}

PurchaseReceipt PurchaseReceipt

type Receipt

type Receipt struct {
	BundleId                   string            `json:"bundle_id"`
	ApplicationVersion         string            `json:"application_version"`
	InApp                      []PurchaseReceipt `json:"in_app"`
	OriginalApplicationVersion string            `json:"original_application_version"`
}

Receipt is information returned by Apple Documentation: https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW10

func VerifyReceipt

func VerifyReceipt(receiptData string, useSandbox bool) (*Receipt, error)

VerifyReceipt Given receiptData (base64 encoded) it tries to connect to either the sandbox (useSandbox true) or apples ordinary service (useSandbox false) to validate the receipt. Returns either a receipt struct or an error.

Jump to

Keyboard shortcuts

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