appstore

package
v1.33.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 13 Imported by: 27

Documentation

Index

Constants

View Source
const (
	SubTypeV2Accepted          = "ACCEPTED"
	SubTypeV2AutoRenewDisabled = "AUTO_RENEW_DISABLED"
	SubTypeV2AutoRenewEnabled  = "AUTO_RENEW_ENABLED"
	SubTypeV2BillingRecovery   = "BILLING_RECOVERY"
	SubTypeV2BillingRetry      = "BILLING_RETRY"
	SubTypeV2Downgrade         = "DOWNGRADE"
	SubTypeV2Failure           = "FAILURE"
	SubTypeV2GracePeriod       = "GRACE_PERIOD"
	SubTypeV2InitialBuy        = "INITIAL_BUY"
	SubTypeV2Pending           = "PENDING"
	SubTypeV2PriceIncrease     = "PRICE_INCREASE"
	SubTypeV2ProductNotForSale = "PRODUCT_NOT_FOR_SALE"
	SubTypeV2Resubscribe       = "RESUBSCRIBE"
	SubTypeV2Summary           = "SUMMARY"
	SubTypeV2Upgrade           = "UPGRADE"
	SubTypeV2Unreported        = "UNREPORTED"
	SubTypeV2Voluntary         = "VOLUNTARY"
)

list of subtypes https://developer.apple.com/documentation/appstoreservernotifications/subtype

View Source
const (
	AutoRenewableSubscriptionStatusActive = iota + 1
	AutoRenewableSubscriptionStatusExpired
	AutoRenewableSubscriptionStatusBillingRetryPeriod
	AutoRenewableSubscriptionStatusBillingGracePeriod
	AutoRenewableSubscriptionStatusRevoked
)
View Source
const (
	TransactionReasonPurchase = "PURCHASE"
	TransactionReasonRenewal  = "RENEWAL"
)
View Source
const (
	// SandboxURL is the endpoint for sandbox environment.
	SandboxURL string = "https://sandbox.itunes.apple.com/verifyReceipt"
	// ProductionURL is the endpoint for production environment.
	ProductionURL string = "https://buy.itunes.apple.com/verifyReceipt"
	// ContentType is the request content-type for apple store.
	ContentType string = "application/json; charset=utf-8"
)

Variables

View Source
var (
	ErrAppStoreServer = errors.New("AppStore server error")

	ErrInvalidJSON            = errors.New("The App Store could not read the JSON object you provided.")
	ErrInvalidReceiptData     = errors.New("The data in the receipt-data property was malformed or missing.")
	ErrReceiptUnauthenticated = errors.New("The receipt could not be authenticated.")
	ErrInvalidSharedSecret    = errors.New("The shared secret you provided does not match the shared secret on file for your account.")
	ErrServerUnavailable      = errors.New("The receipt server is not currently available.")
	ErrReceiptIsForTest       = errors.New("This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.")
	ErrReceiptIsForProduction = errors.New("This receipt is from the production environment, but it was sent to the test environment for verification. Send it to the production environment instead.")
	ErrReceiptUnauthorized    = errors.New("This receipt could not be authorized. Treat this the same as if a purchase was never made.")

	ErrInternalDataAccessError = errors.New("Internal data access error.")
	ErrUnknown                 = errors.New("An unknown error occurred")
)

list of errore

Functions

func HandleError

func HandleError(status int) error

HandleError returns error message by status code

Types

type AutoRenewStatus added in v1.3.18

type AutoRenewStatus int
const (
	Off AutoRenewStatus = iota
	On
)

type AutoRenewStatusChangeDate added in v1.3.9

type AutoRenewStatusChangeDate struct {
	AutoRenewStatusChangeDate    string `json:"auto_renew_status_change_date"`
	AutoRenewStatusChangeDateMS  string `json:"auto_renew_status_change_date_ms"`
	AutoRenewStatusChangeDatePST string `json:"auto_renew_status_change_date_pst"`
}

AutoRenewStatusChangeDate type indicates the auto renew status change date

type AutoRenewableSubscriptionStatus added in v1.13.0

type AutoRenewableSubscriptionStatus int32

AutoRenewableSubscriptionStatus status value is current as of the signedDate in the decoded payload, SubscriptionNotificationV2DecodedPayload. https://developer.apple.com/documentation/appstoreservernotifications/status

