Documentation

In-App Purchasing

Client API

SDK API

In-App Purchasing

Deep link success URL example

Refer to an example of how you can use a small proxy page to deep link to the correct platform for your game.
Read time 1 minuteLast updated 11 hours ago

When you configure a payment provider in the Unity Dashboard, you need to provide a Success Redirect URL. This URL is where you redirect players to after they complete their purchase. You can use Unity's built-in deep linking APIs to handle the Success Redirect URL directly in your application. Unity supports deep linking for iOS, Android, macOS, Universal Windows Platform (UWP), and web platforms. Unity provides two APIs to process deep links:
  • Application.absoluteURL
    : Stores the deep link URL when the application launches from a cold start.
  • Application.deepLinkActivated
    : An event that fires when the application is already running and receives a deep link.
For platform-specific configuration instructions and code examples, refer to the Unity deep linking documentation.

Use a proxy page

If your game ships on multiple platforms, you can use a small proxy page to deep link to the correct platform. Configure this page's URL as your Success Redirect URL. Refer to the following example HTML:
<!doctype html><html><head> <meta charset="utf-8"> <title>Purchase Successful</title> <meta name="viewport" content="width=device-width,initial-scale=1"> <script> (function () { const IOS_DEEP_LINK = "myapp://purchase-complete"; const ANDROID_DEEP_LINK = "intent://purchase-complete#Intent;scheme=myapp;package=com.company.myapp;end"; function isIOS() { return /iPhone|iPad|iPod/i.test(navigator.userAgent); } function isAndroid() { return /Android/i.test(navigator.userAgent); } window.addEventListener("load", () => { let deepLink = null; if (isIOS()) deepLink = IOS_DEEP_LINK; else if (isAndroid()) deepLink = ANDROID_DEEP_LINK; if (deepLink) window.location = deepLink; }); })(); </script></head><body> <h1>Purchase Successful</h1> <p>If the app doesn't open automatically, please open it manually. Your entitlement should appear momentarily.</p></body></html>