Install the native SDK, read customer data and verify Sandbox store delivery.
SDK 0.0.1Updated
1. Install the native SDK
Add the reviewed GrooveGrow Swift Package from packages/ios in Xcode and link the GrooveGrow library. The source package requires Swift 6 and supports iOS 15 and later.
These are repository source packages; public SPM or Maven distribution has not been certified. Verify identity and readHoldings before adding Funnel and store purchases.
2. Issue the current customer's session
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 SDK with the HTTPS API URL, App UUID and Sandbox scope. The server verifies the environment binding. Never ship Console sessions, Server Keys or Supabase secrets in the app.
The SDK keeps the token in memory. Refresh through your authenticated backend. Clear current customer data and authenticate again after 401 / 403.
1import Foundation2import GrooveGrow34func connectGrow(baseURL: URL, projectID: UUID,5 customerToken: String, runToken: String) async throws -> (GrooveGrowClient, GrowFunnelSession) {6 let client = GrooveGrowClient(configuration: try GrowConfiguration(7 baseURL: baseURL,8 scope: GrowScope(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 GrowFunnelViewController(session: flow) on your MainActor UI.16// Set onAuthenticate to obtain the current user's token from your backend.17// Recover: try await client.recoverNativeOrders(using: verifiedHostRelay)18// Explicit store sync: recoverNativeOrders(using: verifiedHostRelay, synchronizeStore: true)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. Bind and verify Sandbox store purchases
In Payment connections, configure and verify the Apple or Google connection for this App and Sandbox, then bind products. Store product identifiers, app identity and connection must agree.
Pass the current runToken to client.funnel and present GrowFunnelViewController. native_purchase queries the real StoreKit product and terms before purchase; use recoverNativeOrders on foreground and synchronizeStore: true for explicit restoration.
Closing a store sheet or receiving a client callback is not delivery proof. Wait for server verification and delivery. Retain the current orderId, receiptId and original command rather than starting another purchase. The authenticated host relay adds its Server Key and uses the current customerToken for double authentication; never ship the key to a device. The server owns Google acknowledge / consume.
5. Acceptance and recovery
Native acceptance criteria
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.
Native acceptance criteria
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.
Record the device or simulator, test App, store account, transaction and server receipts separately. HTTP fixtures, compilation, platform selection and this checklist do not certify the real store chain.