type CancellationDate

type CancellationDate struct {
	CancellationDate    string `json:"cancellation_date,omitempty"`
	CancellationDateMS  string `json:"cancellation_date_ms,omitempty"`
	CancellationDatePST string `json:"cancellation_date_pst,omitempty"`
}

The CancellationDate type indicates the time and date of the cancellation by Apple customer support

type Cert added in v1.8.0

type Cert struct{}

func (*Cert) ExtractPublicKeyFromToken added in v1.8.0

func (c *Cert) ExtractPublicKeyFromToken(token string) (*ecdsa.PublicKey, error)

type Client

type Client struct {
	ProductionURL string
	SandboxURL    string
	// contains filtered or unexported fields
}

Client implements IAPClient

func New

func New() *Client

New creates a client object

func NewWithClient

func NewWithClient(client *http.Client) *Client

NewWithClient creates a client with a custom http client.

func (*Client) ParseNotificationV2 added in v1.8.0

func (c *Client) ParseNotificationV2(tokenStr string, result *jwt.Token) error

ParseNotificationV2 parse notification from App Store Server

func (*Client) ParseNotificationV2WithClaim added in v1.23.0

func (c *Client) ParseNotificationV2WithClaim(tokenStr string, result jwt.Claims) error

ParseNotificationV2WithClaim parse notification from App Store Server

func (*Client) Verify

func (c *Client) Verify(ctx context.Context, reqBody IAPRequest, result interface{}) error

Verify sends receipts and gets validation result

func (*Client) VerifyWithStatus added in v1.6.0

func (c *Client) VerifyWithStatus(ctx context.Context, reqBody IAPRequest, result interface{}) (int, error)

VerifyWithStatus sends receipts and gets validation result with status code If the Apple verification receipt server is unhealthy and responds with an HTTP status code in the 5xx range, that status code will be returned.

type Environment

type Environment string

Environment is alias

const (
	Sandbox    Environment = "Sandbox"
	Production Environment = "Production"
)

list of Environment

type ExpirationIntent added in v1.3.18

type ExpirationIntent int
const (
	CustomerCancelled ExpirationIntent = iota + 1
	BillingError
	NoPriceChangeConsent
	ProductUnavailable
)

type ExpiresDate

type ExpiresDate struct {
	ExpiresDate             string `json:"expires_date,omitempty"`
	ExpiresDateMS           string `json:"expires_date_ms,omitempty"`
	ExpiresDatePST          string `json:"expires_date_pst,omitempty"`
	ExpiresDateFormatted    string `json:"expires_date_formatted,omitempty"`
	ExpiresDateFormattedPST string `json:"expires_date_formatted_pst,omitempty"`
}

The ExpiresDate type indicates the expiration date for the subscription

type GracePeriodDate added in v1.1.0

type GracePeriodDate struct {
	GracePeriodDate    string `json:"grace_period_expires_date,omitempty"`
	GracePeriodDateMS  string `json:"grace_period_expires_date_ms,omitempty"`
	GracePeriodDatePST string `json:"grace_period_expires_date_pst,omitempty"`
}

The GracePeriodDate type indicates the grace period date for the subscription

type IAPClient

type IAPClient interface {
	Verify(ctx context.Context, reqBody IAPRequest, resp interface{}) error
	VerifyWithStatus(ctx context.Context, reqBody IAPRequest, resp interface{}) (int, error)
	ParseNotificationV2(tokenStr string, result *jwt.Token) error
	ParseNotificationV2WithClaim(tokenStr string, result jwt.Claims) error
}

IAPClient is an interface to call validation API in App Store

type IAPRequest

type IAPRequest struct {
	ReceiptData string `json:"receipt-data"`
	// Only used for receipts that contain auto-renewable subscriptions.
	Password string `json:"password,omitempty"`
	// Only used for iOS7 style app receipts that contain auto-renewable or non-renewing subscriptions.
	// If value is true, response includes only the latest renewal transaction for any subscriptions.
	ExcludeOldTransactions bool `json:"exclude-old-transactions"`
}

IAPRequest is struct https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html The IAPRequest type has the request parameter

type IAPResponse

