Test mode for D2C payments
Understand how Unity IAP simulates purchases in an environment before you connect a payment provider.
Read time 6 minutesLast updated 4 days ago
Test mode is an In-App Purchasing (IAP) setting for each project environment that you can use to test Direct-to-Consumer (D2C) purchases with a simulated payment provider. No money moves through the simulated provider, and you don't need a payment provider account, credentials, or a signed contract to complete a purchase. Test mode is on by default in a new environment, so your purchase flow works before you connect a real payment provider.
Test mode applies to D2C payments only. A player who buys through the native store still pays real money through the Apple App Store or Google Play, whatever the test mode setting is.
What test mode simulates
Unity IAP simulates only the D2C payment and the payment provider. Everything else behaves as it does in production, so a purchase in test mode is a genuine test of your integration and checkout flow rather than a preview of them.
Element | Behavior in test mode |
|---|---|
| D2C payment | Simulated. No card details, no charge, and no money movement. |
| Payment provider | Simulated. You don't connect an account and you don't need credentials. |
| Native store payment | Real. Test mode doesn't apply to the Apple App Store or Google Play, so a native purchase can still take real money. |
| Catalog | Real. Purchases use the listings in your project's Remote Catalog. |
| Order | Real. Unity IAP creates and tracks an order, and you must confirm it like any other order. |
| Entitlement delivery | Real. Your fulfillment method runs, whether that's the SDK, your backend, a webhook, or a Cloud Code module. |
| Purchase events | Real. Your webhook or Cloud Code module receives the same events, including refund and dispute events that you trigger from checkout. |
When test mode is on
You can't simulate purchases while a payment provider is connected. The following rules apply:
- Test mode is on by default in a new environment, and you can turn it off at any time.
- When you connect a payment provider, Unity IAP turns test mode off in the same step and locks the setting. A sandbox connection locks the setting in the same way a live connection does.
- When you remove the last payment provider from an environment, the setting unlocks but test mode stays off.
One setting per environment
Test mode is all or nothing for an environment. While it's on, Unity IAP sends every D2C purchase in that environment to the simulated provider, whatever provider your game or webshop asks for. To run simulated and real payments at the same time, use a separate environment for each.
Turn test mode on or off
Because test mode is on by default, you usually turn it off when the environment is ready to take real payments. You don't need to turn it off before you connect a payment provider, because Unity IAP turns it off as part of that step.
To change the test mode setting, follow these steps:
- In the Unity Dashboard, open In App Purchases > Payment Providers.
- Under Purchase routing, turn Test mode on or off.
While test mode is on, the Test mode setting shows its state and a note that purchases don't use real money. To run a purchase through the simulated provider, refer to Complete a test purchase.
While test mode is off, Unity IAP routes purchases to your connected payment providers based on your routing rules. If the environment has no connected payment provider, or no routing rule matches a player, that player can't complete a purchase through external payments. For more information, refer to Fallbacks if no rule matches a player.
Test mode in the Purchase Options UI
While test mode is on, the simulated provider appears in the Purchase Options UI as Pay with mock, so you can exercise the full purchase flow rather than only the checkout page.
The native store option still appears if Unity IAP has already fetched the product from the native store with a matching catalog listing ID. Unlike the simulated provider, the native option is a real store path: a player who selects it buys through the Apple App Store or Google Play.
If you build your own purchase UI, check the list of eligible payment providers for the mock provider. While test mode is on, the mock provider is the only D2C provider that Unity IAP returns, so you can use its presence to label the flow as simulated and let players and testers know which state the game is in. To get the list in code, call , as described in Build your own purchase UI.
IPaymentProvidersExtendedService.GetEligiblePaymentProviders()Redirect URLs in test mode
A redirect URL is optional in test mode, and the simulated checkout page never redirects automatically. When the environment has a success redirect URL configured, the checkout page uses it to return the player to your game when they select Return to Game. When it doesn't, the checkout page shows a terminal screen that the player leaves by closing the browser and switching back to your game. The order completes either way. For more information about redirect URLs, refer to Deep link success URL example.
Test mode in webshops
A webshop selects a payment provider from its own routing configuration before it calls Unity IAP, but that selection doesn't apply while test mode is on. Instead, the webshop enables buying, sends players to the simulated checkout page, and states in its checkout dialogs that the purchase is simulated. This means a webshop works in a new project that has no webshop routing configured yet.
When test mode is off, a webshop uses its own routing rules, fallback provider, and per-player exclusions. For more information, refer to Payment provider routing in webshops.
Move from test mode to a payment provider
Moving from test mode to a real payment provider only changes which provider serves the purchase. Your Remote Catalog, your SDK integration, and your fulfillment code stay the same. To take real payments, configure a payment provider, which automatically disables test mode.