Solved

Subscription System (Unity)

  • 7 September 2021
  • 3 replies
  • 32 views

Badge

Hello, 

We want to switch our purchase system from Unity IAP to Revenuecat. But we have some questions about subscription system. 

1- How to get subscription local prices (monthly price / introductory monthly price and  weekly) from Revenuecat SDK? For example, we were get the price data with Unity IAP like this:

if (m_GooglePlayStoreExtensions.GetProductJSONDictionary()
.TryGetValue("om_sub_vim", out string skuDetails))
{
ControllerUIMainMenu.Instance.SetLocalizedIntroductoryPriceMonthly(JsonUtility
.FromJson<SkuDetails>(skuDetails).introductoryPrice);
}

 

2- How to start Purchase Subcription request with Revenuecat SDK?

For example, we can start a purchase subscription request with Unity IAP like this:

m_Controller.InitiatePurchase(m_Controller.products.WithID("on_weekly_vip"));

 

Thank you!

icon

Best answer by sundeep 8 September 2021, 21:57

Hi @Kemal Kuzu,

Glad you worked out the first problem, for the second, we have some docs on making a purchase via the SDK: https://docs.revenuecat.com/docs/making-purchases 

It comes with an example for Unity on how to make the purchase:

Purchases purchases = GetComponent<Purchases>();
purchases.PurchasePackage(package, (productIdentifier, purchaserInfo, userCancelled, error) =>
{
if (purchaserInfo.Entitlements.Active.ContainsKey("my_entitlement_identifier")) {
// Unlock that great "pro" content
}
});

Does this answer your question?

View original

3 replies

Badge

We just solve the first problem but still we cannot start purchase subscription for now.

Userlevel 1
Badge +4

Hi @Kemal Kuzu,

Glad you worked out the first problem, for the second, we have some docs on making a purchase via the SDK: https://docs.revenuecat.com/docs/making-purchases 

It comes with an example for Unity on how to make the purchase:

Purchases purchases = GetComponent<Purchases>();
purchases.PurchasePackage(package, (productIdentifier, purchaserInfo, userCancelled, error) =>
{
if (purchaserInfo.Entitlements.Active.ContainsKey("my_entitlement_identifier")) {
// Unlock that great "pro" content
}
});

Does this answer your question?

Badge

Hey @sundeep

 

Thank you for answer, it is true. This lines totally solve my problem.

if (id == _subscriptionKeyWeekly || id == _subscriptionKeyMonthly)
{
_purchases.PurchaseProduct(id, PurchaseCallback);
}
else
{
_purchases.PurchaseProduct(id, PurchaseCallback, "inapp");
}

 

Reply