type IAPResponse struct {
	Status             int                  `json:"status"`
	Environment        Environment          `json:"environment"`
	Receipt            Receipt              `json:"receipt"`
	LatestReceiptInfo  []InApp              `json:"latest_receipt_info,omitempty"`
	LatestReceipt      string               `json:"latest_receipt,omitempty"`
	PendingRenewalInfo []PendingRenewalInfo `json:"pending_renewal_info,omitempty"`
	IsRetryable        bool                 `json:"is_retryable,omitempty"`
}

The IAPResponse type has the response properties We defined each field by the current IAP response, but some fields are not mentioned in the following Apple's document; https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html If you get other types or fields from the IAP response, you should use the struct you defined.

type IAPResponseForIOS6

type IAPResponseForIOS6 struct {
	AutoRenewProductID       string         `json:"auto_renew_product_id"`
	AutoRenewStatus          int            `json:"auto_renew_status"`
	CancellationReason       string         `json:"cancellation_reason,omitempty"`
	ExpirationIntent         string         `json:"expiration_intent,omitempty"`
	IsInBillingRetryPeriod   string         `json:"is_in_billing_retry_period,omitempty"`
	Receipt                  ReceiptForIOS6 `json:"receipt"`
	LatestExpiredReceiptInfo ReceiptForIOS6 `json:"latest_expired_receipt_info"`
	LatestReceipt            string         `json:"latest_receipt"`
	LatestReceiptInfo        ReceiptForIOS6 `json:"latest_receipt_info"`
	Status                   int            `json:"status"`
}

IAPResponseForIOS6 is iOS 6 style receipt schema.

type IAPType added in v1.3.18

type IAPType string
const (
	AutoRenewable IAPType = "Auto-Renewable Subscription"
	NonConsumable IAPType = "Non-Consumable"
	Consumable    IAPType = "Consumable"
	NonRenewable  IAPType = "Non-Renewing Subscription"
)

type InApp

type InApp struct {
	Quantity                    string        `json:"quantity"`
	ProductID                   string        `json:"product_id"`
	TransactionID               string        `json:"transaction_id"`
	OriginalTransactionID       NumericString `json:"original_transaction_id,omitempty"`
	WebOrderLineItemID          string        `json:"web_order_line_item_id,omitempty"`
	PromotionalOfferID          string        `json:"promotional_offer_id"`
	SubscriptionGroupIdentifier string        `json:"subscription_group_identifier"`
	OfferCodeRefName            string        `json:"offer_code_ref_name,omitempty"`
	AppAccountToken             string        `json:"app_account_token,omitempty"`

	IsTrialPeriod        string `json:"is_trial_period"`
	IsInIntroOfferPeriod string `json:"is_in_intro_offer_period,omitempty"`
	IsUpgraded           string `json:"is_upgraded,omitempty"`

	ExpiresDate

	PurchaseDate
	OriginalPurchaseDate

	CancellationDate
	CancellationReason string `json:"cancellation_reason,omitempty"`

	InAppOwnershipType string `json:"in_app_ownership_type,omitempty"`
}

The InApp type has the receipt attributes

type JWSRenewalInfo added in v1.3.18

type JWSRenewalInfo string

JWSRenewalInfo contains the Base64 encoded signed JWS payload of the renewal information https://developer.apple.com/documentation/appstoreservernotifications/jwsrenewalinfo

type JWSRenewalInfoDecodedPayload added in v1.3.18

type JWSRenewalInfoDecodedPayload struct {
	AutoRenewProductId          string              `json:"autoRenewProductId"`
	AutoRenewStatus             AutoRenewStatus     `json:"autoRenewStatus"`
	Environment                 Environment         `json:"environment"`
	ExpirationIntent            ExpirationIntent    `json:"expirationIntent"`
	GracePeriodExpiresDate      int64               `json:"gracePeriodExpiresDate"`
	IsInBillingRetryPeriod      bool                `json:"isInBillingRetryPeriod"`
	OfferIdentifier             string              `json:"offerIdentifier"`
	OfferType                   OfferType           `json:"offerType"`
	OriginalTransactionId       string              `json:"originalTransactionId"`
	PriceIncreaseStatus         PriceIncreaseStatus `json:"priceIncreaseStatus"`
	ProductId                   string              `json:"productId"`
	RecentSubscriptionStartDate int64               `json:"recentSubscriptionStartDate"`
	RenewalDate                 int64               `json:"renewalDate"`
	SignedDate                  int64               `json:"signedDate"`
	jwt.RegisteredClaims
}

