Skip to main content
Solved

Subscription System (Unity)

  • 7 September 2021
  • 3 replies
  • 273 views

Forum|alt.badge.img+1

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!

Best answer by sundeep

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
Did this post help you find an answer to your question?

3 replies

Forum|alt.badge.img+1
  • Author
  • New Member
  • 2 replies
  • September 8, 2021

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


sundeep
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 138 replies
  • Answer
  • September 8, 2021

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?


Forum|alt.badge.img+1
  • Author
  • New Member
  • 2 replies
  • September 9, 2021

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings