Skip to content

Payments

  1. Open the Platforms section and add all the information about the Platform where the game is available. It's required to validate the purchases.
  2. Open the Products section and fill in all the information about the Products your game has. In most cases you just need the main table, however, if you have different ProductId, Name, or Price for different platforms, you might want to use the override section for each of the platforms.
  3. Get a list Of Products:
    Balancy.Payments.GetProducts(productsResponse =>
    {
       Debug.Log("Products Received " + productsResponse.Success);
       if (productsResponse.Success)
           Debug.Log("Products Count: " + productsResponse.Products.Length);
    });
    
  4. Make a purchase:
    Balancy.Payments.PurchaseProduct(<product_id>, doneCallback =>
    {
       Debug.Log("Purchase was made " + doneCallback.Success);
    });
    
  5. If you are using our LiveOps, use the next method to purchase an Offer and a Store Item

    Balancy.LiveOps.GameOffers.PurchaseOffer(offerInfo, purchaseResponse =>
    {
       Debug.Log("Purchase status " + purchaseResponse.Success + " for " + purchaseResponse.ProductId);
    });
    
    Balancy.LiveOps.Store.PurchaseStoreItem(storeItem, purchaseResponse =>
    {
       Debug.Log("Purchase status " + purchaseResponse.Success + " for " + purchaseResponse.ProductId);
    });
    

  6. If you are using your own Payment/Validation system, you just need to confirm the purchase with Balancy. This information will only be used for future Segmentation and will be saved in the profile history if the purchase is valid.

    var paymentInfo = new PaymentInfo
    {
       Receipt = unityProduct.receipt,
       Price = (float)unityProduct.metadata.localizedPrice,
       Currency = unityProduct.metadata.isoCurrencyCode,
       ItemId = unityProduct.definition.id
    };
    
    Balancy.LiveOps.GameOffers.OfferWasPurchased(offerInfo, paymentInfo, purchaseResponse =>
    {
       Debug.Log("Purchase status " + purchaseResponse.Success + " for " + purchaseResponse.ProductId);
    });
    // OR
    Balancy.LiveOps.Store.ItemWasPurchased(storeItem, paymentInfo, purchaseResponse =>
    {
       Debug.Log("Purchase status " + purchaseResponse.Success + " for " + purchaseResponse.ProductId);
    });
    

  7. To get the list of all the payments the user made, call the following method (make sure to do that after ExternalEvents.SmartObjects.SmartObjectsInitializedEvent is invoked)
    Balancy.LiveOps.Profile.GetPaymentsInfo();
    

Platforms

Where to find needed data for validation for specific platforms?

Google play

For Android we need License key.

  1. Open Play Console and select the app that you want to find the license key for.
  2. Go to the Monetization setup page (Monetize > Monetization setup).
  3. Your license key is under Ā«LicensingĀ».

iOS

For validating iOS payments we need generated shared secret.