Apple App Store Server Notifications

Sending App Store server notifications to RevenueCat

RevenueCat does not require server notifications from the App Store, however doing so can speed up webhook and integration delivery times and reduce lag time for Charts.

Setup Instructions

Apple server-to-server notifications should be set up in App Store Connect with the URL provided in the RevenueCat dashboard.

  1. Navigate to your iOS app under Project settings > Apps in the RevenueCat dashboard.
  2. Scroll to the App Store configuration section, and copy the entire URL provided under Apple Server Notification URL.
12081208
  1. Log in to App Store Connect and select your app.
  2. Under the App Information > App Store Server Notifications section, paste the entire URL from RevenueCat in both the Production Server URL field and the Sandbox Server URL field. You can use either Version 1 or Version 2 notifications.
12521252

Considerations

📘

Only one server notification URL supported

Apple supports separate URLs for production as well as sandbox purchases, but only allows one of each. You should enter the RevenueCat URL for both of these fields if you don't want to receive these notifications on your own server.

If you want to first receive these notifications on your own server for one or both environments, see our guide on forwarding the notifications to RevenueCat below.

👍

Apple S2S notifications update subscriptions for existing users

If RevenueCat receives a notification for a user that doesn't have any purchases in RevenueCat, a 200 code will be sent and the request will be ignored, so the last received notification timestamp won't be updated. Keep this in mind when forwarding events yourself.

Forwarding Apple notifications to RevenueCat

Apple only supports a single server notification URL. If you're already using the notifications on your server, you can still forward the payload to the Apple Server Notification URL provided in the app settings of your RevenueCat project.

Here's how we recommend doing this:

1. Configure your server to receive Apple notifications

First, make sure your server meets the criteria outlined in Apple's Enabling App Store Notifications page or you won't receive notifications.

Then, in your app settings on App Store Connect, enter a subscription status URL that links to your server (see step 4 of the Setup Instructions above).

2. Receive Apple notifications on your server

Apple sends notifications as JSON data via an HTTP POST request to the URL you provided on App Store Connect.

Wherever you handle this POST request in your code, be sure to respond to Apple with a status code. Responding with a 4xx or 5xx status code will permit Apple to retry the post a few more times.

3. Forward Apple notifications to RevenueCat

As soon as your server successfully receives a notification, send the payload to RevenueCat. To do this, make an HTTP POST request to the Apple Server Notification URL provided in the app settings of your RevenueCat project.

The payload should be passed along as-is in the data value of your request. Any manipulation you want to do with the data should happen after forwarding to RevenueCat.

Here's a basic example of these steps using Node, Express, and Axios:

app.post('/subscription-update', (req, res) => {
  // - Let Apple know we received the notification
  res.status(200).json();

  // - Forward the request body as-is to RevenueCat
  axios.post(process.env.REVENUECAT_URL, req.body)
  .then(response => {
    // - Successfully forwarded to RevenueCat
    console.log("Successfully forwarded to RevenueCat", response);
  })
  .catch(error => {
    // - Consider a retry to RevenueCat if there's a network error or status code is 5xx
    // - This is optional as RevenueCat should recheck the receipt within a few hours
    console.error("Failed to send notification to RevenueCat", error);
  });

  // - Anything else you want to do with the request can go here
});

Did this page help you?