Documentation
¶
Index ¶
- type ApiError
- type AutoRenewStatus
- type AutoRenewableSubscriptionStatus
- type Config
- type Environment
- type ExpirationIntent
- type GetAllSubscriptionStatusesResp
- type GetNotificationHistoryReq
- type GetNotificationHistoryResp
- type GetRefundHistoryResp
- type GetTestNotificationStatusResp
- type GetTransactionHistoryReq
- type GetTransactionHistoryReqQuery
- type GetTransactionHistoryResp
- type InAppOwnershipType
- type JWSNotification
- type JWSRenewalInfo
- type JWSTransaction
- type JWSTransactions
- type NotificationHistoryItem
- type NotificationSendAttemptItem
- type NotificationSendAttemptResult
- type NotificationV2
- type NotificationV2Data
- type NotificationV2Subtype
- type NotificationV2Summary
- type NotificationV2Type
- type OfferDiscountType
- type OfferType
- type ProductType
- type RenewalInfo
- type RequestTestNotificationResp
- type Service
- func (s *Service) Debug(debug bool) *Service
- func (s *Service) GetAllSubscriptionStatuses(ctx context.Context, transactionID string, ...) (*GetAllSubscriptionStatusesResp, error)
- func (s *Service) GetNotificationHistory(ctx context.Context, req *GetNotificationHistoryReq, paginationToken string) (*GetNotificationHistoryResp, error)
- func (s *Service) GetRefundHistory(ctx context.Context, transactionID string, revision string) (*GetRefundHistoryResp, error)
- func (s *Service) GetTestNotificationStatus(ctx context.Context, testNotificationToken string) (*GetTestNotificationStatusResp, error)
- func (s *Service) GetTransactionHistory(ctx context.Context, req *GetTransactionHistoryReq) (*GetTransactionHistoryResp, error)
- func (s *Service) GetTransactionInfo(ctx context.Context, transactionID string) (*Transaction, error)
- func (s *Service) Host() string
- func (s *Service) LookupOrder(ctx context.Context, customerOrderID string) ([]Transaction, error)
- func (s *Service) RequestTestNotification(ctx context.Context) (*RequestTestNotificationResp, error)
- func (s *Service) Sandbox(sandbox bool) *Service
- type Sort
- type SubscriptionGroupIdentifierItem
- type SubscriptionLastTransactions
- type Token
- type Transaction
- type TransactionReason
- type TransactionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiError ¶
ApiError https://developer.apple.com/documentation/appstoreserverapi/error_codes
func ApiErrorFromError ¶
func ParseApiError ¶
type AutoRenewStatus ¶
type AutoRenewStatus int32
AutoRenewStatus https://developer.apple.com/documentation/appstoreserverapi/autorenewstatus
const ( AutoRenewStatusOff AutoRenewStatus = 0 AutoRenewStatusOn AutoRenewStatus = 1 )
type AutoRenewableSubscriptionStatus ¶
type AutoRenewableSubscriptionStatus int32
AutoRenewableSubscriptionStatus 自动续订状态 https://developer.apple.com/documentation/appstoreserverapi/status
const ( // The auto-renewable subscription is active AutoRenewableSubscriptionStatusActive AutoRenewableSubscriptionStatus = 1 // The auto-renewable subscription is expired AutoRenewableSubscriptionStatusExpired AutoRenewableSubscriptionStatus = 2 // The auto-renewable subscription is in a billing retry period AutoRenewableSubscriptionStatusInBillingRetryPeriod AutoRenewableSubscriptionStatus = 3 // The auto-renewable subscription is in a Billing Grace Period AutoRenewableSubscriptionStatusInBillingGracePeriod AutoRenewableSubscriptionStatus = 4 // The auto-renewable subscription is revoked. // The App Store refunded the transaction or revoked it from Family Sharing. AutoRenewableSubscriptionStatusRevoked AutoRenewableSubscriptionStatus = 5 )
type Config ¶
type Config struct { // Your app’s bundle ID (Ex: “com.example.testbundleid2021”) BundleID string // Your issuer ID from the Keys page in App Store Connect (Ex: "57246542-96fe-1a63-e053-0824d011072a") Issuer string // Your private key ID from App Store Connect (Ex: 2X9R4HXF34) KeyID string // Your private key content PrivateKey []byte // http request timeout Timeout time.Duration }
Config config for generate token for api 文档:https://developer.apple.com/documentation/appstoreserverapi/generating_tokens_for_api_requests
type Environment ¶
type Environment string
Environment https://developer.apple.com/documentation/appstoreserverapi/environment
const ( EnvironmentSandbox Environment = "Sandbox" EnvironmentProduction Environment = "Production" )
type ExpirationIntent ¶
type ExpirationIntent int32
ExpirationIntent https://developer.apple.com/documentation/appstoreserverapi/expirationintent
const ( ExpirationIntentCustomerCanceled ExpirationIntent = 1 ExpirationIntentBillingError ExpirationIntent = 2 ExpirationIntentCustomerDoNotConsentPriceIncrease ExpirationIntent = 3 ExpirationIntentProductNotAvailable ExpirationIntent = 4 ExpirationIntentOtherReason ExpirationIntent = 5 )
type GetAllSubscriptionStatusesResp ¶
type GetAllSubscriptionStatusesResp struct { Environment Environment `json:"environment"` AppAppleID int64 `json:"appAppleId"` BundleID string `json:"bundleId"` Data []SubscriptionGroupIdentifierItem `json:"data"` }
type GetNotificationHistoryReq ¶ added in v0.1.3
type GetNotificationHistoryReq struct { // [Required] StartDate int64 `json:"startDate"` // [Required] EndDate int64 `json:"endDate"` // [Optional] NotificationType NotificationV2Type `json:"notificationType"` // [Optional] NotificationSubtype NotificationV2Subtype `json:"notificationSubtype"` // [Optional] OnlyFailures bool `json:"onlyFailures"` // [Optional] TransactionId string `json:"transactionId"` }
GetNotificationHistoryReq https://developer.apple.com/documentation/appstoreserverapi/notificationhistoryrequest
type GetNotificationHistoryResp ¶ added in v0.1.3
type GetNotificationHistoryResp struct { HasMore bool `json:"hasMore"` PaginationToken string `json:"paginationToken"` NotificationHistory []NotificationHistoryItem `json:"notificationHistory"` // contains filtered or unexported fields }
GetNotificationHistoryResp A response that contains the App Store Server Notifications history for your app https://developer.apple.com/documentation/appstoreserverapi/notificationhistoryresponse
func (*GetNotificationHistoryResp) Next ¶ added in v0.1.3
func (resp *GetNotificationHistoryResp) Next(ctx context.Context) (*GetNotificationHistoryResp, error)
Next GetNotificationHistoryResp 下一页数据
type GetRefundHistoryResp ¶
type GetRefundHistoryResp struct { HasMore bool `json:"hasMore"` Revision string `json:"revision"` SignedTransactions []JWSTransaction `json:"signedTransactions"` // contains filtered or unexported fields }
func (*GetRefundHistoryResp) GetTransactions ¶ added in v0.1.3
func (resp *GetRefundHistoryResp) GetTransactions() ([]Transaction, error)
GetTransactions 获取当前返回数据中的交易信息
func (*GetRefundHistoryResp) Next ¶
func (resp *GetRefundHistoryResp) Next(ctx context.Context) (*GetRefundHistoryResp, error)
Next GetTransactionHistoryResp 的下一页
type GetTestNotificationStatusResp ¶ added in v0.1.3
type GetTestNotificationStatusResp struct { SendAttempts []NotificationSendAttemptItem `json:"sendAttempts"` SignedPayload JWSNotification `json:"signedPayload"` }
type GetTransactionHistoryReq ¶
type GetTransactionHistoryReq struct { TransactionID string Query *GetTransactionHistoryReqQuery }
type GetTransactionHistoryReqQuery ¶
type GetTransactionHistoryReqQuery struct { // A token you provide to get the next set of up to 20 transactions. All responses include a revision token. // Use the revision token from the previous HistoryResponse Revision string `form:"revision"` // An optional start date of the timespan for the transaction history records you’re requesting. // The startDate needs to precede the endDate if you specify both dates. // The results include a transaction if its purchaseDate is equal to or greater than the startDate // The start date of a timespan, expressed in UNIX time, in milliseconds StartDate int64 `form:"startDate"` // An optional end date of the timespan for the transaction history records you’re requesting. // Choose an endDate that’s later than the startDate if you specify both dates. // Using an endDate in the future is valid. // The results include a transaction if its purchaseDate is earlier than the endDate. EndDate int64 `form:"endDate"` // An optional filter that indicates the product identifier to include in the transaction history. // Your query may specify more than one productID ProductID []string `form:"productId"` // An optional filter that indicates the product type to include in the transaction history. // Your query may specify more than one productType ProductType []ProductType `form:"productType"` // An optional sort order for the transaction history records. // The response sorts the transaction records by their recently modified date. // The default value is ASCENDING, so you receive the oldest records first Sort string `form:"sort"` // An optional filter that indicates the subscription group identifier to include in the transaction history. // Your query may specify more than one subscriptionGroupIdentifier SubscriptionGroupIdentifier []string `form:"subscriptionGroupIdentifier"` // An optional filter that limits the transaction history by the in-app ownership type InAppOwnershipType InAppOwnershipType `form:"inAppOwnershipType"` // An optional Boolean value that indicates whether the response includes only revoked transactions // when the value is true, or contains only nonrevoked transactions when the value is false. // By default, the request doesn't include this parameter Revoked *bool `form:"revoked"` }
func (*GetTransactionHistoryReqQuery) Values ¶
func (r *GetTransactionHistoryReqQuery) Values() url.Values
type GetTransactionHistoryResp ¶
type GetTransactionHistoryResp struct { AppAppleID int64 `json:"appAppleId"` BundleID string `json:"bundleId"` Environment Environment `json:"environment"` HasMore bool `json:"hasMore"` Revision string `json:"revision"` SignedTransactions []JWSTransaction `json:"signedTransactions"` // contains filtered or unexported fields }
GetTransactionHistoryResp A response that contains the customer’s transaction history for an app
func (*GetTransactionHistoryResp) GetTransactions ¶ added in v0.1.2
func (resp *GetTransactionHistoryResp) GetTransactions() ([]Transaction, error)
GetTransactions 获取当前返回数据中的交易信息
func (*GetTransactionHistoryResp) Next ¶
func (resp *GetTransactionHistoryResp) Next(ctx context.Context) (*GetTransactionHistoryResp, error)
Next GetTransactionHistory 的下一页
type InAppOwnershipType ¶
type InAppOwnershipType string
InAppOwnershipType https://developer.apple.com/documentation/appstoreserverapi/inappownershiptype
const ( InAppOwnershipTypePurchased InAppOwnershipType = "PURCHASED" )
type JWSNotification ¶ added in v0.1.3
type JWSNotification string
func (JWSNotification) GetNotification ¶ added in v0.1.3
func (s JWSNotification) GetNotification() (*NotificationV2, error)
type JWSRenewalInfo ¶
type JWSRenewalInfo string
func (JWSRenewalInfo) GetRenewInfo ¶ added in v0.1.2
func (s JWSRenewalInfo) GetRenewInfo() (*RenewalInfo, error)
type JWSTransaction ¶
type JWSTransaction string
func (JWSTransaction) GetTransaction ¶ added in v0.1.2
func (s JWSTransaction) GetTransaction() (*Transaction, error)
type JWSTransactions ¶ added in v0.1.3
type JWSTransactions []JWSTransaction
func (JWSTransactions) GetTransactions ¶ added in v0.1.3
func (ts JWSTransactions) GetTransactions() ([]Transaction, error)
type NotificationHistoryItem ¶ added in v0.1.3
type NotificationHistoryItem struct { SendAttempts []NotificationSendAttemptItem `json:"sendAttempts"` SignedPayload JWSNotification `json:"signedPayload"` }
type NotificationSendAttemptItem ¶ added in v0.1.3
type NotificationSendAttemptItem struct { AttemptDate int64 `json:"attemptDate"` SendAttemptResult NotificationSendAttemptResult `json:"sendAttemptResult"` }
type NotificationSendAttemptResult ¶ added in v0.1.3
type NotificationSendAttemptResult string
NotificationSendAttemptResult The success or error information the App Store server records when it attempts to send an App Store server notification to your server https://developer.apple.com/documentation/appstoreserverapi/sendattemptresult
const ( NotificationSendAttemptResultSuccess NotificationSendAttemptResult = "SUCCESS" NotificationSendAttemptResultCircularRedirect NotificationSendAttemptResult = "CIRCULAR_REDIRECT" NotificationSendAttemptResultInvalidResponse NotificationSendAttemptResult = "INVALID_RESPONSE" NotificationSendAttemptResultNoResponse NotificationSendAttemptResult = "NO_RESPONSE" NotificationSendAttemptResultOther NotificationSendAttemptResult = "OTHER" NotificationSendAttemptResultPrematureClose NotificationSendAttemptResult = "PREMATURE_CLOSE" NotificationSendAttemptResultSocketIssue NotificationSendAttemptResult = "SOCKET_ISSUE" NotificationSendAttemptResultTimeout NotificationSendAttemptResult = "TIMED_OUT" NotificationSendAttemptResultTLSIssue NotificationSendAttemptResult = "TLS_ISSUE" NotificationSendAttemptResultUnsuccessfulHttpResponseCode NotificationSendAttemptResult = "UNSUCCESSFUL_HTTP_RESPONSE_CODE" NotificationSendAttemptResultUnsupportedCharset NotificationSendAttemptResult = "UNSUPPORTED_CHARSET" )
type NotificationV2 ¶ added in v0.1.3
type NotificationV2 struct { NotificationType NotificationV2Type `json:"notificationType"` Subtype NotificationV2Subtype `json:"subtype"` Data NotificationV2Data `json:"data"` Summary NotificationV2Summary `json:"summary"` Version string `json:"version"` SignedDate int64 `json:"signedDate"` NotificationUUID string `json:"notificationUUID"` }
NotificationV2 the version 2 notification data https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv2decodedpayload
type NotificationV2Data ¶ added in v0.1.3
type NotificationV2Data struct { AppAppleID int64 `json:"appAppleId"` BundleID string `json:"bundleId"` BundleVersion string `json:"bundleVersion"` Environment Environment `json:"environment"` SignedRenewalInfo JWSRenewalInfo `json:"signedRenewalInfo"` SignedTransactionInfo JWSTransaction `json:"signedTransactionInfo"` Status AutoRenewableSubscriptionStatus `json:"status"` }
type NotificationV2Subtype ¶ added in v0.1.3
type NotificationV2Subtype string
NotificationV2Subtype A string that provides details about select notification types in version 2 https://developer.apple.com/documentation/appstoreservernotifications/subtype
const ( NotificationV2SubtypeAccepted NotificationV2Subtype = "ACCEPTED" NotificationV2SubtypeAutoRenewDisabled NotificationV2Subtype = "AUTO_RENEW_DISABLED" NotificationV2SubtypeAutoRenewEnabled NotificationV2Subtype = "AUTO_RENEW_ENABLED" NotificationV2SubtypeBillingRecovery NotificationV2Subtype = "BILLING_RECOVERY" NotificationV2SubtypeBillingRetry NotificationV2Subtype = "BILLING_RETRY" NotificationV2SubtypeDowngrade NotificationV2Subtype = "DOWNGRADE" NotificationV2SubtypeFailure NotificationV2Subtype = "FAILURE" NotificationV2SubtypeGracePeriod NotificationV2Subtype = "GRACE_PERIOD" NotificationV2SubtypeInitialBuy NotificationV2Subtype = "INITIAL_BUY" NotificationV2SubtypePending NotificationV2Subtype = "PENDING" NotificationV2SubtypePriceIncrease NotificationV2Subtype = "PRICE_INCREASE" NotificationV2SubtypeProductNotForSale NotificationV2Subtype = "PRODUCT_NOT_FOR_SALE" NotificationV2SubtypeResubscribe NotificationV2Subtype = "RESUBSCRIBE" NotificationV2SubtypeSummary NotificationV2Subtype = "SUMMARY" NotificationV2SubtypeUpgrade NotificationV2Subtype = "UPGRADE" NotificationV2SubtypeVoluntary NotificationV2Subtype = "VOLUNTARY" )
type NotificationV2Summary ¶ added in v0.1.3
type NotificationV2Summary struct { RequestIdentifier string `json:"requestIdentifier"` Environment Environment `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"` }
NotificationV2Summary https://developer.apple.com/documentation/appstoreservernotifications/summary
type NotificationV2Type ¶ added in v0.1.3
type NotificationV2Type string
NotificationV2Type The type that describes the in-app purchase event for which the App Store sends the version 2 notification https://developer.apple.com/documentation/appstoreservernotifications/notificationtype
const ( NotificationV2TypeConsumptionRequest NotificationV2Type = "CONSUMPTION_REQUEST" NotificationV2TypeDidChangeRenewPref NotificationV2Type = "DID_CHANGE_RENEWAL_PREF" NotificationV2TypeDidChangeRenewStatus NotificationV2Type = "DID_CHANGE_RENEWAL_STATUS" NotificationV2TypeDidFailToRenew NotificationV2Type = "DID_FAIL_TO_RENEW" NotificationV2TypeDidRenew NotificationV2Type = "DID_RENEW" NotificationV2TypeExpired NotificationV2Type = "EXPIRED" NotificationV2TypeGracePeriodExpired NotificationV2Type = "GRACE_PERIOD_EXPIRED" NotificationV2TypeOfferRedeemed NotificationV2Type = "OFFER_REDEEMED" NotificationV2TypePriceIncrease NotificationV2Type = "PRICE_INCREASE" NotificationV2TypeRefund NotificationV2Type = "REFUND" NotificationV2TypeRefundDeclined NotificationV2Type = "REFUND_DECLINED" NotificationV2TypeRefundReversed NotificationV2Type = "REFUND_REVERSED" NotificationV2TypeRenewalExtended NotificationV2Type = "RENEWAL_EXTENDED" NotificationV2TypeRenewalExtension NotificationV2Type = "RENEWAL_EXTENSION" NotificationV2TypeRevoke NotificationV2Type = "REVOKE" NotificationV2TypeSubscribed NotificationV2Type = "SUBSCRIBED" NotificationV2TypeTest NotificationV2Type = "TEST" )
type OfferDiscountType ¶
type OfferDiscountType string
OfferDiscountType https://developer.apple.com/documentation/appstoreserverapi/offerdiscounttype
const ( OfferDiscountTypeFreeTrial OfferDiscountType = "FREE_TRIAL" OfferDiscountTypePayAsYouGo OfferDiscountType = "PAY_AS_YOU_GO" OfferDiscountTypePayUpFront OfferDiscountType = "PAY_UP_FRONT" )
type OfferType ¶
type OfferType int
OfferType https://developer.apple.com/documentation/appstoreserverapi/offertype
type ProductType ¶
type ProductType string
const ( ProductTypeAutoRenewable ProductType = "AUTO_RENEWABLE" ProductTypeNonRenewable ProductType = "NON_RENEWABLE" ProductTypeConsumable ProductType = "CONSUMABLE" ProductTypeNonConsumable ProductType = "NON_CONSUMABLE" )
type RenewalInfo ¶ added in v0.1.2
type RenewalInfo 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 *int32 `json:"priceIncreaseStatus"` ProductID string `json:"productId"` RecentSubscriptionStartDate int64 `json:"recentSubscriptionStartDate"` RenewalDate int64 `json:"renewalDate"` SignedDate int64 `json:"signedDate"` }
RenewalInfo subscription renewal information for an auto-renewable subscription https://developer.apple.com/documentation/appstoreserverapi/jwsrenewalinfodecodedpayload
type RequestTestNotificationResp ¶ added in v0.1.3
type RequestTestNotificationResp struct {
TestNotificationToken string `json:"testNotificationToken"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service app store server api 实现 api: https://developer.apple.com/documentation/appstoreserverapi/generating_tokens_for_api_requests
func NewService ¶
func (*Service) GetAllSubscriptionStatuses ¶
func (s *Service) GetAllSubscriptionStatuses(ctx context.Context, transactionID string, status []AutoRenewableSubscriptionStatus) (*GetAllSubscriptionStatusesResp, error)
GetAllSubscriptionStatuses Get the statuses for all of a customer’s auto-renewable subscriptions in your app.
- status: An optional filter that indicates the status of subscriptions to include in the response. Your query may specify more than one status query parameter
https://developer.apple.com/documentation/appstoreserverapi/get_all_subscription_statuses
func (*Service) GetNotificationHistory ¶ added in v0.1.3
func (s *Service) GetNotificationHistory(ctx context.Context, req *GetNotificationHistoryReq, paginationToken string) (*GetNotificationHistoryResp, error)
GetNotificationHistory Get a list of notifications that the App Store server attempted to send to your server Notification history is available for the past 180 days. Choose a startDate that’s within 180 days of the current date. https://developer.apple.com/documentation/appstoreserverapi/get_notification_history
func (*Service) GetRefundHistory ¶
func (s *Service) GetRefundHistory(ctx context.Context, transactionID string, revision string) (*GetRefundHistoryResp, error)
GetRefundHistory https://developer.apple.com/documentation/appstoreserverapi/get_refund_history
func (*Service) GetTestNotificationStatus ¶ added in v0.1.3
func (s *Service) GetTestNotificationStatus(ctx context.Context, testNotificationToken string) (*GetTestNotificationStatusResp, error)
GetTestNotificationStatus Check the status of the test App Store server notification sent to your server https://developer.apple.com/documentation/appstoreserverapi/get_test_notification_status
func (*Service) GetTransactionHistory ¶
func (s *Service) GetTransactionHistory(ctx context.Context, req *GetTransactionHistoryReq) (*GetTransactionHistoryResp, error)
GetTransactionHistory Get a customer’s in-app purchase transaction history for your app https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history
func (*Service) GetTransactionInfo ¶
func (s *Service) GetTransactionInfo(ctx context.Context, transactionID string) (*Transaction, error)
GetTransactionInfo Get information about a single transaction for your app https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info
func (*Service) LookupOrder ¶
LookupOrder Get a customer’s in-app purchases from a receipt using the order ID. api: https://developer.apple.com/documentation/appstoreserverapi/look_up_order_id
func (*Service) RequestTestNotification ¶ added in v0.1.3
func (s *Service) RequestTestNotification(ctx context.Context) (*RequestTestNotificationResp, error)
RequestTestNotification Ask App Store Server Notifications to send a test notification to your server https://developer.apple.com/documentation/appstoreserverapi/request_a_test_notification
type SubscriptionGroupIdentifierItem ¶
type SubscriptionGroupIdentifierItem struct { SubscriptionGroupIdentifier string `json:"subscriptionGroupIdentifier"` LastTransactions []SubscriptionLastTransactions `json:"lastTransactions"` }
type SubscriptionLastTransactions ¶
type SubscriptionLastTransactions struct { OriginalTransactionID string `json:"originalTransactionId"` Status AutoRenewableSubscriptionStatus `json:"status"` SignedRenewalInfo JWSRenewalInfo `json:"signedRenewalInfo"` SignedTransactionInfo JWSTransaction `json:"signedTransactionInfo"` }
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token JSON Web Tokens signed to authorize App Store Server API requests
type Transaction ¶ added in v0.1.2
type Transaction struct { // A UUID you create at the time of purchase that associates the transaction with a customer on your own service. // If your app doesn’t provide an appAccountToken, this string is empty. AppAccountToken string `json:"appAccountToken,omitempty"` // The bundle identifier of the app. BundleID string `json:"bundleId,omitempty"` // The server environment, either sandbox or production Environment Environment `json:"environment,omitempty"` // A string that describes whether the transaction was purchased by the customer, // or is available to them through Family Sharing InAppOwnershipType InAppOwnershipType `json:"inAppOwnershipType,omitempty"` // The UNIX time, in milliseconds, that represents the purchase date of the original transaction identifier OriginalPurchaseDate int64 `json:"originalPurchaseDate,omitempty"` // The transaction identifier of the original purchase OriginalTransactionID string `json:"originalTransactionId,omitempty"` // The unique identifier of the product ProductID string `json:"productId,omitempty"` // The three-letter ISO 4217 currency code associated with the price parameter. // This value is present only if price is present Currency string `json:"currency,omitempty"` // An integer value that represents the price multiplied by 1000 of the in-app purchase or subscription offer // you configured in App Store Connect and that the system records at the time of the purchase. // For more information, see price. The currency parameter indicates the currency of this price Price int `json:"price,omitempty"` // The number of consumable products the customer purchased. Quantity int `json:"quantity,omitempty"` // The unique identifier of the transaction TransactionID string `json:"transactionId,omitempty"` // The type of the in-app purchase Type TransactionType `json:"type,omitempty"` // The reason for the purchase transaction, which indicates whether it’s a customer’s purchase or a renewal // for an auto-renewable subscription that the system initiates TransactionReason TransactionReason `json:"transactionReason,omitempty"` // The UNIX time, in milliseconds, that the App Store charged the customer’s account for a purchase, // restored product, subscription, or subscription renewal after a lapse PurchaseDate int64 `json:"purchaseDate,omitempty"` // The UNIX time, in milliseconds, that the App Store refunded the transaction or revoked it from Family Sharing RevocationDate int64 `json:"revocationDate,omitempty"` // The reason that the App Store refunded the transaction or revoked it from Family Sharing. RevocationReason *int `json:"revocationReason,omitempty"` // The UNIX time, in milliseconds, that the App Store signed the JSON Web Signature (JWS) data SignedDate int64 `json:"signedDate,omitempty"` // The three-letter code that represents the country or region associated with the App Store storefront for the purchase Storefront string `json:"storefront,omitempty"` // An Apple-defined value that uniquely identifies the App Store storefront associated with the purchase StorefrontID string `json:"storefrontId,omitempty"` // The identifier of the subscription group to which the subscription belongs. SubscriptionGroupIdentifier string `json:"subscriptionGroupIdentifier,omitempty"` // A Boolean value that indicates whether the customer upgraded to another subscription IsUpgraded bool `json:"isUpgraded,omitempty"` // The UNIX time, in milliseconds, that the subscription expires or renews. ExpiresDate int64 `json:"expiresDate,omitempty"` // The payment mode you configure for the subscription offer OfferDiscountType OfferDiscountType `json:"offerDiscountType,omitempty"` // The identifier that contains the offer code or the promotional offer identifier // The offerIdentifier applies only when the offerType has a value of 2 or 3. // The offerIdentifier provides details about the subscription offer in effect for the transaction. // Its value is either the offer code or the promotional offer OfferIdentifier string `json:"offerIdentifier,omitempty"` // A value that represents the promotional offer type. OfferType OfferType `json:"offerType,omitempty"` // The unique identifier of subscription purchase events across devices, including subscription renewals. WebOrderLineItemID string `json:"webOrderLineItemId,omitempty"` }
Transaction A decoded payload that contains transaction information https://developer.apple.com/documentation/appstoreserverapi/jwstransactiondecodedpayload
type TransactionReason ¶
type TransactionReason string
TransactionReason https://developer.apple.com/documentation/appstoreserverapi/transactionreason
const ( TransactionReasonPurchase TransactionReason = "PURCHASE" TransactionReasonRenewal TransactionReason = "RENEWAL" )
type TransactionType ¶
type TransactionType string
TransactionType https://developer.apple.com/documentation/appstoreserverapi/type
const ( TransactionTypeAutoRenewableSubscription TransactionType = "Auto-Renewable Subscription" TransactionTypeNonRenewingSubscription TransactionType = "Non-Renewing Subscription" TransactionTypeConsumable TransactionType = "Consumable" TransactionTypeNonConsumable TransactionType = "Non-Consumable" )