iOS Setup
Configure StoreKit 2 and App Store Connect
Prerequisites
- Apple Developer Program membership ($99/year)
- Xcode 14 or later
- iOS 15.0+ deployment target (for StoreKit 2)
- React Native 0.70+
Step 1: Create Your App in App Store Connect
- Go to App Store Connect
Visit appstoreconnect.apple.com and sign in
- Create a new app
Click "My Apps" → "+" → "New App"
- Fill in app details
Enter name, primary language, bundle ID, and SKU
Step 2: Create In-App Purchase Products
For Subscriptions:
- Navigate to Subscriptions
In your app, go to "Features" → "Subscriptions"
- Create a Subscription Group
Click "+" to create a new subscription group (e.g., "Premium")
- Add subscriptions to the group
Create individual subscription products (monthly, yearly, etc.)
For One-Time Purchases:
- Navigate to In-App Purchases
Go to "Features" → "In-App Purchases"
- Create the product
Select type: Consumable, Non-Consumable, or Non-Renewing Subscription
Product ID Naming Convention
We recommend using a consistent naming convention:
com.yourcompany.appname.product_type_durationExample: com.acme.myapp.premium_monthly
Step 3: Configure Pricing
- Select price tier
Apple uses price tiers. Select the appropriate tier for your product.
- Set availability
Choose which countries/regions the product is available in.
- Configure introductory offers (optional)
Set up free trials, pay-as-you-go, or pay-up-front offers.
Step 4: Set Up Server Notifications
Configure App Store Server Notifications to receive real-time updates about subscription events.
- Go to App Information
In App Store Connect, navigate to "General" → "App Information"
- Find "App Store Server Notifications"
Scroll down to the notifications section
- Enter your webhook URL
https://api.croissantlabs.com/api/webhooks/appleFor self-hosted:
https://your-domain.com/api/webhooks/apple - Select Version 2
Choose "Version 2 Notifications" for the best compatibility
Step 5: Get Your Shared Secret
The shared secret is used to validate receipts server-side.
- Navigate to Shared Secret
In App Store Connect, go to "General" → "Shared Secret"
- Generate or copy your secret
Click "Generate" if you don't have one, or copy the existing secret
- Add to CroissantPay
In your app settings, paste the shared secret in the Apple configuration section
Keep your shared secret secure
Never expose this in your client-side code. Only use it on your server or in CroissantPay configuration.
Step 6: Configure Your Xcode Project
Enable In-App Purchase Capability
- Open your project in Xcode
- Select your target
Click on your app target in the project navigator
- Go to Signing & Capabilities
- Add In-App Purchase capability
Click "+ Capability" and search for "In-App Purchase"
Install the SDK Pod
After installing the npm package, run pod install:
cd ios && pod installTesting In-App Purchases
Sandbox Testing
- Create a Sandbox tester account
In App Store Connect, go to "Users and Access" → "Sandbox Testers"
- Sign out of App Store on device
Settings → iTunes & App Store → Sign Out
- Test purchases in your app
When prompted, sign in with your sandbox account
Sandbox Subscription Durations
In sandbox, subscriptions renew faster for testing:
| Production Duration | Sandbox Duration |
|---|---|
| 1 week | 3 minutes |
| 1 month | 5 minutes |
| 2 months | 10 minutes |
| 3 months | 15 minutes |
| 6 months | 30 minutes |
| 1 year | 1 hour |