The Facebook SDK integrates with StoreKit to automatically detect and log in-app purchase events. No extra code is required once the SDK is initialised.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/facebook/facebook-ios-sdk/llms.txt
Use this file to discover all available pages before exploring further.
What is automatically tracked
The SDK’s payment observer (FBSDKPaymentObserver) monitors the StoreKit transaction queue and logs events when purchases complete:
| Scenario | Event logged |
|---|---|
| Successful purchase (consumable or non-consumable) | fb_mobile_purchase |
| Failed purchase | fb_mobile_purchase_failed |
| Restored purchase | fb_mobile_purchase_restored |
| Subscription initiated checkout | SubscriptionInitiatedCheckout |
| Subscription failed | SubscriptionFailed |
| Subscription restored | SubscriptionRestore |
| Parameter | Raw key |
|---|---|
| Product type | fb_iap_product_type |
| Transaction ID | fb_transaction_id |
| Transaction date | fb_transaction_date |
| Subscription period | fb_iap_subs_period |
| Whether it is a start trial | fb_iap_is_start_trial |
| Whether it has a free trial | fb_iap_has_free_trial |
| Trial period | fb_iap_trial_period |
| Trial price | fb_iap_trial_price |
| Currency | fb_currency |
StoreKit Original API
Automatic tracking usesSKPaymentQueue to observe completed, failed, and restored transactions. It activates when FacebookAutoLogAppEventsEnabled is true (the default) in your Info.plist.
StoreKit 2
On iOS 15 and later, the SDK also listens for new transactions via the asyncTransaction.updates sequence, which covers StoreKit 2 purchases. This happens automatically when the app becomes active.
StoreKit 2 automatic tracking requires iOS 15.0 or later. On earlier OS versions the SDK falls back to the Original API observer.
Disabling automatic IAP tracking
To opt out of automatic purchase tracking, setFacebookAutoLogAppEventsEnabled to false in your Info.plist:
Manual purchase logging
If you have disabled auto-logging or need to supplement automatic events, use thelogPurchase method: