Enable Buy Button via link-outs to Web Shop
Enable users to purchase in-game items in your Web Shop. Launch the web payment UI for a specific item directly from the game. This approach creates a seamless experience when users just tap the Buy Button in the game and complete the transaction with no extra steps. It significantly simplifies and speeds up the purchase flow.
Both the Web Shop-based integration and the Xsolla Mobile SDK offer a wide range of payment methods — including Apple Pay, which provides users with effortless and familiar checkout experience.
How to choose between Web Shop-based integration and Xsolla Mobile SDK
Web Shop opens the payment UI for a specific item in the browser, based on your existing Web Shop configuration. The Xsolla Mobile SDK triggers a payment flow that also opens the checkout in the browser, but gives you more control over how the flow is initiated and what parameters are passed.
For most use cases, we strongly recommend using the Web Shop-based integration. It offers:
- Broader game commerce capabilities
Web Shop includes a wide range of built-in game commerce features such as discounts, bonuses, promo codes, personalized offers, free items, and more. These features can be configured in Publisher Account and are automatically applied — without requiring additional client-side logic or UI development.
- Faster implementation
If you already have a Web Shop, this is the simplest option. Just add a link in your game that opens the Web Shop with the necessary parameters.
Since Web Shop is not part of your app’s codebase, it doesn’t require updates through the App Store. This also makes it easier to expand into new countries as they become available.
- Full compliance with Apple’s updated guidelines
Web Shop is designed to meet Apple’s external purchase flow requirements by launching in a browser, outside the app.
The Xsolla Mobile SDK offers more flexibility but requires additional development effort. Use the SDK if your integration requires:
- Advanced authentication methods beyond those supported by Web Shop.
- Passing additional parameters (e.g., current game state, or session metadata like level, platform, and trigger event) — useful for game-specific scenarios that are not applicable to Web Shop.
- Fully customizable purchase experience, including complete control over the payment UI and transaction logic.
When using the SDK, game commerce capabilities are also available via API, but the developer is responsible for implementing all business logic, offer calculations, and the app's UI.
How it works
- The user opens the app on iOS.
- The user taps the Buy Button next to the desired item.
- The app launches a browser with a Web Shop link that includes the
user-id
,sku
andredirect-url
parameters. - Web Shop automatically authenticates the user and displays the payment UI for the selected item.
- The user chooses a payment method and completes the purchase.
- The app receives the purchase confirmation via a webhook and delivers the purchased item.
- The user is automatically redirected back to the game via a deep link.
How to get it
Add logic to your iOS app to show the button with purchase link only to users in the United States.
To do this, add the button to your game and detect the iOS storefront.
If the returned storefront country is the United States (“USA”
), the button with the purchase link should be displayed to the user.
Adding button with purchase link to your game
Before following these instructions, make sure you created an item catalog, set up user authentication, and published Web Shop.
Open the main page of your project in Publisher Account and select the Enable Buy Button via link-outs to Web Shop focus to view related settings, or refer to the relevant sections of Web Shop documentation for detailed information.
To implement this scenario, add a button in your game with a link in the following format:
https://yourwebshop.xsolla.site/?user-id=<USER_ID>&purchase-sku=<SKU>&redirect-url=<RETURN_TO_GAME_URL>
, where:
yourwebshop.xsolla.site
is a link to your Web Shop site.user-id
is the user ID in your system.purchase-sku
is the SKU of the desired item from the Web Shop catalog.redirect-url
is the URL the user is redirected to after a successful payment. Use any valid URL, such as a deep link (e.g.,mygame://
) that returns the user to the game.
When the user follows this link, they are automatically authorized on Web Shop, and the payment UI for the selected item is displayed.
To find the item SKU (using a virtual item as an example):
- Open your project in Publisher Account, go to Store > Virtual Items section, and click Configure.
- Navigate to the group of items where the item is located.
- Copy the SKU from the line of the specific item below its name.
Detecting iOS storefront
To determine whether you can show Buy Button, retrieve the Storefront information at the initial app launch after installation, or on subsequent launches if needed. The storefront may already be available as part of your existing StoreKit implementation or provided by your Mobile Measurement Partner (MMP). If the storefront’s country code is “USA”
, enable the functionality to display the Buy Button.
Ensure your implementation is flexible enough to support additional countries in the future, as regulatory conditions and platform policies may change.
Note that the storefront value on the device does not change unless the user explicitly updates their Apple ID region in system settings.
- swift
1let countryCode = await Storefront.current?.countryCode
2let showBuyButton = countryCode == "USA"
Additional features
You can provide users with quick access to the Web Shop features by using query parameters in website links; for example, when promoting a page on social media and in mass mailings. Such links let you automatically authenticate users on your website or redirect them to a specific item when they open the site.
Using query parameters, you can configure the following actions that will be performed when a link is clicked:
- Automatic authentication using the user ID.
- Automatic authentication using the deep link.
- Redirecting to the card of a specific item. If the user is already logged in to the site, they will proceed to purchase the item.
- Automatically applying a promo code to the catalog or redeeming a coupon with a reward.
You can use multiple parameters in a single link, thus combining multiple features.
Setting up authorization via user ID
Use a link with a query parameter for automatic user authorization when navigating to the site. This option is suitable if your site is set up for authorization via User ID.
To automatically authenticate a user via User ID:
- Copy the link to the site.
- At the end of the link, add
?user-id=<UserID>
, where<UserID>
is the user ID to whom you are sending the link.
- Example:
https://webshop-external-demo.xsolla.site/?user-id=12345
- Send individual links to users.
After the user clicks on the link, they will be directed to the site and automatically authenticated.
Setting up authorization via deep link
Use a link with a query parameter for automatic user authorization when navigating to the site. This option is suitable if your site is set up for authentication via a deep link.
To automatically authenticate a user via a deep link:
- Copy the link to the site.
- At the end of the link, add
?deeplink=true
.
- Example:
https://webshop-external-demo.xsolla.site/?deeplink=true
- Share the link in public materials or send individual links to users.
Setting up focus on a specific item
Use a link with a query parameter to redirect the user directly to the desired item when opening the site. For an unauthorized user, a card with information about the item specified in the query parameter will be opened. If the user is already logged in to the site, upon clicking on the link, the payment interface for purchasing the item will open for them.
To direct a user to a specified item:
- Copy the link to the site.
- At the end of the link, add
?purchase-sku=<item SKU>
, where<item SKU>
is the SKU of the desired item.
- To find the item SKU (using a virtual item as an example):
- Open your project in Publisher Account, go to Store > Virtual Items section, and click Configure.
- Navigate to the group where the item is located.
- Copy the SKU from the line of the specific item below its name.
- Example:
https://webshop-external-demo.xsolla.site/?purchase-sku=giant
- Share the link in public materials or send individual links to users.
After the user clicks on the link, they will be directed to the website where the item card with detailed information about the item is displayed, or to the payment interface for purchasing the item. The resulting message depends on whether the user is authenticated on the site.
Setting up application of promo code or coupon
Use a link with a query parameter to apply a promo code or coupon by the user. The code can be applied automatically after navigating to the website or by clicking the Redeem code button. You can also add parameters to the link for one of the authentication methods. To use a link with a code parameter, set up promo codes and coupons in the project.
To apply the code:
- Copy the link to the site.
- At the end of the link, add one of the following query parameters:
?redeem-code=<promo code>
— for automatic code redemption?insert-code=<promo code>
— for redemption upon button click
- Instead of
<promo code>
, specify the promo code or coupon that was generated in the Publisher Account or that you have set. - Example:
https://xsolla.webshop.com/?redeem-code=promo777
- If you want the user to be automatically authenticated on the site, add one of the authentication parameters before the code parameter in the link:
?user-id=<UserID>
or?deeplink=true
. - Example:
https://webshop-external-demo.xsolla.site/?user-id=12345&redeem-code=TESTCOUPON
- Share the link in public materials or send individual links to users.
After the authenticated user clicks on the link, they will be directed to the site, where the code will be activated automatically or the user will have the option to manually redeem the code.
Supported URL parameters
Parameter | Description |
---|---|
promo-code | Applies a promo code with a discount or bonus. |
coupon-code | Redeems a reward coupon. |
user-id | User ID. |
purchase-sku | The SKU of the desired item from your Web Shop catalog. |
redirect-url | The URL the user is redirected to after a successful payment. It can be any valid URL, such as a deep link (e.g., mygame:// ) that returns the user to the game. |
Advanced analytics in AppsFlyer
When you use link-outs to allow users to make purchases in the web payment UI directly from the game, you can still track their purchases and measure lifetime value (LTV) with a Mobile Measurement Partner (MMP), such as AppsFlyer. Xsolla supports two integration types to enable seamless tracking of user acquisition, retargeting, and purchase activity across both mobile and web platforms.
Choose a type that best fits your setup to keep full visibility into your campaigns and revenue:
Integration type | How it works |
---|---|
Mobile app S2S integration — allows completion of full LTV and return on advertising spend (ROAS) measurement for the purchases within the application and on Web Shop. |
|
Web SDK integration — allows you to measure and evaluate the effectiveness of user acquisition and retargeting campaigns for attracting traffic to the Web Shop. |
|
Found a typo or other text error? Select the text and press Ctrl+Enter.