JWSRenewalInfoDecodedPayload contains the decoded renewal information https://developer.apple.com/documentation/appstoreservernotifications/jwsrenewalinfodecodedpayload

type JWSTransaction added in v1.3.18

type JWSTransaction string

JWSTransaction contains the Base64 encoded signed JWS payload of the transaction https://developer.apple.com/documentation/appstoreservernotifications/jwstransaction

type JWSTransactionDecodedPayload added in v1.3.18

type JWSTransactionDecodedPayload struct {
	AppAccountToken             string            `json:"appAccountToken"`
	BundleId                    string            `json:"bundleId"`
	Currency                    string            `json:"currency,omitempty"`
	Environment                 Environment       `json:"environment"`
	ExpiresDate                 int64             `json:"expiresDate"`
	InAppOwnershipType          string            `json:"inAppOwnershipType"`
	IsUpgraded                  bool              `json:"isUpgraded"`
	OfferDiscountType           OfferDiscountType `json:"offerDiscountType"`
	OfferIdentifier             string            `json:"offerIdentifier"`
	OfferType                   OfferType         `json:"offerType"`
	OriginalPurchaseDate        int64             `json:"originalPurchaseDate"`
	OriginalTransactionId       string            `json:"originalTransactionId"`
	Price                       int64             `json:"price,omitempty"`
	ProductId                   string            `json:"productId"`
	PurchaseDate                int64             `json:"purchaseDate"`
	Quantity                    int64             `json:"quantity"`
	RevocationDate              int64             `json:"revocationDate"`
	RevocationReason            RevocationReason  `json:"revocationReason"`
	SignedDate                  int64             `json:"signedDate"`
	Storefront                  string            `json:"storefront"`
	StorefrontId                string            `json:"storefrontId"`
	SubscriptionGroupIdentifier string            `json:"subscriptionGroupIdentifier"`
	TransactionId               string            `json:"transactionId"`
	TransactionReason           TransactionReason `json:"transactionReason"`
	IAPtype                     IAPType           `json:"type"`
	WebOrderLineItemId          string            `json:"webOrderLineItemId"`
	jwt.RegisteredClaims
}

JWSTransactionDecodedPayload contains the decoded transaction information https://developer.apple.com/documentation/appstoreservernotifications/jwstransactiondecodedpayload

type NotificationEnvironment

type NotificationEnvironment string

NotificationEnvironment is type

const (
	NotificationSandbox    NotificationEnvironment = "Sandbox"
	NotificationProduction NotificationEnvironment = "PROD"
)

list of NotificationEnvironment

type NotificationExpiresDate

type NotificationExpiresDate struct {
	ExpiresDateMS  string `json:"expires_date"`
	ExpiresDateUTC string `json:"expires_date_formatted"`
	ExpiresDatePST string `json:"expires_date_formatted_pst"`
}

NotificationExpiresDate is struct

type NotificationReceipt

type NotificationReceipt struct {
	UniqueIdentifier          string        `json:"unique_identifier"`
	AppItemID                 string        `json:"app_item_id"`
	Quantity                  string        `json:"quantity"`
	VersionExternalIdentifier string        `json:"version_external_identifier"`
	UniqueVendorIdentifier    string        `json:"unique_vendor_identifier"`
	WebOrderLineItemID        string        `json:"web_order_line_item_id"`
	ItemID                    string        `json:"item_id"`
	ProductID                 string        `json:"product_id"`
	BID                       string        `json:"bid"`
	BVRS                      string        `json:"bvrs"`
	TransactionID             string        `json:"transaction_id"`
	OriginalTransactionID     NumericString `json:"original_transaction_id,omitempty"`
	IsTrialPeriod             string        `json:"is_trial_period"`
	IsInIntroOfferPeriod      string        `json:"is_in_intro_offer_period"`

	PurchaseDate
	OriginalPurchaseDate
	NotificationExpiresDate
	CancellationDate
}

NotificationReceipt is struct

type NotificationType

