SDK pour Unity / Biens gratuits
  Retour à la documentation

SDK pour Unity

Biens gratuits

Free items are a type of item that users can get without spending virtual or real currency. These include:

  • Virtual items
  • Bundles
  • Virtual currency packages

Free items are only available to authorized users. Unauthorized users can only view the catalog of free items.

Examples of usage:

  • You can give away free items on important dates for your project (for example, on the day the project was founded) to reward users for their loyalty.
  • You can give away free starter packs for the game in the store to attract new users to the game.

You can limit the free giveaway of unique items if the user already has them.

To set up free items:

  1. Add free items to the catalog.
  2. Implement logic of ordering free items by users.
  3. Implement the logic of granting free items to the user.

Ajouter des biens gratuits au catalogue

Detailed instructions for creating items are available in the following documentation sections:

When creating or editing a free item, you need to select a Free item, Free package or Free bundle in the Paid or Free section.

Commande de biens gratuits par un utilisateur

A user can order a free item in two ways:

  • In one click (without using the shopping cart) — one SKU in any quantity. For example, 100 identical potions.
  • Via the shopping cart — any type of items in any quantity.

Commande d'un bien gratuit en un clic

To implement this option, call the CreateOrderWithSpecifiedFreeItem SDK method when a user clicks the button in the catalog to order the free item.

The delivery of items to the user’s inventory on Xsolla’s side occurs immediately after a successful request to this method (without the need to open the Pay Station).

Commande de biens gratuits via le panier

If a user uses the shopping cart:

  • If the user’s cart contains both paid and free items:
    1. Get the payment token and order ID using the PurchaseCart SDK method.
    2. Implement opening the payment UI. To do this, call the OpenPurchaseUi SDK method and pass the payment token and order ID to it.

  • If the user’s cart contains only free items, call the CreateOrderWithFreeCart or CreateOrderWithParticularFreeCart SDK method. The delivery of items to the user’s inventory on Xsolla’s side occurs immediately after a successful request to this method (without the need to open the Pay Station payment form).

Octroi de biens gratuits à l'utilisateur

You can track the status of a free item order by calling the CheckOrder SDK method on a timer.

If the order was successful, use SDK methods for displaying user inventory to update the data on the client side of the application.

Note
If you’ve configured your application’s server to handle Xsolla webhooks, you can update the data on your application’s client side when the order_paid webhook is received.
Cet article vous a été utile ?
Merci !
Que pouvons-nous améliorer ? Message
Nous sommes désolés de l'apprendre
Dites-nous pourquoi vous n'avez pas trouvé cet article utile. Message
Merci pour votre commentaire !
Nous examinerons votre message et l'utiliserons pour améliorer votre expérience.
Évaluer cette page
Évaluer cette page
Que pouvons-nous améliorer ?

Préfère ne pas répondre

Merci pour votre commentaire !

Liens utiles

Dernière mise à jour: 10 Octobre 2023

Faute de frappe ou autre erreur dans le texte ? Sélectionnez le texte concerné et appuyez sur Ctrl+Entée.

Signaler un problème
Nous améliorons continuellement notre contenu grâce à vos commentaires.
Indiquez votre adresse e-mail pour un suivi
Merci pour votre commentaire !