You are helping integrate LinkJolt affiliate tracking for an iOS app using Apple In-App Purchases.

## Context
- Platform: Apple IAP (App Store Server Notifications v2)
- Attribution model: Subscription Offer Codes — NOT a web tracking script, NOT an SDK.
- No code change required in the iOS app.

## Setup overview

1. In LinkJolt, open `/merchant/integration/apple-iap` and enter:
   - **Bundle ID** (e.g. `com.example.yourapp`) — required.
   - **App Apple ID** (the numeric App Store ID) — required for Production.
2. Copy the two webhook URLs shown on that page:
   - **Production Server URL** → paste into App Store Connect
   - **Sandbox Server URL** → paste into App Store Connect
3. In App Store Connect → [your app] → **General → App Information** → scroll to **App Store Server Notifications**. For each URL:
   - Click **Set Up URL**
   - Paste the URL
   - Select **Version 2 Notifications** (do NOT pick Version 1 — it's deprecated)
4. In App Store Connect, generate Subscription Offer Codes for your subscription product. Upload the offer identifiers to LinkJolt (`/merchant/campaigns`) and assign each identifier to an affiliate.

## How attribution works

- A user redeems an Offer Code in the iOS App Store.
- Apple fires `SUBSCRIBED` (`notificationType`) with subtype `INITIAL_BUY` or `RESUBSCRIBE` to our webhook. The signed transaction payload contains `offerIdentifier`.
- LinkJolt looks up `offerIdentifier` → affiliate → records the conversion.

## Verification

All notifications are signed JWS. LinkJolt validates every payload against the Apple Root CA - G3 certificate chain.

## Retry schedule (Apple default)

Production: 5 retries at 1h, 12h, 24h, 48h, 72h after failed delivery. Sandbox: no retries.

## What this integration does NOT track

- Users downloading the app from a web affiliate link and subscribing normally (no Offer Code). That's web-to-app attribution which Apple does not support without SKAdNetwork / MMP.
- Non-subscription IAPs (one-time consumables). Offer Codes only work on auto-renewing subscriptions.