type NotificationType string

NotificationType is type https://developer.apple.com/documentation/appstoreservernotifications/notification_type https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html#//apple_ref/doc/uid/TP40008267-CH7-SW16 Deprecated

const (
	// Initial purchase of the subscription.
	NotificationTypeInitialBuy NotificationType = "INITIAL_BUY"
	// Subscription was canceled by Apple customer support.
	NotificationTypeCancel NotificationType = "CANCEL"
	// Automatic renewal was successful for an expired subscription.
	// Deprecated: DID_RECOVER should be used instead of RENEWAL
	NotificationTypeRenewal NotificationType = "RENEWAL"
	// Expired subscription recovered through a billing retry.
	NotificationTypeDidRecover NotificationType = "DID_RECOVER"
	// Customer renewed a subscription interactively after it lapsed.
	NotificationTypeInteractiveRenewal NotificationType = "INTERACTIVE_RENEWAL"
	// Customer changed the plan that takes affect at the next subscription renewal. Current active plan is not affected.
	NotificationTypeDidChangeRenewalPreference NotificationType = "DID_CHANGE_RENEWAL_PREF"
	// Customer changed the subscription renewal status. Current active plan is not affected.
	NotificationTypeDidChangeRenewalStatus NotificationType = "DID_CHANGE_RENEWAL_STATUS"
	// Subscription failed to renew due to a billing issue.
	NotificationTypeDidFailToRenew NotificationType = "DID_FAIL_TO_RENEW"
	// AppleCare successfully refunded the transaction for a consumable, non-consumable, or a non-renewing subscription.
	NotificationTypeRefund NotificationType = "REFUND"
	// App Store has started asking the customer to consent to your app’s subscription price increase.
	NotificationTypePriceIncreaseConsent NotificationType = "PRICE_INCREASE_CONSENT"
	// Customer’s subscription has successfully auto-renewed for a new transaction period.
	NotificationTypeDidRenew NotificationType = "DID_RENEW"
	// Customer's in-app purchase through Family Sharing is no longer available through sharing.
	NotificationTypeDidRevoke NotificationType = "REVOKE"
	// Indicates that the customer initiated a refund request for a consumable in-app purchase, and the App Store is requesting that you provide consumption data.
	NotificationTypeConsumptionRequest NotificationType = "CONSUMPTION_REQUEST"
)

list of NotificationType

type NotificationTypeV2 added in v1.3.12

type NotificationTypeV2 string

NotificationTypeV2 is type

const (
	NotificationTypeV2ConsumptionRequest     NotificationTypeV2 = "CONSUMPTION_REQUEST"
	NotificationTypeV2DidChangeRenewalPref   NotificationTypeV2 = "DID_CHANGE_RENEWAL_PREF"
	NotificationTypeV2DidChangeRenewalStatus NotificationTypeV2 = "DID_CHANGE_RENEWAL_STATUS"
	NotificationTypeV2DidFailToRenew         NotificationTypeV2 = "DID_FAIL_TO_RENEW"
	NotificationTypeV2DidRenew               NotificationTypeV2 = "DID_RENEW"
	NotificationTypeV2Expired                NotificationTypeV2 = "EXPIRED"
	NotificationTypeV2ExternalPurchaseToken  NotificationTypeV2 = "EXTERNAL_PURCHASE_TOKEN"
	NotificationTypeV2GracePeriodExpired     NotificationTypeV2 = "GRACE_PERIOD_EXPIRED"
	NotificationTypeV2OfferRedeemed          NotificationTypeV2 = "OFFER_REDEEMED"
	NotificationTypeV2OneTimeCharge          NotificationTypeV2 = "ONE_TIME_CHARGE"
	NotificationTypeV2PriceIncrease          NotificationTypeV2 = "PRICE_INCREASE"
	NotificationTypeV2Refund                 NotificationTypeV2 = "REFUND"
	NotificationTypeV2RefundDeclined         NotificationTypeV2 = "REFUND_DECLINED"
	NotificationTypeV2RefundReversed         NotificationTypeV2 = "REFUND_REVERSED"
	NotificationTypeV2RenewalExtended        NotificationTypeV2 = "RENEWAL_EXTENDED"
	NotificationTypeV2RenewalExtension       NotificationTypeV2 = "RENEWAL_EXTENSION"
	NotificationTypeV2Revoke                 NotificationTypeV2 = "REVOKE"
	NotificationTypeV2Subscribed             NotificationTypeV2 = "SUBSCRIBED"
	NotificationTypeV2Test                   NotificationTypeV2 = "TEST"
)

