InAppPurchase

The player purchased an IAP

Name
Type
Select
Backend name
Description

purchaseName

string

Required

purchase_name

Name of the purchase/pack the user bought

spentProducts

Product

Required

spent_products

What products the user spent on

receivedProducts

Product

Required

received_products

The user receives the product

productID

string

Required

product_id

The Store SKU of the purchase unit

transactionID

string

Required

transaction_id

The receipt ID provided by the Store

placement

string

Required

placement

The location in the app where the purchase was made

receiptStatus

ReceiptStatus

Required

validated_receipt

A receipt status object

isTestPurchase

bool

Required

is_test_purchase

Whether the purchase was a test purchase

additionalData

Dictionary<string, object>

Optional

additional_data

Any additional information

Override #1

The player purchased an IAP - Transaction Override

Name
Type
Select
Backend name
Description

transaction

Transaction

Required

transaction

The Transaction object containing the data of the transaction

placement

string

Required

placement

The location in the app where the purchase was made

receiptStatus

ReceiptStatus

Required

validated_receipt

A receipt status object

isTestPurchase

bool

Required

is_test_purchase

Whether the purchase was a test purchase

additionalData

Dictionary<string, object>

Optional

additional_data

Any additional information

Code examples:

Product productSpent = new Product();
Product productReceived = new Product();
RealCurrency realCurrency = new RealCurrency("$", 25.99f);
productSpent.realCurrency = realCurrency;
int virtualMoneyAmount = Mathf.FloorToInt(1500f);
List<VirtualCurrency> virtualCurrencies = new List<VirtualCurrency>
{ new VirtualCurrency("Received a Pack of : ", "$", virtualMoneyAmount) };
productReceived.virtualCurrencies = virtualCurrencies;
Dictionary<string, object> additionalData = new Dictionary<string, object>
{
    { "Anything", 1356 },
    { "More Anything", 76.85f },
    { "status Something", true },
    { "Message Something", "Yes! this is good" }
};
//Receipt status should be received either from adjust or lion's IAP package
LionAnalytics.InAppPurchase(virtualMoneyAmount + "Bought", productSpent, productReceived, "com.studio.game.money1500",
"xcf22f89574u45k6jy8", "store_money_tab", ReceiptStatus.Success, true, additionalData);

Alternative method using Override #1 example:

Product productSpent = new Product();
Product productReceived = new Product();
RealCurrency realCurrency = new RealCurrency("$", 25.99f);
productSpent.realCurrency = realCurrency;
int virtualMoneyAmount = Mathf.FloorToInt(1500f);
List<VirtualCurrency> virtualCurrencies = new List<VirtualCurrency>
{ new VirtualCurrency("Received a Pack of : ", "$", virtualMoneyAmount) };
productReceived.virtualCurrencies = virtualCurrencies;
Transaction transaction = new Transaction("store Transaction", "USD", productReceived, productSpent,
"xcf22f89574u45k6jy8", "com.studio.game.money1500");
transaction.AddSpentItem("free coins", "USD ", 0);
transaction.AddReceivedItem("free 5 coins", "coins", 5);
Dictionary<string, object> additionalData = new Dictionary<string, object>
{
    { "Anything", 1356 },
    { "More Anything", 76.85f },
    { "status Something", true },
    { "Message Something", "Yes! this is good" }
};
//Receipt status should be received either from adjust or lion's IAP package
LionAnalytics.InAppPurchase(transaction, "store_money_tab", ReceiptStatus.Success, true, additionalData);

Last updated