Custom Purchase Reporting

Report purchases that are made outside of the Beamable payment flow and validation [ECON-Stores-06]

Introduction

As a game maker you will find that in some cases you need to be able to report purchases from outside the Beamable store flow. Beamable provides you with a way to do this through a small configuration change in Portal and some client side tracking code.

Configuration

1077

As shown in the above example, you will need to set a key in your Realm configuration to override purchase reporting to enable this functionality. Without this configuration change the API will error and not report anything.

Here we are setting the namespace to payments and then the key is client_audits and we will set the value to true.

❗️

Security Warning

This feature is not secure unless you track this from within a MicroService and validate the purchase. It is highly advisable to do so in order to not allow a customer to spoof or false track a purchase.

Implementation

Once your configuration has been setup to allow this API to function, then you can use the .Api.PaymentService.Track API to track the purchase.

PropertyDetails
purchaseIdAn arbitrary ID to represent the purchase or transaction
storeAn arbitrary store name to represent the provider in which the purchase was validated through
skuProductIdAn arbitrary id to represent the sku from the provider
skuNameAn arbitrary name to represent the sku from the provider
isoCurrencySymbolthe ISO symbol (eg: "usd" ) as a string to represent the currency the purchase was made in
priceInLocalCurrencythe amount of the purchase, this property is a Double datatype
obtainCurrency[Optional] Currency you wish to automatically grant after tracking of this purchase
obtainItem[Optional] Items you wish to automatically grant after tracking of this purchase

Here is a code example of how this API call could look.

var trackPurchasePayload = new TrackPurchaseRequest(
    "12345",
    "MyThirdPartyProvider",
    "my_product_item_01",
    "My Product 01",
    5.99,
    "usd",
    new List<ObtainCurrency>()
    {
        new ObtainCurrency()
        {
            amount = 1000,
            originalAmount = 1000,
            symbol = "GOLD"
        }
    },
    new List<ObtainItem>()
    {
        new ObtainItem()
        {
            contentId = "ContentIdOfMyItemToGrant"
        }
    }
);
await _playerContext.Api.PaymentService.Track(trackPurchasePayload);

View Results

Once you do the above tracking, you can view the results by going to the Portal and clicking on *Real Money Transactions under the Monetization section. After a few minutes, the tracking that was posted should appear there and you can view the details of your transactions.

1452

In addition, the dashboards on the Realm should reflect the purchase as well!

1419