HOME.en.md


RU EN
🏠 Home ❮ Back

RuStore Payment Plugin for Unity

The RuStorepayClient plugin helps integrate the payment mechanism into your project. Supported Unity versions: 2022.3.37f1+ (requires Gradle 7.3 or higher), Unity 6000+.

Installing the plugin in your project

  • Download the files ru.rustore.core-x.y.z.tgz and ru.rustore.pay-x.y.z.tgz from the official repository on GitFlic.
  • Import the downloaded packages into the project via Package Manager (Window → Package Manager → + → Add package from tarball…).
  • Update project dependencies using External Dependency Manager (Assets → External Dependency Manager → Android Resolver → Force Resolve).

Installing External Dependency Manager

External Dependency Manager for Android is included in the RuStoreCore package. To install it, follow these steps.

Open RuStoreCore in the Package Manager window (Window → Package Manager → Packages RuStore → RuStoreCore). Go to the Sample tab. Import the External Dependency Manager sample.

Project configuration

Open project settings: Edit → Project Settings → Player → Android Settings.

In the Publishing Settings section, enable the following settings.

  • Custom Main Manifest.
  • Custom Main Gradle Template.
  • Custom Gradle Properties Template.

In the Other Settings section, configure:

  • package name.
  • Minimum API Level = 24.
  • Target API Level = 34.

Open External Dependency Manager settings: Assets → External Dependency Manager → Android Resolver → Settings, enable the following settings.

  • Use Jetifier.
  • Patch mainTemplate.gradle.
  • Patch gradleTemplate.properties.

Handling deeplinks

A deeplink in the RuStore Payments SDK is required for proper interaction with third-party payment apps. It helps users make purchases faster in third-party applications and return to your app.

To set up a deeplink in your application, follow three main steps:

  1. In Unity, open the menu: Window → RuStoreSDK → Settings → PayClient

  2. Fill in the fields:

  3. consoleApplicationId — Application ID in the RuStore console.
  4. deeplinkScheme — deeplink scheme (used in intent-filter and SDK).

Select which Activity to launch after processing the deeplink:

  • Activity → com.unity3d.player.UnityPlayerActivity.
  • GameActivity → com.unity3d.player.UnityPlayerGameActivity.
  • CustomMainActivity → your Activity (field customMainActivityClass).

  • Patch and verify the manifest:

  • Patch Manifest — automatically apply necessary changes.
  • Verify Manifest — verify that AndroidManifest.xml is correct.

Changes in AndroidManifest.xml

The automatic manifest patch will make the following changes to AndroidManifest.xml:

  1. Creates a deeplink activity ru.rustore.unitysdk.RuStoreDeeplinkActivityDefault with the theme Theme.NoDisplay.

  2. Creates an intent-filter tag inside the deeplink activity with a link to your Deeplink Scheme.

  3. Creates meta-data tags inside <application> with a link to your Deeplink Scheme and SDK initialization.

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools">
    <application>
        <!-- Game Activity -->
        <activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" android:exported="true">
		    <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
		
        <!-- 1. Deeplink Activity -->
        <activity android:name="ru.rustore.unitysdk.RuStoreDeeplinkActivityDefault"
                  android:theme="@android:style/Theme.NoDisplay"
                  android:exported="true">
			
            <!-- 2. Deeplink intent-filter -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/rustore_PayClientSettings_deeplinkScheme" />
            </intent-filter>
        </activity>
		
        <!-- 3. Initializing SDK and Deeplink Scheme -->
        <meta-data android:name="console_app_id_value" android:value="@string/rustore_PayClientSettings_consoleApplicationId" />
        <meta-data android:name="internal_config_key" android:value="@string/rustore_PayClientSettings_internalConfigKey" />
        <meta-data android:name="sdk_pay_scheme_value" android:value="@string/rustore_PayClientSettings_deeplinkScheme" />
    </application>
</manifest>

Working with the SDK

Start exploring the RuStore library documentation with the methods of the RuStorePayClient class. Or use the online guide.

Technical support

Additional help and instructions are available in the RuStore documentation and via email at support@rustore.ru.

Distribution terms

This software, including source code, binary libraries, and other files, is distributed under the MIT license. Licensing information is available in the document MIT-LICENSE.