Connect native Customer identity and UI, and check current store availability.
API v1Updated
1. Install the native SDK
Add the Indiana Swift Package from packages/ios in Xcode and link the Indiana library. Requires Swift 6 and iOS 15 or later.
Source packages are currently available. See version information for distribution and protocol requirements. Connect Customer sessions and readHoldings before adding Funnel.
Your backend verifies the app login, then identifies the customer and issues a short-lived customerToken using a Server Key bound to this App and Sandbox. Do not trust a customer identity supplied by the device.
Configure the HTTPS API URL, App UUID and Sandbox environment. Use only a Customer Token in the app; keep Server Keys and Console sessions in their trusted environments.
The SDK keeps the token in memory. Refresh through your authenticated backend. Clear current customer data and authenticate again after 401 / 403.
1import Foundation2import Indiana34func connectIndiana(baseURL: URL, projectID: UUID,5 customerToken: String, runToken: String) async throws -> (IndianaClient, IndianaFunnelSession) {6 let client = IndianaClient(configuration: try IndianaConfiguration(7 baseURL: baseURL,8 scope: IndianaScope(projectId: projectID, environment: .sandbox)))9 try await client.identify(customerToken: customerToken)10 _ = try await client.readHoldings()11 let flow = try await client.funnel(runToken: runToken)12 return (client, flow)13}1415// Present IndianaFunnelViewController(session: flow) on your MainActor UI.16// Authenticate the Customer before starting the Run; its Customer never changes.17// Set onEvent for authored native events.18// Store purchase/restore requires an explicitly supported server release.19// On sign-out: await client.reset(); dismiss the old Funnel view.
Connection checkpoint
Show connected only after readHoldings succeeds for the current customer. Preserve decimal credits. Cancel host tasks on account changes or navigation, reject late responses and clear the previous snapshot as a whole.
4. Check store availability
Apple/Google purchase, notification and restore are not yet available as a complete integration. Connect Customer sessions and holdings first. Enable store purchases only when a supported release is available.
5. Check results and recover
Integration checks
Scenario
Expected result
First connection
Holdings match Console customer details; invalid, expired and cross-scope sessions are rejected.
Sign-out and account change
Clear old data immediately; old requests cannot overwrite the new customer; authenticate again after restart.
Network loss and timeout
Show a retryable error without success; retry the original request after reconnection.
Purchase, restore and refund
Deliver a real Sandbox transaction once; restoration does not duplicate grants; verified refunds and revocations reach entitlements and history.
Integration checks
First connection
Expected result
Holdings match Console customer details; invalid, expired and cross-scope sessions are rejected.
Sign-out and account change
Expected result
Clear old data immediately; old requests cannot overwrite the new customer; authenticate again after restart.
Network loss and timeout
Expected result
Show a retryable error without success; retry the original request after reconnection.
Purchase, restore and refund
Expected result
Deliver a real Sandbox transaction once; restoration does not duplicate grants; verified refunds and revocations reach entitlements and history.
Once store integration is available, test purchase, restore and refund in Sandbox and verify results through readHoldings and transaction status.