@@ -84,27 +84,49 @@ type JWSDecodedHeader struct {
84
84
X5C []string `json:"x5c,omitempty"`
85
85
}
86
86
87
+ // TransactionReason indicates the cause of a purchase transaction,
88
+ // https://developer.apple.com/documentation/appstoreservernotifications/transactionreason
89
+ type TransactionReason string
90
+
91
+ const (
92
+ TransactionReasonPurchase = "PURCHASE"
93
+ TransactionReasonRenewal = "RENEWAL"
94
+ )
95
+
96
+ // IAPType https://developer.apple.com/documentation/appstoreserverapi/type
97
+ type IAPType string
98
+
99
+ const (
100
+ AutoRenewable IAPType = "Auto-Renewable Subscription"
101
+ NonConsumable IAPType = "Non-Consumable"
102
+ Consumable IAPType = "Consumable"
103
+ NonRenewable IAPType = "Non-Renewing Subscription"
104
+ )
105
+
87
106
// JWSTransaction https://developer.apple.com/documentation/appstoreserverapi/jwstransaction
88
107
type JWSTransaction struct {
89
- TransactionID string `json:"transactionId,omitempty"`
90
- OriginalTransactionId string `json:"originalTransactionId,omitempty"`
91
- WebOrderLineItemId string `json:"webOrderLineItemId,omitempty"`
92
- BundleID string `json:"bundleId,omitempty"`
93
- ProductID string `json:"productId,omitempty"`
94
- SubscriptionGroupIdentifier string `json:"subscriptionGroupIdentifier,omitempty"`
95
- PurchaseDate int64 `json:"purchaseDate,omitempty"`
96
- OriginalPurchaseDate int64 `json:"originalPurchaseDate,omitempty"`
97
- ExpiresDate int64 `json:"expiresDate,omitempty"`
98
- Quantity int64 `json:"quantity,omitempty"`
99
- Type string `json:"type,omitempty"`
100
- AppAccountToken string `json:"appAccountToken,omitempty"`
101
- InAppOwnershipType string `json:"inAppOwnershipType,omitempty"`
102
- SignedDate int64 `json:"signedDate,omitempty"`
103
- OfferType int64 `json:"offerType,omitempty"`
104
- OfferIdentifier string `json:"offerIdentifier,omitempty"`
105
- RevocationDate int64 `json:"revocationDate,omitempty"`
106
- RevocationReason int `json:"revocationReason,omitempty"`
107
- IsUpgraded bool `json:"isUpgraded,omitempty"`
108
+ TransactionID string `json:"transactionId,omitempty"`
109
+ OriginalTransactionId string `json:"originalTransactionId,omitempty"`
110
+ WebOrderLineItemId string `json:"webOrderLineItemId,omitempty"`
111
+ BundleID string `json:"bundleId,omitempty"`
112
+ ProductID string `json:"productId,omitempty"`
113
+ SubscriptionGroupIdentifier string `json:"subscriptionGroupIdentifier,omitempty"`
114
+ PurchaseDate int64 `json:"purchaseDate,omitempty"`
115
+ OriginalPurchaseDate int64 `json:"originalPurchaseDate,omitempty"`
116
+ ExpiresDate int64 `json:"expiresDate,omitempty"`
117
+ Quantity int64 `json:"quantity,omitempty"`
118
+ Type IAPType `json:"type,omitempty"`
119
+ AppAccountToken string `json:"appAccountToken,omitempty"`
120
+ InAppOwnershipType string `json:"inAppOwnershipType,omitempty"`
121
+ SignedDate int64 `json:"signedDate,omitempty"`
122
+ OfferType int64 `json:"offerType,omitempty"`
123
+ OfferIdentifier string `json:"offerIdentifier,omitempty"`
124
+ RevocationDate int64 `json:"revocationDate,omitempty"`
125
+ RevocationReason int `json:"revocationReason,omitempty"`
126
+ IsUpgraded bool `json:"isUpgraded,omitempty"`
127
+ Storefront string `json:"storefront"`
128
+ StorefrontId string `json:"storefrontId"`
129
+ TransactionReason TransactionReason `json:"transactionReason"`
108
130
}
109
131
110
132
func (J JWSTransaction ) Valid () error {
0 commit comments