list of notificationType https://developer.apple.com/documentation/appstoreservernotifications/notificationtype

type NotificationUnifiedReceipt added in v1.2.0

type NotificationUnifiedReceipt struct {
	Status             int                  `json:"status"`
	Environment        Environment          `json:"environment"`
	LatestReceipt      string               `json:"latest_receipt"`
	LatestReceiptInfo  []InApp              `json:"latest_receipt_info"`
	PendingRenewalInfo []PendingRenewalInfo `json:"pending_renewal_info,omitempty"`
}

NotificationUnifiedReceipt is struct

type NumericString added in v1.26.1

type NumericString string

func (*NumericString) UnmarshalJSON added in v1.26.1

func (n *NumericString) UnmarshalJSON(b []byte) error

type OfferDiscountType added in v1.27.0

type OfferDiscountType string
const (
	OfferDiscountTypeFreeTrial  OfferDiscountType = "FREE_TRIAL"
	OfferDiscountTypePayAsYouGo OfferDiscountType = "PAY_AS_YOU_GO"
	OfferDiscountTypePayUpFront OfferDiscountType = "PAY_UP_FRONT"
)

type OfferType added in v1.3.18

type OfferType int
const (
	IntroductoryOffer OfferType = iota + 1
	PromotionalOffer
	SubscriptionOfferCode
)

type OriginalPurchaseDate

type OriginalPurchaseDate struct {
	OriginalPurchaseDate    string `json:"original_purchase_date"`
	OriginalPurchaseDateMS  string `json:"original_purchase_date_ms"`
	OriginalPurchaseDatePST string `json:"original_purchase_date_pst"`
}

The OriginalPurchaseDate type indicates the beginning of the subscription period

type PendingRenewalInfo

type PendingRenewalInfo struct {
	SubscriptionExpirationIntent   string `json:"expiration_intent"`
	SubscriptionAutoRenewProductID string `json:"auto_renew_product_id"`
	SubscriptionRetryFlag          string `json:"is_in_billing_retry_period"`
	SubscriptionAutoRenewStatus    string `json:"auto_renew_status"`
	SubscriptionPriceConsentStatus string `json:"price_consent_status"`
	ProductID                      string `json:"product_id"`
	OriginalTransactionID          string `json:"original_transaction_id"`
	OfferCodeRefName               string `json:"offer_code_ref_name,omitempty"`
	PromotionalOfferID             string `json:"promotional_offer_id,omitempty"`
	PriceIncreaseStatus            string `json:"price_increase_status,omitempty"`

	GracePeriodDate
}

PendingRenewalInfo is struct A pending renewal may refer to a renewal that is scheduled in the future or a renewal that failed in the past for some reason. https://developer.apple.com/documentation/appstoreservernotifications/unified_receipt/pending_renewal_info

type PreorderDate added in v1.3.11

type PreorderDate struct {
	PreorderDate    string `json:"preorder_date"`
	PreorderDateMS  string `json:"preorder_date_ms"`
	PreorderDatePST string `json:"preorder_date_pst"`
}

The PreorderDate type indicates the date and time that the pre-order

type PriceIncreaseStatus added in v1.3.18

type PriceIncreaseStatus int
const (
	CustomerNotYetConsented PriceIncreaseStatus = iota
	CustomerConsented
)

type PurchaseDate

type PurchaseDate struct {
	PurchaseDate    string `json:"purchase_date"`
	PurchaseDateMS  string `json:"purchase_date_ms"`
	PurchaseDatePST string `json:"purchase_date_pst"`
}

The PurchaseDate type indicates the date and time that the item was purchased

type Receipt

