Skip to main content
This article describes how to set up your iOS Payment Links SDK project. To allow players to return to your game after completing checkout in an external browser, such as Safari, you need to set up a Universal Link. Then, in Xcode:
  1. Open your project and select your main project file.
  2. Go to the Signing & Capabilities tab.
  3. Click + Capability and search for Associated Domains. If you don’t see it, ensure you’re using a real device configuration.
  4. Under Domains, add:
    applinks:{YOUR_DOMAIN}
    
    For example:
    applinks:my-best-game.com
    

Step 2 | Set up a URL scheme

URL schemes allow your app to handle redirects from an in-app browser or embedded checkout flow. To set up a URL scheme in Xcode:
  1. Open your project, select your target, and navigate to the info.plist file.
  2. In the Information Property List, expand the URL types section. If it doesn’t exist, create it by clicking +.
  3. Add an Item section if it doesn’t already exist, and set it to the following:
    • URL identifier: action
    • URL Schemes: acnative-$(PRODUCT_BUNDLE_IDENTIFIER)
    URL Scheme
After a player completes a purchase or exits the checkout in Safari, they’ll be redirected back to your app via a deeplink. Your app must capture this URL and forward it to the Appcharge SDK to finalize the transaction. If your app handles deeplinks, make sure to call the Bridge handleDeeplink method in your existing handlers to pass the URL to the Appcharge SDK. If your app doesn’t already handle deeplinks, then add the following methods in your SceneDelegate:
import ACPaymentLinks

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    guard let url = URLContexts.first?.url else { return }
    ACBridgeAPI.handleDeepLink(url)
}
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    if userActivity.activityType == NSUserActivityTypeBrowsingWeb,
       let url = userActivity.webpageURL {
        ACBridgeAPI.handleDeepLink(url)
    }
}
If you don’t have a SceneDelegate, use the AppDelegate:
import ACPaymentLinks

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    ACBridgeAPI.handleDeepLink(url)
    return false
}