Google play subscription offer with Flutter

Userlevel 1
Badge +1

I created a subscription offer that the developer decides when to apply it. In the docs on how to use it there is this Kotlin example PurchaseWith(offer) and then you can do it like that. I am looking in the Flutter SDK and I can’t find a way to do it. purchaseDiscountedPackage() and other functions say “iOS only”. 

I want to apply a discount named x to this line:



Best answer by MarcosC 27 June 2023, 09:35

View original

4 replies

Userlevel 4
Badge +8

Hi aris,

In our (beta) version of the SDK with Billing Client 5, we do have a google specific method called purchaseSubscriptionOption. You can pass the specific option (offer) that you want to buy.

Use purchaseStoreProduct and pass the corresponding store product and it will use the defaultOption (offer).

Userlevel 1
Badge +1

HI @Ryan Glanz I appreciate the answer. There is very little documentation for this function and too many arguments. I tried to use it like this: 


SubscriptionOption subscriptionOption = new SubscriptionOption(













and I get the following error: ErrorCode: DEVELOPER_ERROR., message='One or more of the arguments provided are invalid.'


I would appreciate some help. I don't have phases it's a straightforward discount. Could you provide with an example ?


Userlevel 3
Badge +6

Hi @aris 

My suggestion is not to build the subscription option on your own (and I’m not sure you can). The idea is that you can use one of the subscriptionOptions that are part of a given store product.


Let’s assume you are using getOfferings to load all store products (you could use getProducts too), then you can use storeProduct.subscriptionOptions to decide which one to purchase (


Check this last section of this doc to see if it helps -


Edit: I’m showing native examples, but the same applies to flutter

Userlevel 1
Badge +1

it worked thanks!!!