type Receipt struct {
	ReceiptType                string        `json:"receipt_type"`
	AdamID                     int64         `json:"adam_id"`
	AppItemID                  NumericString `json:"app_item_id"`
	BundleID                   string        `json:"bundle_id"`
	ApplicationVersion         string        `json:"application_version"`
	DownloadID                 int64         `json:"download_id"`
	VersionExternalIdentifier  NumericString `json:"version_external_identifier"`
	OriginalApplicationVersion string        `json:"original_application_version"`
	InApp                      []InApp       `json:"in_app"`
	ReceiptCreationDate
	RequestDate
	OriginalPurchaseDate
	PreorderDate
	ExpiresDate
}

The Receipt type has whole data of receipt

type ReceiptCreationDate

type ReceiptCreationDate struct {
	CreationDate    string `json:"receipt_creation_date"`
	CreationDateMS  string `json:"receipt_creation_date_ms"`
	CreationDatePST string `json:"receipt_creation_date_pst"`
}

The ReceiptCreationDate type indicates the date when the app receipt was created.

type ReceiptForIOS6

type ReceiptForIOS6 struct {
	AppItemID NumericString `json:"app_item_id"`
	BID       string        `json:"bid"`
	BVRS      string        `json:"bvrs"`
	CancellationDate
	ExpiresDate
	IsTrialPeriod        string `json:"is_trial_period"`
	IsInIntroOfferPeriod string `json:"is_in_intro_offer_period"`
	ItemID               string `json:"item_id"`
	ProductID            string `json:"product_id"`
	PurchaseDate
	OriginalTransactionID NumericString `json:"original_transaction_id,omitempty"`
	OriginalPurchaseDate
	Quantity                  string        `json:"quantity"`
	TransactionID             string        `json:"transaction_id"`
	UniqueIdentifier          string        `json:"unique_identifier"`
	UniqueVendorIdentifier    string        `json:"unique_vendor_identifier"`
	VersionExternalIdentifier NumericString `json:"version_external_identifier,omitempty"`
	WebOrderLineItemID        string        `json:"web_order_line_item_id"`
}

ReceiptForIOS6 is struct

type RequestDate

type RequestDate struct {
	RequestDate    string `json:"request_date"`
	RequestDateMS  string `json:"request_date_ms"`
	RequestDatePST string `json:"request_date_pst"`
}

The RequestDate type indicates the date and time that the request was sent

type RevocationReason added in v1.3.18

type RevocationReason int
const (
	OtherReason RevocationReason = iota
	AppIssue
)

type StatusResponse

type StatusResponse struct {
	Status int `json:"status"`
}

StatusResponse is struct The HttpStatusResponse struct contains the status code returned by the store Used as a workaround to detect when to hit the production appstore or sandbox appstore regardless of receipt type

type SubscriptionNotification

type SubscriptionNotification struct {
	Environment      NotificationEnvironment `json:"environment"`
	NotificationType NotificationType        `json:"notification_type"`

	// Not show in raw notify body
	Password              string        `json:"password"`
	OriginalTransactionID NumericString `json:"original_transaction_id,omitempty"`
	AutoRenewAdamID       string        `json:"auto_renew_adam_id"`

	// The primary key for identifying a subscription purchase.
	// Posted only if the notification_type is CANCEL.
	WebOrderLineItemID string `json:"web_order_line_item_id"`

	// This is the same as the Subscription Expiration Intent in the receipt.
	// Posted only if notification_type is RENEWAL or INTERACTIVE_RENEWAL.
	ExpirationIntent NumericString `json:"expiration_intent"`

	// Auto renew info
	AutoRenewStatus    string `json:"auto_renew_status"` // false or true
	AutoRenewProductID string `json:"auto_renew_product_id"`
	AutoRenewStatusChangeDate

	// Posted if the notification_type is RENEWAL or INTERACTIVE_RENEWAL, and only if the renewal is successful.
	// Posted also if the notification_type is INITIAL_BUY.
	// Not posted for notification_type CANCEL.
	// Deprecated: use UnifiedReceipt.LatestReceipt instead. See details: https://developer.apple.com/documentation/appstoreservernotifications/ .
	LatestReceipt string `json:"latest_receipt"`
	// Deprecated: use UnifiedReceipt.LatestReceiptInfo instead. See details: https://developer.apple.com/documentation/appstoreservernotifications/ .
	LatestReceiptInfo NotificationReceipt `json:"latest_receipt_info"`

	// In the new notifications above properties latest_receipt, latest_receipt_info are moved under this one
	UnifiedReceipt NotificationUnifiedReceipt `json:"unified_receipt"`

	// Posted only if the notification_type is RENEWAL or CANCEL or if renewal failed and subscription expired.
	// Deprecated: see details: https://developer.apple.com/documentation/appstoreservernotifications/ .
	LatestExpiredReceipt string `json:"latest_expired_receipt"`
	// Deprecated: see details: https://developer.apple.com/documentation/appstoreservernotifications/ .
	LatestExpiredReceiptInfo NotificationReceipt `json:"latest_expired_receipt_info"`

	// BID is the app bundle ID
	BID string `json:"bid,omitempty"`
	// BVRS is the app bundle version
	BVRS string `json:"bvrs,omitempty"`

	// Posted only if the notification_type is CANCEL.
	CancellationDate
}

