Getting Ready for Production
Prepare your Koard integration to move beyond the Sandbox by configuring Xcode schemes, build configurations, and API keys for both development and production.
What You Learn
In this guide, you'll learn how to:
- Create separate build configurations and schemes in Xcode
- Inject environment-specific Koard API keys and endpoints
- Automate build-time switching between Sandbox and production settings
- Validate your production readiness checklist before submitting to the App Store
Prerequisites
Before you begin, ensure you have:
- Koard API keys for both Sandbox and production
- Info.plist or
.xcconfigaccess to store environment values - Xcode project admin access to edit schemes and build settings
- Dedicated test devices with Sandbox Apple Accounts for final verification
1. Duplicate Build Configurations
- In Xcode, select your project in the Project Navigator.
- Under PROJECT → Info, duplicate your existing
DebugandReleaseconfigurations. Name the copiesDebug-ProdandRelease-Prod. - Point the production build configurations to
.xcconfigfiles (optional but recommended) such asKoard-Dev.xcconfigandKoard-Prod.xcconfig.
Koard-Dev.xcconfig
KOARD_API_BASE_URL = https://sandbox-api.koard.com
KOARD_API_KEY = ${KoardSandboxAPIKey}
Koard-Prod.xcconfig
KOARD_API_BASE_URL = https://api.koard.com
KOARD_API_KEY = ${KoardProductionAPIKey}
Store sensitive values in your CI/CD environment or use Xcode build setting macros rather than hardcoding secrets in source control.
2. Customize Schemes for Each Environment
Following Apple’s Customizing the Build Schemes guidance, create two top-level schemes:
KoardApp-Devmapped to theDebug/ReleaseconfigurationsKoardApp-Prodmapped to theDebug-Prod/Release-Prodconfigurations
- Open Product → Scheme → Manage Schemes.
- Duplicate your primary scheme and rename it
KoardApp-Prod. - Assign the correct build configuration for each action (Build, Run, Archive, etc.).
- Uncheck Shared while iterating, then re-enable sharing once the configuration is stable so teammates receive the new scheme in source control.
Tip: Keep the production scheme archived with Release-Prod to ensure App Store submissions always use production endpoints and credentials.
3. Switch API Keys at Build Time
Expose the Koard API key and environment to your app using Info.plist substitutions or Swift build flags.
Option A: Info.plist placeholders
- Add keys like
KOARD_API_BASE_URLandKOARD_API_KEYto your Info.plist. - Reference them using
${KOARD_API_BASE_URL}placeholders. - Resolve them in code at runtime:
struct KoardEnvironment {
static let baseURL: URL = {
guard let urlString = Bundle.main.object(forInfoDictionaryKey: "KOARD_API_BASE_URL") as? String,
let url = URL(string: urlString) else {
fatalError("Missing or invalid KOARD_API_BASE_URL")
}
return url
}()
static let apiKey: String = {
guard let key = Bundle.main.object(forInfoDictionaryKey: "KOARD_API_KEY") as? String else {
fatalError("Missing KOARD_API_KEY")
}
return key
}()
}
Option B: Swift compilation conditions
- Add custom flags in Build Settings → Swift Compiler - Custom Flags (e.g.,
-DKOARD_ENV_SANDBOXand-DKOARD_ENV_PRODUCTION). - Use those flags to branch logic:
#if KOARD_ENV_PRODUCTION
let environment: KoardSDKEnvironment = .production
#else
let environment: KoardSDKEnvironment = .sandbox
#endif
Use this approach when you prefer compile-time enforcement of environment differences, such as disabling test-specific UI in production builds.
4. Verify Device and Account Setup
- Install the Dev build on a dedicated test iPhone that remains signed in with your Sandbox Apple Account.
- Install the Prod build on a separate device or reset the test device before signing in with the production Apple ID.
- Run smoke tests for Tap to Pay, refunds, reversals, and settlement cutovers in each environment.
Deploy Deliberately: Never archive or submit to App Store Connect using a Sandbox scheme. Require production code reviews to confirm the KoardApp-Prod scheme was used for the final archive.
5. Pre-launch Checklist
- Xcode schemes map to the correct build configurations.
- Production API keys and endpoints live outside of source control.
- Secrets are injected via CI/CD,
.xcconfig, or secure build settings. - Sandbox and production devices are authenticated with the appropriate Apple IDs.
- A rollback plan is documented in case production rollout needs to be paused.
Next Steps
- Creating a Sandbox Apple Account to keep development builds isolated.
- Running Payments to validate production behavior before launch.
- Coordinate with your Koard partner manager to schedule final Apple certification checks.