Skip to main content
Supported on: iOS SDK 1.0.61+
The AppDNA billing module provides a unified interface for in-app purchases, subscription management, and entitlement checking. It supports StoreKit 2 natively, with optional integrations for RevenueCat and Adapty.

Configuration

Set the billing provider when configuring the SDK:

BillingProvider Options

You must set the billingProvider in AppDNAOptions before accessing AppDNA.billing. If set to .none, billing module methods will throw errors.

Module Access

Access the billing module through the AppDNA.billing property:

Get Products

Fetch product information from the App Store:

ProductInfo

Purchase a Product

Initiate a purchase:
The optional options parameter accepts a PurchaseOptions value for configuring promotional offers or other purchase modifiers.

TransactionInfo

Server-side receipt verification is performed automatically by the SDK. You do not need to send receipts to your own server for validation.

Restore Purchases

Restore previously purchased products (e.g., after a device change or reinstall):
Returns an array of String product identifiers that were restored.

Entitlements

Retrieve the current user’s entitlements:

Entitlement

Check Active Subscription

Quickly check if the user has any active subscription:

Listen for Entitlement Changes

Register a callback to be notified when entitlements change (e.g., subscription renewal, expiration, or new purchase):

AppDNABillingDelegate

All 4 methods on this delegate fire from the active billing bridge (StoreKit2Bridge, RevenueCatBridge, or AdaptyBridge). Register via AppDNA.billingDelegate = yourHandler.
  • onPurchaseCompleted and onPurchaseFailed fire for every purchase regardless of entry point — paywall-driven OR direct AppDNA.billing.purchase(...) calls.
  • onRestoreCompleted fires after every successful restore.
  • onEntitlementsChanged fires whenever entitlements change (also broadcast via NotificationCenter).
Overlap with AppDNAPaywallDelegate: when a purchase comes from a paywall, both AppDNAPaywallDelegate.onPaywallPurchaseCompleted AND AppDNABillingDelegate.onPurchaseCompleted fire. Each represents a different layer (paywall lifecycle vs platform billing). Pick one as your source of truth for your analytics — they will not double-count if you only listen on one. For more granular control, implement the AppDNABillingDelegate protocol:

Example Implementation

Auto-Tracked Events

The SDK automatically tracks the following billing-related events:
These events include the product identifier and relevant metadata. They are tracked regardless of whether you implement AppDNABillingDelegate.

Full Example