SubscriptionNotification is struct for https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv1 Deprecated

type SubscriptionNotificationV2 added in v1.3.12

type SubscriptionNotificationV2 struct {
	SignedPayload SubscriptionNotificationV2SignedPayload `json:"signedPayload"`
}

SubscriptionNotificationV2 is struct for https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv2

type SubscriptionNotificationV2Data added in v1.3.12

type SubscriptionNotificationV2Data struct {
	AppAppleID            int                             `json:"appAppleId"`
	BundleID              string                          `json:"bundleId"`
	BundleVersion         string                          `json:"bundleVersion"`
	Environment           string                          `json:"environment"`
	SignedRenewalInfo     JWSRenewalInfo                  `json:"signedRenewalInfo"`
	SignedTransactionInfo JWSTransaction                  `json:"signedTransactionInfo"`
	Status                AutoRenewableSubscriptionStatus `json:"status"`
}

SubscriptionNotificationV2Data is struct https://developer.apple.com/documentation/appstoreservernotifications/data

type SubscriptionNotificationV2DecodedPayload added in v1.3.12

type SubscriptionNotificationV2DecodedPayload struct {
	NotificationType    NotificationTypeV2                `json:"notificationType"`
	Subtype             SubtypeV2                         `json:"subtype"`
	NotificationUUID    string                            `json:"notificationUUID"`
	NotificationVersion string                            `json:"version"`
	SignedDate          int64                             `json:"signedDate"`
	Data                SubscriptionNotificationV2Data    `json:"data,omitempty"`
	Summary             SubscriptionNotificationV2Summary `json:"summary,omitempty"`
	jwt.RegisteredClaims
}

SubscriptionNotificationV2DecodedPayload is struct https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv2decodedpayload

type SubscriptionNotificationV2JWSDecodedHeader added in v1.3.12

type SubscriptionNotificationV2JWSDecodedHeader struct {
	Alg string   `json:"alg"`
	Kid string   `json:"kid"`
	X5c []string `json:"x5c"`
}

SubscriptionNotificationV2JWSDecodedHeader is struct

type SubscriptionNotificationV2SignedPayload added in v1.3.12

type SubscriptionNotificationV2SignedPayload struct {
	SignedPayload string `json:"signedPayload"`
}

SubscriptionNotificationV2SignedPayload is struct https://developer.apple.com/documentation/appstoreservernotifications/signedpayload

type SubscriptionNotificationV2Summary added in v1.8.0

type SubscriptionNotificationV2Summary struct {
	RequestIdentifier      string `json:"requestIdentifier"`
	Environment            string `json:"environment"`
	AppAppleId             int64  `json:"appAppleId"`
	BundleID               string `json:"bundleId"`
	ProductID              string `json:"productId"`
	StorefrontCountryCodes string `json:"storefrontCountryCodes"`
	FailedCount            int64  `json:"failedCount"`
	SucceededCount         int64  `json:"succeededCount"`
}

SubscriptionNotificationV2Summary is struct https://developer.apple.com/documentation/appstoreservernotifications/summary

type SubtypeV2 added in v1.3.12

type SubtypeV2 string

SubtypeV2 is type

type TransactionReason added in v1.13.0

type TransactionReason string

TransactionReason indicates the cause of a purchase transaction, which indicates whether it’s a customer’s purchase or a renewal for an auto-renewable subscription that the system initiates. https://developer.apple.com/documentation/appstoreservernotifications/transactionreason

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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