Documentation ¶
Overview ¶
Package iaplocal supports Apple Local In-App Purchase (IAP) receipt processing.
It loads the receipt from binary, parses the receipt's attributes, and verifies the receipt signature and hash.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidCertificate returns when parse a receipt // with invalid certificate from given root certificate. ErrInvalidCertificate = errors.New("iaplocal: invalid certificate in receipt") // ErrInvalidSignature returns when parse a receipt // which improperly signed. ErrInvalidSignature = errors.New("iaplocal: invalid signature of receipt") )
Functions ¶
This section is empty.
Types ¶
type Receipt ¶
type Receipt struct { Quantity int `json:"quantity"` ProductID string `json:"product_id"` TransactionID string `json:"transaction_date"` PurchaseDate time.Time `json:"purchase_date"` OriginalTransactionID string `json:"original_transaction_id"` OriginalPurchaseDate time.Time `json:"original_purchase_date"` ExpiresDate time.Time `json:"expires_date"` WebOrderLineItemID int `json:"web_order_line_item_id"` CancellationDate time.Time `json:"cancellation_date"` IsInIntroPrice bool `json:"is_in_intro_offer_period"` }
Receipt is the receipt for an in-app purchase.
type Receipts ¶
type Receipts struct { BundleID string `json:"bundle_id"` ApplicationVersion string `json:"application_version"` OpaqueValue []byte `json:"opaque_value"` SHA1Hash []byte `json:"sha1hash"` CreationDate time.Time `json:"creation_date"` InApp []Receipt `json:"in_app"` OriginalApplicationVersion string `json:"original_application_version"` ExpirationDate time.Time `json:"expiration_date"` // contains filtered or unexported fields }
Receipts is the app receipt.
func Parse ¶
func Parse(root *x509.Certificate, data []byte) (Receipts, error)
Parse parses a receipt binary which certificates with root certificate. Need decode to DER binary if recevied a base64 file.
func (*Receipts) Verify ¶
Verify verifys the receipts with given guid. TestReceiptValidate shows how to get GUID from string. Check https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html#//apple_ref/doc/uid/TP40010573-CH1-SW5