Skip to main content

Working with Payments in RuStore

You can monetize your application through purchases in RuStore. Here are 4 options on how to do this:

  • Sell the app on the storefront. Create a paid app, upload it to the RuStore storefront, and receive payouts for downloads.
tip

Keep in mind that selling an app on the storefront generates income from a single user only once. If you want to receive regular payouts for your app's functionality, we recommend considering adding subscriptions and paid products.

  • Add renewable subscriptions. Subscriptions give users additional benefits within the app or game for a fixed monthly fee.
  • Add consumable products. These are purchases that can be bought more than once to be used within the app. For example, health boosts, hints, crystals, and coins in games.
  • Add non-consumable products. Unlike consumables, these can only be purchased once and cannot be spent within the app or game. When purchasing such products, the user becomes their owner. This could be removing ads, unlocking a hidden level, or premium in-game equipment.

All types of paid products are added through the RuStore Console system.

Getting Started​

To start working with payments, fill out an application to enable monetization according to your business registration form:

Payment Acceptance Prerequisites​

  • The application is uploaded to the RuStore Console.
  • The application has passed moderation (publishing the application is not mandatory).
Important

If the application is published in another app store, ensure that the build you are using to accept payments uses the correct signature. The keystore signature must match the signature of the build uploaded to the RuStore Console and that has passed moderation. For example, the buildType debug should use the same signature as the corresponding build for RuStore.

  • The user and the application must not be blocked in RuStore.

Creating Paid Applications or Products​

Add an application for sale on the storefront in the RuStore Console if you have chosen this monetization method.

tip

Paid products and subscriptions can be created in both paid and free applications.

If you want to monetize your application using paid products, create products that will be embedded in your application through the RuStore Console system.

info

You can change the price of products at any time. After saving the changes, the products will be sold at the new price immediately.

See How to create a paid product. See How to create a subscription.

SDK Setup​

Integrate the Pay SDK into your application so that buyers can purchase products.

How Payments Work​

caution

The diagram below shows an approximate algorithm for setting up and integrating payments, which you can use as a guide. Take into account the specifics of your project during implementation.

Using the SDK, you can:

For more details on integration, see Setting up the Payment SDK.

Purchase Status Model​

One-stage payment status model.

Two-stage payment status model.

Status model for subscription purchase.

Handling Unfinished Payments​

Only purchases started with the two-step payment flow (i.e., with an authorization hold) require confirmation. After a successful hold, such purchases will have the PurchaseStatus.PAID status.

To capture funds from the buyer’s card, purchase confirmation is required. Use the confirmTwoStepPurchase method for this.

If, after a successful hold, you cannot deliver the item to the user, cancel the purchase using the cancelTwoStepPurchase method.

If the purchase is canceled, the funds are immediately refunded to the user in full.

Product Delivery Acknowledgment State​

Starting from Pay SDK version 10.4, you can offload the tracking of product delivery to the RuStore side. A special flag has been added for all purchases, indicating whether the product has been delivered to the user.

How it works:

  • By default, the status PENDING is set for all new purchases — the product has not been delivered yet.
  • After you have processed the order on your side and delivered the product to the user, you can change the flag status to ACKNOWLEDGED using the SDK method updateAcknowledgementState.
  • If necessary, you can request a list of all purchases with the PENDING flag via the SDK and retroactively grant the corresponding entitlements. To do this, use the getPurchases method with a filter based on the acknowledgementState.
info

Using this flag is optional and does not affect the payment processing. It is available only for purchases made through Pay SDK version 10.4 and higher.

Accepting Payments in Other App Stores​

Users will be able to pay for purchases in your application even if RuStore is not installed on their devices.

Benefits

You can increase revenue and attract a loyal audience because now:

  • users can pay for purchases even if they have not yet installed RuStore;
  • you can continue to accept payments by publishing applications on different platforms.

Features of Purchases Without Authorization

  • The ability to pay without RuStore is available starting from Pay SDK version 9.0.1.
  • Payment occurs without authorization via VK ID and without the mandatory provision of an email. The user can optionally provide an email to receive a receipt after payment.
  • Payment methods are not saved between payments. Available payment methods: new card, SBP, and SberPay.
  • You can request the list of purchases (the getPurchases method) without authorization. The response will return payments made on the current device using Pay SDK version 9.0.1. This is important to consider when migrating from the Billingclient SDK.
  • During payment, you can pass the user's internal ID or email to simplify the refund procedure. Such a payment can be easily found in the RuStore console using the specified identifier.
  • A user not authorized in RuStore is automatically directed to the payment scenario outside RuStore.

If you do not have the ability or desire to store purchase history on your server, we recommend prohibiting non-authorized users from making purchases. To do this, follow these steps:

  1. Call the isRuStoreInstalled method to check if RuStore is installed.
  2. If RuStore is not installed — redirect the user to the RuStore installation page or display an error message in the interface.
  3. If RuStore is installed — check the user's authorization status in RuStore (this can be done using the getUserAuthorizationStatus method).
  4. If the user is not authorized — redirect to the authorization page.
  5. If RuStore is installed and the user is authorized — the payment process continues.
public fun isRuStoreInstalled(context: Context): Boolean

Features of Purchases With Authorization

  • Authorization via VK ID is mandatory for subscription payments. The buyer can also choose to authorize when paying for in-app products.

Subscription Payments in Pay SDK

Warning

Available for PaySDK version 10.1.0

  • Subscriptions in Pay SDK are available only to users authorized via VK ID.
  • Authorization can be done on the payment sheet after selecting a payment method.
  • The authorization session lasts for 5 minutes. Within this time, re-authorization is not required (if the user has not closed the application).
  • As long as the session is valid, SDK method calls return data of the authorized user. When the session expires, the methods will again return anonymous user data until re-authorization.

Before Using the SDK

We recommend making the following improvements before migrating to the current version of the Payment SDK.

  • Configure Analytics

    If you have published the application on different platforms and want to separate payment flows based on the application's installation source, create different build variants based on build flavors. This will allow you to collect analytics depending on the distribution channel.

Receiving Server Notifications​

To receive notifications about payments in your application in real-time, configure server notifications. This will simplify your work: you won't need to regularly poll for the payment status — RuStore will send notifications upon any change in the payment status.

API Integration​

Using the API will secure your application. It cannot be hacked to obtain products and subscriptions for free.

To work with the RuStore API, go through authorization and obtain a JWE token.

Use API methods for:

See Connecting the Payment API.

Server-Side Purchase Validation​

If you need to validate a successful purchase on the RuStore server, you can use the invoiceId from the ProductPurchaseResult model returned upon successful product purchase.

Getting invoiceId and productId from the purchase result
val params = ProductPurchaseParams(ProductId("productId"))

RuStorePayClient.instance.getPurchaseInteractor()
.purchase(params = params, preferredPurchaseType = PreferredPurchaseType.TWO_STEP)
.addOnSuccessListener { result ->
val invoceId = result.invoceId.value
yourApi.validate(invoceId)
}

You can also get invoiceId from the Purchase model. The Purchase model can be obtained using the getPurchases() method or the getPurchase method.

Testing payments​

Verify your SDK and API integration using test payments.

You can incentivize payments and increase revenue using coupons. Issue coupons in the RuStore Console, share them with your audience, and attract new paying users.

Managing payments​

Once you have your first payments, you can manage them in the RuStore Console.

Still have questions?