> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# App Store Server Notifications

> Point Apple's subscription lifecycle webhooks at Encore so your dashboard can track subscription events and measure offer impact.

## Overview

Encore uses Apple's **App Store Server Notifications** (webhooks) to track subscription lifecycle events: trial starts, renewals, expirations, and refunds. These events power the **Analytics** section of your dashboard and the lift measurement behind the [Reduce Churn](/publishers/use-cases/reduce-churn) use case.

<Warning>
  Without this step, Encore cannot track subscription outcomes. Analytics will show no data.
</Warning>

***

## Choose your integration method

<Tabs>
  <Tab title="Set URL in App Store Connect (Recommended)">
    Point App Store Connect directly at Encore's webhook endpoint. This is the most reliable integration: Encore receives notifications directly from Apple with no intermediary.

    <Steps>
      <Step title="Open App Store Connect">
        Go to [appstoreconnect.apple.com](https://appstoreconnect.apple.com) and navigate to **Your App → General → App Information**.
      </Step>

      <Step title="Find App Store Server Notifications">
        Scroll down to the **App Store Server Notifications** section.
      </Step>

      <Step title="Set Production Server URL">
        Enter the following URL as the **Production Server URL**:

        ```
        https://api.encorekit.com/encore/webhooks/apple
        ```
      </Step>

      <Step title="Set Sandbox Server URL">
        Enter the same URL as the **Sandbox Server URL**:

        ```
        https://api.encorekit.com/encore/webhooks/apple
        ```

        <Tip>
          Setting both Production and Sandbox URLs ensures Encore tracks subscription events during development testing as well as in production.
        </Tip>
      </Step>

      <Step title="Save">
        Click **Save** at the top of the page.
      </Step>

      <Step title="Confirm the webhook is wired">
        Back in the [Encore Dashboard](https://dashboard.encorekit.com), open your app's **Analytics** (or **Integration Progress → Configure Analytics**) view. Once Apple delivers the first notification, the **App Store Server Notifications** status flips to **Connected** and a "last received" timestamp appears.

        To force an event immediately, complete a sandbox purchase (or trigger a renewal or refund) for a test user; the notification typically lands within a minute or two. If nothing appears after a few minutes, re-check the Production and Sandbox URLs in App Store Connect.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Forward from Your Server">
    If you already have an App Store Server Notifications URL configured and don't want to change it, forward each notification to Encore from your existing webhook handler. Your current flow is preserved; you just add a single forwarding call.

    ```javascript theme={null}
    app.post('/webhooks/apple', async (req, res) => {
      // Forward the raw signed payload to Encore
      await fetch('https://api.encorekit.com/encore/webhooks/apple', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(req.body),
      });

      // Continue with your existing logic...
      res.sendStatus(200);
    });
    ```

    <Note>
      **How Encore attributes the notification to your app:** Apple's notification is a signed JWS that Encore verifies against the Apple Root CA - G3 certificate chain, then reads the **bundle ID** embedded in the verified payload. That bundle ID is matched to your registered app, so no shared secret or per-app token is needed. Just forward the raw request body **unmodified** (re-serializing or re-signing it will break verification).

      If you operate multiple apps under one forwarding handler, you can optionally disambiguate by appending your Encore app ID as a query param: `…/encore/webhooks/apple?app=<your-app-id>`.
    </Note>
  </Tab>
</Tabs>

<Note>
  **Using a third-party subscription manager?** Its webhook carries your subscription events instead: see [Superwall](/publishers/ios/guides/managers/superwall/configure-analytics), [RevenueCat](/publishers/ios/guides/managers/revenuecat/configure-analytics), or [Adapty](/publishers/ios/guides/managers/adapty/configure-analytics).
</Note>

***

## Need help?

If you have questions about configuring App Store Server Notifications or the forwarding setup, contact us at [admin@joinyaw.com](mailto:admin@joinyaw.com).
