### Offer Period Examples in ISO 8601 Format Source: https://developer.apple.com/documentation/appstoreservernotifications/offerperiod Examples of offerPeriod values using the ISO 8601 duration format for different offer lengths and counts. ```string P1M ``` ```string P2M ``` ```string P3D ``` -------------------------------- ### Get Recent Subscription Start Date Source: https://developer.apple.com/documentation/appstoreservernotifications/recentsubscriptionstartdate Use the `recentSubscriptionStartDate` field to retrieve the earliest start date of a subscription series. This field ignores lapses in paid service shorter than 60 days. Do not use this date to calculate days of paid service. ```text timestamp recentSubscriptionStartDate ``` -------------------------------- ### renewalDate Field Example Source: https://developer.apple.com/documentation/appstoreservernotifications/renewaldate This is an example of the renewalDate field as it appears in the App Store Server Notifications payload. It represents the UNIX time in milliseconds when the most recent auto-renewable subscription purchase expires. ```plaintext timestamp renewalDate ``` -------------------------------- ### Offer Discount Type String Source: https://developer.apple.com/documentation/appstoreservernotifications/offerdiscounttype Defines the string representation for the offer discount type in App Store Server Notifications version 2.9 and later. ```string string offerDiscountType ``` -------------------------------- ### Possible Values for advancedCommerceOfferPeriod Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceofferperiod Lists the possible string values for advancedCommerceOfferPeriod, representing various subscription durations. Use these values to define offer periods. ```plaintext P3D ``` ```plaintext P1W ``` ```plaintext P2W ``` ```plaintext P1M ``` ```plaintext P2M ``` ```plaintext P3M ``` ```plaintext P6M ``` ```plaintext P9M ``` ```plaintext P1Y ``` -------------------------------- ### bundleVersion Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/bundleversion Defines the bundleVersion as a string, representing the app's build version. ```typescript string bundleVersion ``` -------------------------------- ### Environment Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/environment Defines the 'environment' type as a string for App Store Server Notifications. Use this to specify the server environment for notifications. ```typescript string environment ``` -------------------------------- ### Notification Version String Source: https://developer.apple.com/documentation/appstoreservernotifications/version A string that indicates the notification’s App Store Server Notifications version number. This is present in responseBodyV2DecodedPayload for version 2 notifications. ```string string version ``` -------------------------------- ### Define advancedCommerceSKU Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercesku This snippet shows the definition of the advancedCommerceSKU type, which is a string. It is used to identify products. ```swift string advancedCommerceSKU ``` -------------------------------- ### currency Source: https://developer.apple.com/documentation/appstoreservernotifications/currency The three-letter ISO 4217 currency code for the price of the product. This property is available in App Store Server Notifications version 2.9 and later. ```APIDOC ## currency ### Description The three-letter ISO 4217 currency code for the price of the product. ### Type ``` string currency ``` ### Discussion The currency property contains an ISO 4217 alpha-3 string that represents the currency of the price of the product. Do not use the `currency` value to infer the storefront; use the `storefront` value in the transaction instead. For more information on how you set prices, see Set a price and Set a price for an in-app purchase. ``` -------------------------------- ### Price Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/price The 'price' field is an integer representing the cost in milliunits. One unit of currency equals 1000 milliunits. This value reflects configured prices, discounts, and quantities. ```plaintext int64 price ``` -------------------------------- ### Possible Values for advancedCommerceReason Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercereason Lists the possible string values for the advancedCommerceReason type. These values represent different reasons for commerce-related events. ```plaintext ACQUISITION ``` ```plaintext WIN_BACK ``` ```plaintext RETENTION ``` -------------------------------- ### Product Type Source: https://developer.apple.com/documentation/appstoreservernotifications/type The 'type' field indicates the product type of an In-App Purchase. This is a string value representing one of the predefined purchase types. ```APIDOC ## type The product type of the In-App Purchase. App Store Server Notifications 2.0+ ``` string type ``` ### Possible Values `Auto-Renewable Subscription` An auto-renewable subscription. `Non-Consumable` A non-consumable In-App Purchase. `Consumable` A consumable In-App Purchase. `Non-Renewing Subscription` A non-renewing subscription. ``` -------------------------------- ### Define advancedCommerceRenewalInfo Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerenewalinfo Defines the structure for the advancedCommerceRenewalInfo object. This object is available in App Store Server Notifications version 2.14 and later. ```swift object advancedCommerceRenewalInfo ``` -------------------------------- ### Possible Values for advancedCommercePeriod Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceperiod Lists the possible values for the advancedCommercePeriod type, representing different subscription durations using ISO 8601 format. ```plaintext P1W ``` ```plaintext P1M ``` ```plaintext P2M ``` ```plaintext P3M ``` ```plaintext P6M ``` ```plaintext P1Y ``` -------------------------------- ### Subtype String Type Source: https://developer.apple.com/documentation/appstoreservernotifications/subtype Defines the subtype as a string for App Store Server Notifications 2.0 and later. ```text string subtype ``` -------------------------------- ### appData Object Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/appdata Defines the structure of the appData object, which holds app metadata and signed transaction information. ```javascript object appData ``` -------------------------------- ### billingPlanType Enum Source: https://developer.apple.com/documentation/appstoreservernotifications/billingplantype Defines the billing plan type for subscriptions. Use this to understand how a subscription is billed. ```swift string billingPlanType ``` -------------------------------- ### JWSRenewalInfoDecodedPayload Object Source: https://developer.apple.com/documentation/appstoreservernotifications/jwsrenewalinfodecodedpayload The JWSRenewalInfoDecodedPayload object contains the following properties: ```APIDOC ## JWSRenewalInfoDecodedPayload A decoded payload containing subscription renewal information for an auto-renewable subscription. App Store Server Notifications 2.0+ ```object JWSRenewalInfoDecodedPayload``` ### Properties `appAccountToken` ``appAccountToken`` A UUID you create at the time of purchase that associates the transaction with a customer on your own service. This is the token that applies to the upcoming renewal transaction. If your app doesn’t provide an `appAccountToken`, this field is omitted. For more information, see `appAccountToken(_:)`. `appTransactionId` ``appTransactionId`` The unique identifier of the app download transaction. `autoRenewProductId` ``autoRenewProductId`` The product identifier of the product that renews at the next billing period. `autoRenewStatus` ``autoRenewStatus`` The renewal status of the auto-renewable subscription. `currency` ``currency`` The currency code for the `renewalPrice` of the subscription. `commitmentInfo` ``RenewalCommitmentInfo`` `eligibleWinBackOfferIds` ``eligibleWinBackOfferIds`` The list of win-back offer IDs that the customer is eligible for. `environment` ``environment`` The server environment, either sandbox or production. `expirationIntent` ``expirationIntent`` The reason the subscription expired. `gracePeriodExpiresDate` ``gracePeriodExpiresDate`` The time when the Billing Grace Period for subscription renewals expires. `isInBillingRetryPeriod` ``isInBillingRetryPeriod`` The Boolean value that indicates whether the App Store is attempting to automatically renew the expired subscription. `offerDiscountType` ``offerDiscountType`` The payment mode of the discount offer. `offerIdentifier` ``offerIdentifier`` The offer code or the promotional offer identifier. `offerPeriod` ``offerPeriod`` The duration of the offer. `offerType` ``offerType`` The type of offer. `originalTransactionId` ``originalTransactionId`` The transaction identifier of the original purchase associated with this transaction. `priceIncreaseStatus` ``priceIncreaseStatus`` The status that indicates whether the auto-renewable subscription is subject to a price increase. `productId` ``productId`` The product identifier of the In-App Purchase. `recentSubscriptionStartDate` ``recentSubscriptionStartDate`` The earliest start date of the auto-renewable subscription in a series of subscription purchases that ignores all lapses of paid service that are 60 days or fewer. `renewalBillingPlanType` ``renewalBillingPlanType`` `renewalDate` ``renewalDate`` The UNIX time, in milliseconds, when the most recent auto-renewable subscription purchase expires. `renewalPrice` ``renewalPrice`` The renewal price, in milliunits, of the auto-renewable subscription that renews at the next billing period. `signedDate` ``signedDate`` The UNIX time, in milliseconds, that the App Store signed the JSON Web Signature (JWS) data. `advancedCommerceInfo` ``advancedCommerceRenewalInfo`` Renewal information that is present only for Advanced Commerce API SKUs. ``` -------------------------------- ### alg Source: https://developer.apple.com/documentation/appstoreservernotifications/alg The JSON Web Signature (JWS) header parameter that identifies the cryptographic algorithm used to secure the JWS. Supported in App Store Server Notifications 2.0 and later. ```APIDOC ## alg ### Description The JSON Web Signature (JWS) header parameter that identifies the cryptographic algorithm used to secure the JWS. ### Type ``` string alg ``` ### Supported Versions App Store Server Notifications 2.0+ ``` -------------------------------- ### Define offerPeriod Type Source: https://developer.apple.com/documentation/appstoreservernotifications/offerperiod The offerPeriod field represents the duration of an offer and is a string type. It adheres to the ISO 8601 duration format. ```string string offerPeriod ``` -------------------------------- ### Offer Identifier Type Source: https://developer.apple.com/documentation/appstoreservernotifications/offeridentifier Defines the data type for the offerIdentifier in App Store Server Notifications 2.0+. ```string string offerIdentifier ``` -------------------------------- ### alg Header Parameter Source: https://developer.apple.com/documentation/appstoreservernotifications/alg The 'alg' header parameter identifies the cryptographic algorithm used to secure the JWS. This applies to App Store Server Notifications 2.0 and later. ```string string alg ``` -------------------------------- ### advancedCommerceRefundReason Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerefundreason Defines the advancedCommerceRefundReason as a string type. This is used to indicate the reason for a refund. ```swift string advancedCommerceRefundReason ``` -------------------------------- ### Define offerType as int32 Source: https://developer.apple.com/documentation/appstoreservernotifications/offertype The offerType is an integer that specifies the type of offer. This field is available in App Store Server Notifications version 2.0 and later. ```plaintext int32 offerType ``` -------------------------------- ### advancedCommerceOffer Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceoffer The advancedCommerceOffer object represents an offer for advanced commerce features. It includes details about the offer's period, count, price, and reason. ```APIDOC ## Object: advancedCommerceOffer App Store Server Notifications 2.14+ ### Description Represents an offer for advanced commerce features. ### Properties - `period` (advancedCommerceOfferPeriod) - The duration of the offer. - `periodCount` (advancedCommercePeriodCount) - The number of periods for the offer. - `price` (advancedCommerceOfferPrice) - The price of the offer. - `reason` (advancedCommerceReason) - The reason for the offer. ``` -------------------------------- ### advancedCommerceRenewalItem Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerenewalitem Represents a renewal item for an in-app purchase within App Store Server Notifications. This object is available in version 2.14+. ```APIDOC ## advancedCommerceRenewalItem Object App Store Server Notifications 2.14+ ``` object advancedCommerceRenewalItem ``` ### Properties * **SKU** (string) - The SKU of the in-app purchase. * **description** (string) - The description of the in-app purchase. * **displayName** (string) - The display name of the in-app purchase. * **offer** (object) - Information about the offer associated with the renewal. * **price** (object) - The price details of the in-app purchase. * **priceIncreaseInfo** (object) - Information about any price increase for the renewal. ``` -------------------------------- ### Define advancedCommerceOffer Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceoffer Defines the structure of the advancedCommerceOffer object. This object is used in App Store Server Notifications version 2.14 and later. ```javascript object advancedCommerceOffer ``` -------------------------------- ### appData Object Source: https://developer.apple.com/documentation/appstoreservernotifications/appdata The appData object contains metadata for the app and signed transaction information. It is part of the responseBodyV2DecodedPayload and is present when the notificationType is RESCIND_CONSENT. ```APIDOC ## Object: appData The object that contains the app metadata and signed app transaction information. App Store Server Notifications 2.19+. ### Properties * **appAppleId** (string) - The unique identifier of the app that the notification applies to. This property is available for apps that users download from the App Store. It isn’t present in the sandbox environment. * **bundleId** (string) - The bundle identifier of the app. * **environment** (string) - The server environment that the notification applies to, either `sandbox` or `production`. * **signedAppTransactionInfo** (JWSAppTransaction) - App transaction information signed by the App Store, in JSON Web Signature (JWS) format. ### Discussion The `appData` object is part of the `responseBodyV2DecodedPayload`. This object is present in the payload when the `notificationType` is `RESCIND_CONSENT`. ``` -------------------------------- ### advancedCommerceRenewalInfo Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerenewalinfo The advancedCommerceRenewalInfo object contains details about advanced commerce renewals, including consistency tokens, descriptors, items, renewal periods, request reference IDs, and tax codes. ```APIDOC ## Object: advancedCommerceRenewalInfo App Store Server Notifications 2.14+ ### Description Provides information about advanced commerce renewals. ### Properties - `consistencyToken` (advancedCommerceConsistencyToken) - The token to use for verifying the request. - `descriptors` (advancedCommerceDescriptors) - A list of descriptors for the renewal. - `items` (advancedCommerceRenewalItems) - A list of renewal items. - `period` (advancedCommercePeriod) - The renewal period. - `requestReferenceId` (advancedCommerceRequestReferenceId) - The reference ID for the request. - `taxCode` (advancedCommerceTaxCode) - The tax code for the renewal. ``` -------------------------------- ### Currency Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/currency Defines the 'currency' field as a string type for App Store Server Notifications version 2.9 and later. This field represents the ISO 4217 currency code. ```plaintext string currency ``` -------------------------------- ### In-App Purchase Product Type Source: https://developer.apple.com/documentation/appstoreservernotifications/type Represents the product type of an In-App Purchase in App Store Server Notifications 2.0+. Possible values include 'Auto-Renewable Subscription', 'Non-Consumable', 'Consumable', and 'Non-Renewing Subscription'. ```string string type ``` -------------------------------- ### billingPlanType Source: https://developer.apple.com/documentation/appstoreservernotifications/billingplantype The billing plan type for a subscription. Available for App Store Server Notifications version 2.21 and later. ```APIDOC ## billingPlanType App Store Server Notifications 2.21+ ``` string billingPlanType ``` ### Possible Values - `BILLED_UPFRONT` - `MONTHLY` ``` -------------------------------- ### Define advancedCommerceRenewalItem Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerenewalitem This snippet shows the basic definition of the advancedCommerceRenewalItem object. It is used to represent renewal information for a subscription item. ```swift object advancedCommerceRenewalItem ``` -------------------------------- ### advancedCommerceTransactionItem Object Structure Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercetransactionitem This snippet details the structure of the advancedCommerceTransactionItem object, outlining its properties and their types. ```APIDOC ## Object: advancedCommerceTransactionItem App Store Server Notifications 2.14+ ### Properties * **SKU** (`advancedCommerceSKU`) * **description** (`advancedCommerceDescription`) * **displayName** (`advancedCommerceDisplayName`) * **offer** (`advancedCommerceOffer`) * **price** (`advancedCommercePrice`) * **refunds** (`advancedCommerceRefunds`) * **revocationDate** (`revocationDate`) ``` -------------------------------- ### advancedCommerceDisplayName Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercedisplayname Defines the advancedCommerceDisplayName as a string. Available in App Store Server Notifications 2.14+. ```typescript string advancedCommerceDisplayName ``` -------------------------------- ### Define Advanced Commerce Descriptors Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercedescriptors This snippet shows the basic structure of the advancedCommerceDescriptors object. It is used to define advanced commerce-related information. ```json object advancedCommerceDescriptors ``` -------------------------------- ### App Store Server Notifications Data Object Structure Source: https://developer.apple.com/documentation/appstoreservernotifications/data Defines the structure of the 'data' object used in App Store Server Notifications v2.0+. This object contains app metadata and signed renewal and transaction information. ```json object data ``` -------------------------------- ### advancedCommerceRefund Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerefund The advancedCommerceRefund object contains details about a refund transaction. ```APIDOC ## Object: advancedCommerceRefund App Store Server Notifications 2.14+ ### Description Represents details of an advanced commerce refund. ### Properties - `refundAmount` (advancedCommerceRefundAmount) - The amount refunded. - `refundDate` (advancedCommerceRefundDate) - The date and time when the refund was processed. - `refundReason` (advancedCommerceRefundReason) - The reason for the refund. - `refundType` (advancedCommerceRefundType) - The type of refund. ``` -------------------------------- ### advancedCommercePriceIncreaseInfo Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercepriceincreaseinfo The advancedCommercePriceIncreaseInfo object contains details about a price increase for an in-app purchase. ```APIDOC ## Object: advancedCommercePriceIncreaseInfo App Store Server Notifications 2.20+ ``` object advancedCommercePriceIncreaseInfo ``` ### Properties * `dependentSKUs` (`array` of `advancedCommercePriceIncreaseInfoDependentSKU`) * `price` (`advancedCommercePriceIncreaseInfoPrice`) * `status` (`advancedCommercePriceIncreaseInfoStatus`) ``` -------------------------------- ### App Store Server Notifications V2 Endpoint Source: https://developer.apple.com/documentation/appstoreservernotifications/app-store-server-notifications-v2 The App Store Server sends notifications to your secure server's URL via a POST request. ```APIDOC ## POST https://example.com/v2 ### Description This endpoint is used by the App Store to send version 2 notifications to your server. ### Method POST ### Endpoint https://example.com/v2 ### Response #### Success Response (200 OK) - **responseBodyV2** (object) - The response body for a version 2 notification. ### Response Example ```json { "example": "responseBodyV2" } ``` ``` -------------------------------- ### advancedCommerceDescription Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercedescription Represents a string value for advanced commerce descriptions. This type is available in App Store Server Notifications version 2.14 and later. ```typescript string advancedCommerceDescription ``` -------------------------------- ### unified_receipt.Latest_receipt_info Object Source: https://developer.apple.com/documentation/appstoreservernotifications/unified_receipt/latest_receipt_info-data.dictionary Represents the latest in-app subscription transaction. This object is used in App Store Server Notifications version 1.2 and later. ```json object unified_receipt.Latest_receipt_info ``` -------------------------------- ### advancedCommercePriceIncreaseInfoDependentSKU Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercepriceincreaseinfodependentsku This snippet shows the declaration of the advancedCommercePriceIncreaseInfoDependentSKU data type. It is a string and is available in App Store Server Notifications version 2.20 and later. ```swift string advancedCommercePriceIncreaseInfoDependentSKU ``` -------------------------------- ### advancedCommerceOfferPrice Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceofferprice Defines the advancedCommerceOfferPrice as an int64. This type is used to represent the price of an offer. ```plaintext int64 advancedCommerceOfferPrice ``` -------------------------------- ### Define advancedCommerceRefund Object Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerefund This snippet defines the structure of the advancedCommerceRefund object. It is used to represent refund details for a transaction. ```swift object advancedCommerceRefund ``` -------------------------------- ### App Store Server Notifications V2 Endpoint URL Source: https://developer.apple.com/documentation/appstoreservernotifications/app-store-server-notifications-v2 Specify your secure server's URL in App Store Connect to receive version 2 notifications. The App Store uses POST requests to send notifications to this endpoint. ```HTTP POST https://example.com/v2 ``` -------------------------------- ### priceIncreaseStatus Field Source: https://developer.apple.com/documentation/appstoreservernotifications/priceincreasestatus This field indicates the status of a price increase for an auto-renewable subscription. Use this to determine if customer consent is required and if it has been provided. ```plaintext int32 priceIncreaseStatus ``` -------------------------------- ### Successful Response Code for Server Notifications Source: https://developer.apple.com/documentation/appstoreservernotifications/app-store-server-notifications-v2 When your server successfully receives and processes a version 2 notification, respond to the App Store with an HTTP status code in the 200-206 range. This indicates the notification was received. ```HTTP 200 OK ``` -------------------------------- ### advancedCommerceOfferPeriod Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceofferperiod Defines the advancedCommerceOfferPeriod type as a string. This type is used to specify the duration of a subscription offer. ```typescript string advancedCommerceOfferPeriod ``` -------------------------------- ### Define consumptionRequestReason Type Source: https://developer.apple.com/documentation/appstoreservernotifications/consumptionrequestreason Defines the consumptionRequestReason as a string type. This is used in App Store Server Notifications version 2.11 and later. ```swift string consumptionRequestReason ``` -------------------------------- ### Define advancedCommerceTaxCode Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercetaxcode This snippet shows the definition of the advancedCommerceTaxCode type, which is a string. It is used in App Store Server Notifications version 2.14 and later. ```typescript string advancedCommerceTaxCode ``` -------------------------------- ### advancedCommerceRefundReason Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerefundreason The advancedCommerceRefundReason is a string type representing the reason for a refund. It is available in App Store Server Notifications version 2.14 and later. ```APIDOC ## Type: advancedCommerceRefundReason App Store Server Notifications 2.14+ ```string advancedCommerceRefundReason ``` ### Possible Values - `UNINTENDED_PURCHASE` - `FULFILLMENT_ISSUE` - `UNSATISFIED_WITH_PURCHASE` - `LEGAL` - `OTHER` - `MODIFY_ITEMS_REFUND` - `SIMULATE_REFUND_DECLINE` ``` -------------------------------- ### webOrderLineItemId Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/weborderlineitemid Defines the webOrderLineItemId as a string type in App Store Server Notifications 2.0+. ```swift string webOrderLineItemId ``` -------------------------------- ### productId Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/productid The productId is a string representing the unique identifier for an In-App Purchase. This is used in App Store Server Notifications version 2.0 and later. ```string string productId ``` -------------------------------- ### advancedCommerceReason Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercereason Defines the advancedCommerceReason type as a string. This type is used in App Store Server Notifications version 2.14+. ```swift string advancedCommerceReason ``` -------------------------------- ### renewalPrice Source: https://developer.apple.com/documentation/appstoreservernotifications/renewalprice The renewal price, in milliunits, of the auto-renewable subscription that renews at the next billing period. This value reflects any discounts if an offer is included in the next billing period. One unit of the currency equals 1000 milliunits. ```APIDOC ## renewalPrice ### Description The renewal price, in milliunits, of the auto-renewable subscription that renews at the next billing period. ### Type `int64` ### Discussion This value represents the renewal price, in milliunits of the `currency`, of the auto-renewable subscription. One unit of the currency equals 1000 milliunits. If the next billing period includes an offer specified by the `offerIdentifier`, the `renewalPrice` value reflects the discount. To determine the storefront, use the `storefront` value in the transaction. Don’t use the `currency` value to infer the storefront. ``` -------------------------------- ### Revocation Reason Type (int32) Source: https://developer.apple.com/documentation/appstoreservernotifications/revocationreason This integer type represents the reason for a revoked or refunded transaction. Use this to understand the context of a transaction's revocation. ```plaintext int32 revocationReason ``` -------------------------------- ### Define advancedCommercePeriod Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceperiod Defines the advancedCommercePeriod type as a string. This type is used to represent subscription offer periods. ```typescript string advancedCommercePeriod ``` -------------------------------- ### bundleId Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/bundleid Defines the bundleId as a string type for App Store Server Notifications 2.0+. ```plaintext string bundleId ``` -------------------------------- ### commitmentAutoRenewProductId Source: https://developer.apple.com/documentation/appstoreservernotifications/commitmentautorenewproductid The product identifier for the auto-renewing subscription that the customer committed to. ```APIDOC ## commitmentAutoRenewProductId ### Description Represents the product identifier for the auto-renewing subscription that the customer committed to. ### Type `string` ### Version App Store Server Notifications 2.21+ ``` -------------------------------- ### advancedCommerceTransactionItem Object Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercetransactionitem Defines the structure of the advancedCommerceTransactionItem object. Available in App Store Server Notifications version 2.14 and later. ```json object advancedCommerceTransactionItem ``` -------------------------------- ### Declare advancedCommerceTaxRate Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercetaxrate This snippet shows the declaration of the advancedCommerceTaxRate type. It is a string type used in App Store Server Notifications version 2.14 and later. ```typescript string advancedCommerceTaxRate ``` -------------------------------- ### isUpgraded Field Type Source: https://developer.apple.com/documentation/appstoreservernotifications/isupgraded This field indicates whether the customer upgraded to another subscription. It appears only when the value is true. ```json boolean isUpgraded ``` -------------------------------- ### data Object Source: https://developer.apple.com/documentation/appstoreservernotifications/data The payload data that contains app metadata and the signed renewal and transaction information. This object is part of the responseBodyV2DecodedPayload and is present for various in-app purchase related notification types. ```APIDOC ## data Object ### Description The payload data that contains app metadata and the signed renewal and transaction information. This object is part of the `responseBodyV2DecodedPayload` and is present for various in-app purchase related notification types, except for specific `RENEWAL_EXTENSION` and `EXTERNAL_PURCHASE_TOKEN` notification types. ### Properties - `appAppleId` (string) - The unique identifier of the app that the notification applies to. This property is available for apps that users download from the App Store. It isn’t present in the sandbox environment. - `bundleId` (string) - The bundle identifier of the app. - `bundleVersion` (string) - The version of the build that identifies an iteration of the bundle. - `consumptionRequestReason` (string) - The reason the customer requested the refund. This field appears only for `CONSUMPTION_REQUEST` notifications. - `environment` (string) - The server environment that the notification applies to, either `sandbox` or `production`. - `signedRenewalInfo` (JWSRenewalInfo) - Subscription renewal information signed by the App Store, in JSON Web Signature (JWS) format. This field appears only for notifications that apply to auto-renewable subscriptions. - `signedTransactionInfo` (JWSTransaction) - Transaction information signed by the App Store, in JSON Web Signature (JWS) format. - `status` (string) - The status of an auto-renewable subscription as of the `signedDate` in the `responseBodyV2DecodedPayload`. This field appears only for notifications sent for auto-renewable subscriptions. ``` -------------------------------- ### RenewalCommitmentInfo Object Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/renewalcommitmentinfo Defines the structure of the RenewalCommitmentInfo object. This object is part of App Store Server Notifications version 2.21+. ```json object RenewalCommitmentInfo ``` -------------------------------- ### isUpgraded Source: https://developer.apple.com/documentation/appstoreservernotifications/isupgraded A Boolean value that indicates whether the customer upgraded to another subscription. This value appears in the transaction only when the value is true. ```APIDOC ## isUpgraded ### Description A Boolean value that indicates whether the customer upgraded to another subscription. ### Type boolean ### App Store Server Notifications Version 2.0+ ### Discussion If `isUpgraded` is `true`, the customer has upgraded the subscription represented by this transaction to another subscription. To determine the service that the customer is entitled to, look for another transaction that has a subscription with a higher level of service. ``` -------------------------------- ### Unsuccessful Response Code for Server Notifications Source: https://developer.apple.com/documentation/appstoreservernotifications/app-store-server-notifications-v2 If your server fails to process a version 2 notification, send an HTTP 5xx or 4xx status code. This prompts the App Store to retry sending the notification. ```HTTP responseBodyV2 ``` -------------------------------- ### advancedCommerceOfferPeriod Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceofferperiod The advancedCommerceOfferPeriod type represents the duration of a subscription offer period. It is a string that accepts specific predefined values. ```APIDOC ## Type: advancedCommerceOfferPeriod App Store Server Notifications 2.14+ ``` string advancedCommerceOfferPeriod ``` ### Possible Values - `P3D`: 3 days - `P1W`: 1 week - `P2W`: 2 weeks - `P1M`: 1 month - `P2M`: 2 months - `P3M`: 3 months - `P6M`: 6 months - `P9M`: 9 months - `P1Y`: 1 year ``` -------------------------------- ### autoRenewStatus Type Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/autorenewstatus Defines the autoRenewStatus as a 32-bit integer. This type is available in App Store Server Notifications version 2.0 and later. ```plaintext int32 autoRenewStatus ``` -------------------------------- ### JWSAppTransaction Type Source: https://developer.apple.com/documentation/appstoreservernotifications/appdata Represents app transaction information signed by the App Store in JSON Web Signature (JWS) Compact Serialization format. ```APIDOC ## Type: JWSAppTransaction App transaction information signed by the App Store, in JSON Web Signature (JWS) Compact Serialization format. ``` -------------------------------- ### totalBillingPeriods Field Type Source: https://developer.apple.com/documentation/appstoreservernotifications/totalbillingperiods Defines the data type for the totalBillingPeriods field. Use this to understand the expected value format. ```plaintext int32 totalBillingPeriods ``` -------------------------------- ### Define appAppleId Type Source: https://developer.apple.com/documentation/appstoreservernotifications/appappleid Defines the appAppleId as a 64-bit integer. This type is used in App Store Server Notifications version 2.0 and later. ```plaintext int64 appAppleId ``` -------------------------------- ### originalPurchaseDate Field Type Source: https://developer.apple.com/documentation/appstoreservernotifications/originalpurchasedate Represents the purchase date of the transaction associated with the original transaction identifier. The value is a UNIX timestamp in milliseconds. ```text timestamp originalPurchaseDate ``` -------------------------------- ### advancedCommercePrice Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommerceprice Represents a price value as a 64-bit integer. This type is used in App Store Server Notifications version 2.14 and later. ```plaintext int64 advancedCommercePrice ``` -------------------------------- ### RenewalCommitmentInfo Object Source: https://developer.apple.com/documentation/appstoreservernotifications/renewalcommitmentinfo The RenewalCommitmentInfo object contains details about a subscription's renewal commitment. ```APIDOC ## RenewalCommitmentInfo App Store Server Notifications 2.21+ ```object RenewalCommitmentInfo ``` ### Properties * `commitmentAutoRenewProductId` (string) - The product ID for the auto-renewing commitment. * `commitmentAutoRenewStatus` (string) - The status of the auto-renewing commitment. * `commitmentRenewalBillingPlanType` (string) - The billing plan type for the renewal commitment. * `commitmentRenewalDate` (string) - The date of the renewal commitment. * `commitmentRenewalPrice` (string) - The price of the renewal commitment. ``` -------------------------------- ### inAppOwnershipType Field Definition Source: https://developer.apple.com/documentation/appstoreservernotifications/inappownershiptype Defines the inAppOwnershipType as a string for App Store Server Notifications version 2.0 and later. ```plaintext string inAppOwnershipType ``` -------------------------------- ### advancedCommercePriceIncreaseInfoPrice Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercepriceincreaseinfoprice Represents the price increase information for a product. This is an integer type available in App Store Server Notifications version 2.20 and later. ```plaintext int64 advancedCommercePriceIncreaseInfoPrice ``` -------------------------------- ### revocationDate Field Source: https://developer.apple.com/documentation/appstoreservernotifications/revocationdate Represents the UNIX time in milliseconds when the App Store refunded or revoked a transaction from Family Sharing. Available in App Store Server Notifications 2.0+. ```text timestamp revocationDate ``` -------------------------------- ### commitmentRenewalBillingPlanType String Type Source: https://developer.apple.com/documentation/appstoreservernotifications/commitmentrenewalbillingplantype Defines the commitmentRenewalBillingPlanType as a string. This type is available in App Store Server Notifications version 2.21 and later. ```swift string commitmentRenewalBillingPlanType ``` -------------------------------- ### renewalDate Source: https://developer.apple.com/documentation/appstoreservernotifications/renewaldate The UNIX time, in milliseconds, when the most recent auto-renewable subscription purchase expires. This value is present for auto-renewable subscriptions, including expired ones, and represents the expiration date of the latest purchase, including renewals. For successfully renewed subscriptions, it signifies the next renewal date. ```APIDOC ## renewalDate ### Description The UNIX time, in milliseconds, when the most recent auto-renewable subscription purchase expires. ### Type `timestamp` ### App Store Server Notifications Version 2.8+ ### Example ``` 1678886400000 ``` ``` -------------------------------- ### failedCount Source: https://developer.apple.com/documentation/appstoreservernotifications/failedcount The count of subscriptions that fail to receive a subscription-renewal-date extension. Available in App Store Server Notifications 2.7+. ```APIDOC ## failedCount ### Description The count of subscriptions that fail to receive a subscription-renewal-date extension. ### Type `int64` ### Version App Store Server Notifications 2.7+ ``` -------------------------------- ### advancedCommerceRefundDate Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerefunddate This snippet shows the basic structure of the advancedCommerceRefundDate data type. It is a timestamp used in App Store Server Notifications version 2.14 and later. ```text timestamp advancedCommerceRefundDate ``` -------------------------------- ### commitmentAutoRenewProductId Field Source: https://developer.apple.com/documentation/appstoreservernotifications/commitmentautorenewproductid Represents the product ID for auto-renewable subscriptions with a commitment. This field is available in App Store Server Notifications version 2.21+. ```string string commitmentAutoRenewProductId ``` -------------------------------- ### Define storefrontCountryCode Type Source: https://developer.apple.com/documentation/appstoreservernotifications/storefrontcountrycode This snippet defines the storefrontCountryCode type, which is a string representing a three-letter country code for an App Store storefront. It is used in App Store Server Notifications version 2.7 and later. ```plaintext string storefrontCountryCode ``` -------------------------------- ### advancedCommerceRefundAmount Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerefundamount This snippet defines the advancedCommerceRefundAmount data type. It is used in App Store Server Notifications version 2.14 and later and is of type int64. ```plaintext int64 advancedCommerceRefundAmount ``` -------------------------------- ### autoRenewProductId Source: https://developer.apple.com/documentation/appstoreservernotifications/autorenewproductid The identifier of the product that renews at the next billing period. ```APIDOC ## autoRenewProductId ### Description The identifier of the product that renews at the next billing period. ### Type string ``` -------------------------------- ### commitmentAutoRenewStatus Field Type Source: https://developer.apple.com/documentation/appstoreservernotifications/commitmentautorenewstatus Defines the data type for the commitmentAutoRenewStatus field. Use this to understand how the status is represented. ```plaintext int32 commitmentAutoRenewStatus ``` -------------------------------- ### priceIncreaseStatus Enum Source: https://developer.apple.com/documentation/appstoreservernotifications/priceincreasestatus The priceIncreaseStatus indicates whether an auto-renewable subscription is subject to a price increase. This is available for App Store Server Notifications 2.0 and later. ```APIDOC ## priceIncreaseStatus ### Description The status that indicates whether an auto-renewable subscription is subject to a price increase. ### Type `int32` ### Possible Values * `0`: The customer hasn’t yet responded to an auto-renewable subscription price increase that requires customer consent. * `1`: The customer consented to an auto-renewable subscription price increase that requires customer consent, or the App Store has notified the customer of an auto-renewable subscription price increase that doesn’t require consent. ``` -------------------------------- ### renewalBillingPlanType - String Type Source: https://developer.apple.com/documentation/appstoreservernotifications/renewalbillingplantype Defines the renewalBillingPlanType as a string. This type is available in App Store Server Notifications version 2.21 and later. ```typescript string renewalBillingPlanType ``` -------------------------------- ### commitmentRenewalBillingPlanType Source: https://developer.apple.com/documentation/appstoreservernotifications/commitmentrenewalbillingplantype Defines the billing plan type for subscription renewals with commitments. Available for App Store Server Notifications version 2.21 and later. ```APIDOC ## commitmentRenewalBillingPlanType ### Description This type represents the billing plan for a subscription that has a commitment. ### Type ``` string commitmentRenewalBillingPlanType ``` ### Possible Values * `BILLED_UPFRONT`: The subscription is billed for the entire commitment period upfront. * `MONTHLY`: The subscription is billed on a monthly basis, even with a commitment. ### See Also * `TransactionCommitmentInfo` (object) * `RenewalCommitmentInfo` (object) ``` -------------------------------- ### revocationReason Type Source: https://developer.apple.com/documentation/appstoreservernotifications/revocationreason The revocationReason is an integer that specifies the reason for a revoked or refunded transaction. This is available in App Store Server Notifications version 2.0 and later. ```APIDOC ## Type: revocationReason The reason for a revoked or refunded transaction. App Store Server Notifications 2.0+ ```int32 revocationReason ``` ### Possible Values * **`0`**: The App Store refunded the transaction on behalf of the customer for other reasons, for example, an accidental purchase. * **`1`**: The App Store refunded the transaction on behalf of the customer due to an actual or perceived issue within your app. ### Discussion For Family Sharing transactions, the revocation reason value is `0` if the customer leaves the family group or the owner stops sharing. If the purchaser of a Family Sharing transaction receives a refund, the revocation reason for Family Sharing transactions matches the value of the purchaser’s revocation reason. ``` -------------------------------- ### isInBillingRetryPeriod Field Type Source: https://developer.apple.com/documentation/appstoreservernotifications/isinbillingretryperiod This field is a boolean value. It is available in App Store Server Notifications version 2.0 and later. ```json boolean isInBillingRetryPeriod ``` -------------------------------- ### failedCount Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/failedcount Represents the count of subscriptions that failed to receive a subscription-renewal-date extension. Available in App Store Server Notifications 2.7+. ```plaintext int64 failedCount ``` -------------------------------- ### advancedCommerceReason Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercereason The advancedCommerceReason type is a string used in App Store Server Notifications to specify the reason for an advanced commerce transaction. This type is available in version 2.14+. ```APIDOC ## Type: advancedCommerceReason App Store Server Notifications 2.14+ ``` string advancedCommerceReason ``` ### Possible Values * `ACQUISITION` * `WIN_BACK` * `RETENTION` ``` -------------------------------- ### billingPeriodNumber Field Type Source: https://developer.apple.com/documentation/appstoreservernotifications/billingperiodnumber Defines the data type for the billingPeriodNumber field. This field represents the current billing period and is an integer between 1 and 12. ```plaintext int32 billingPeriodNumber ``` -------------------------------- ### advancedCommerceRenewalItems Data Type Source: https://developer.apple.com/documentation/appstoreservernotifications/advancedcommercerenewalitems This snippet shows the definition of the advancedCommerceRenewalItems data type, which is available in App Store Server Notifications version 2.14 and later. It is used to represent renewal items in advanced commerce scenarios. ```json [advancedCommerceRenewalItem] advancedCommerceRenewalItems ``` -------------------------------- ### isInBillingRetryPeriod Source: https://developer.apple.com/documentation/appstoreservernotifications/isinbillingretryperiod A Boolean value that indicates whether the App Store is attempting to automatically renew a subscription that expired due to a billing issue. Available in App Store Server Notifications 2.0+. ```APIDOC ## isInBillingRetryPeriod ### Description A Boolean value that indicates whether the App Store is attempting to automatically renew a subscription that expired due to a billing issue. ### Type boolean ### App Store Server Notifications Version 2.0+ ```