You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I want to know how to make multiple purchases from play store in 4.12.2 iap version. I found a tutorial with option of multiple purchases, but there was a 4.7.0 version. Here is a sample of code which I use.
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs purchaseEvent)
{
var product = purchaseEvent.purchasedProduct;
var receipt = product.receipt;
var data = JsonUtility.FromJson<Data>(receipt);
var payload = JsonUtility.FromJson<Payload>(data.Payload);
var productConfig = Products[purchaseEvent.purchasedProduct.definition.id];
OnProcessPurchase?.Invoke(productConfig.definition.id, payload.payloadData.quantity);
return PurchaseProcessingResult.Complete;
}
Classes which I get from json
[Serializable]
public class SkuDetails
{
public string productId;
public string type;
public string title;
public string name;
public string iconUrl;
public string description;
public string price;
public string price_amount_micros;
public string price_currency_code;
public string skuDetailsToken;
}
[Serializable]
public class PayloadData
{
public string orderId;
public string packageName;
public string productId;
public long purchaseTime;
public int purchaseState;
public string purchaseToken;
public int quantity;
public bool acknowledged;
}
[Serializable]
public class Payload
{
public string json;
public string signature;
public List<SkuDetails> skuDetails;
public PayloadData payloadData;
}
[Serializable]
public class Data
{
public string Store;
public string Payload;
public string TransactionID;
}
The text was updated successfully, but these errors were encountered:
Hello, I want to know how to make multiple purchases from play store in 4.12.2 iap version. I found a tutorial with option of multiple purchases, but there was a 4.7.0 version. Here is a sample of code which I use.
Classes which I get from json
The text was updated successfully, but these errors were encountered: