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 ProductID string TransactionID string PurchaseDate time.Time OriginalTransactionID string OriginalPurchaseDate time.Time ExpiresDate time.Time WebOrderLineItemID int CancellationDate time.Time }
Receipt is the receipt for an in-app purchase.
type Receipts ¶
type Receipts struct { BundleID string ApplicationVersion string OpaqueValue []byte SHA1Hash []byte ReceiptCreationDate time.Time InApp []Receipt OriginalApplicationVersion string ExpirationDate time.Time // 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