Pankaj Mundra
Pankaj Mundra

Reputation: 1599

How to add discounted price for In-App Billing and show in application?

I am trying to provide a discount for a limited time.

I want to show the amount as per below image but I am not able to do so.

enter image description here

I am not able to find any option to do so in Google Play Developer Console.

Any help is appreciated.

Upvotes: 4

Views: 1499

Answers (3)

Adil Khan
Adil Khan

Reputation: 1

For discount price You need to read all Json which is coming from your play console and here is Discounted Price.

productDetailsResult.productDetailsList?.get(0)?.subscriptionOfferDetails?.get(0)?.pricingPhases?.pricingPhaseList?.get(1)?.formattedPrice

Add you logs ang get all what you want.

Upvotes: 0

Michał Stochmal
Michał Stochmal

Reputation: 6640

It's a kind of hack, but you can use product description field. As of now it isn't shown anywhere, so you are free to enter whatever you want and extract it through your app.

If you want to have sensible description in this field, be creative and place text like: "Now discounted from XX,XX$" :).

Sorry for Polish language on Google Play Console. enter image description here

Upvotes: 0

Ankit Batra
Ankit Batra

Reputation: 863

I too did not see any first-hand option from the google play developer console to implement a discounted price solution, so I went ahead and implemented my own. I am sharing how I implemented the same below:

  1. Declare the discounted price SKU(s) aka in-app-product(s) in your app in the play developer console.
  2. Register your app with Firebase if not already using it.
  3. Declare a remote config variable that will define the current active sku. This SKU is the purchasable option that the user will be shown.
  4. Fetch all the app sku(s) details using the Google Play billing library i.e. all the discounted SKU(s) and the base SKU that you already have.
  5. Fetch the remote config variable value defined in step 3.
  6. Calculate the discount of the current active SKU w.r.t. the Base SKU and display it to the user of your app.

For example, Let's say you have an SKU "A" priced at 10$ and a discounted SKU "B" priced at 5$. In the firebase remote config, let's say you have a remote config variable for the current active SKU, set to "A". This means you are not offering any discount yet. Now, change the remote config variable value to "B", now you can calculate the discount as 50% w.r.t. your base SKU "A" and show the price of "B" SKU (5$) to the user.

Upvotes: 3

Related Questions