Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[in_app_purchase][android]: Add Google Play Offers support #110909

Closed
AlaaEddineCharbib opened this issue Sep 3, 2022 · 13 comments · Fixed by flutter/packages#3752
Closed

[in_app_purchase][android]: Add Google Play Offers support #110909

AlaaEddineCharbib opened this issue Sep 3, 2022 · 13 comments · Fixed by flutter/packages#3752
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter customer: crowd Affects or could affect many people, though not necessarily a specific customer. p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@AlaaEddineCharbib
Copy link

Google Play introduced offers to subscriptions. but apparently there is still no support to this feature in the in_app_purchase plugin, or at least this is what I could conclude after going through the GooglePlayProductDetails and SkuDetailsWrapper codes.

For iOS it is possible to get the list of a product discounts using the AppStoreProductDetails' skProduct object.
is it possible to have such a thing for Android too?

@darshankawar darshankawar added in triage Presently being triaged by the triage team c: new feature Nothing broken; request for a new capability platform-android Android applications specifically plugin p: in_app_purchase Plugin for in-app purchase c: proposal A detailed proposal for a change to Flutter and removed in triage Presently being triaged by the triage team labels Sep 5, 2022
@GaryQian
Copy link
Contributor

GaryQian commented Sep 6, 2022

cc @GaryQian

@GaryQian GaryQian added the P2 Important issues not at the top of the work list label Sep 6, 2022
@antonionicolau
Copy link

Hey @AlaaEddineCharbib It's nice that If your app supports the in-app purchase workflow(described in Making In-app Billing requests), your app automatically supports in-app redemption of promo codes. You'll only need to implement it for IOS, not need for Android

@erperejildo
Copy link

Hey @AlaaEddineCharbib It's nice that If your app supports the in-app purchase workflow(described in Making In-app Billing requests), your app automatically supports in-app redemption of promo codes. You'll only need to implement it for IOS, not need for Android

Automatically you mean? It doesn't work for me, only takes one of the plans created:

https://stackoverflow.com/questions/74599781/flutter-get-different-plans-from-subscription

@erperejildo
Copy link

erperejildo commented Dec 2, 2022

@danagbemava-nc do we know when will this be supported? Or a roadmap to know exactly how long I can delay my new subscriptions for?

I can also create other subscriptions in my google play console in the meantime and later on, when this is supported create them as plans/offers but I will encounter 2 issues here:

  • The original subscriptions can't be removed at all
  • The IDs will be different and I will face some problems with users with the original subscriptions
  • If I have new plans/offers this will be confusing having other separate (and active) subscriptions
  • Extra logic in my app

I understand we are talking about different departments here (google play console, Flutter, etc.) but this will affect our earnings and TBH all these departments belong to the same company (I'm saying this because I had these problems already in the past with this and other libraries). This issue was created 3 months ago, there are people interested but again, we have an issue without responses from the team. So some extra info will be appreciated please

@danagbemava-nc
Copy link
Member

do we know when will this be supported? Or a roadmap to know exactly how long I can delay my new subscriptions for.

@erperejildo, unfortunately, I cannot provide that information

@seunghwanly
Copy link

It has been almost 6 months trying to get the Non-renewing Subscription from Play Store using the in_app_purchase plugin.

App Store fetches all the

  1. Auto-renewable Subscriptions
  2. Non-renewable Subscriptions
    by using the queryProductDetails( ) method.

But, the Play Store only retrieves Auto-renewable Subscriptions none of the Non-renewable Subscriptions can be fetched.

Are there any updates on this issue?

@erperejildo
Copy link

do we know when will this be supported? Or a roadmap to know exactly how long I can delay my new subscriptions for.

@erperejildo, unfortunately, I cannot provide that information

who should I get in contact with? Becase I was trying to create my new subscriptions but instead of creating 3 I'll have to create 6 with extra logic to detect plans within same subscriptions (because all of them will be separate and different subscriptions at the end).

I could wait to see if this is going to be supported but not much since I'm going to lose money. So any way to get more information about this support?

@papmodern

This comment was marked as off-topic.

@seunghwanly
Copy link

seunghwanly commented Jan 30, 2023

In my case, I needed this feature asap, so I just replaced the deprecated method(querySkuDetailsAsync) to queryProductDetailsAsync. I had a couple of jobs like,

  • created a new data model class, which covers ProductDetails
  • created a new method for Dart and Java
  • revised & created methods and classes in test codes, (in_app_purchase_android > test > billing_client_wrappers)
  • added a separate interface called buyNonConsumableInAndroid for the new subscription model in Play Store

But, I wondered how I could handle the new class(ProductDetails in BillingClient v5) with the previous class(ProductDetails in in_app_purchase_platform_interface).

Since the Play Store announced the new model(multiple base plans inside the one-subscription, 1:N (Subscription: Base plans)), it was hard to wrap up the previous class(ProductDetails in in_app_purchase_platform_interface) with the new class(ProductDetailsWrapper).
image

Here is the sample code below.

/// Generate a [GooglePlayProductDetails] object based on an Android
  /// [ProductDetailsWrapper] object.
  factory GooglePlayProductDetails.fromProductDetails(
    ProductDetailsWrapper productDetails,
  ) {
    return GooglePlayProductDetails(
      id: productDetails.productId,
      title: productDetails.title,
      description: productDetails.description,
      price: productDetails.price ?? 'unknown',
      rawPrice:
          (productDetails.oneTimePurchaseOfferDetails?.priceAmountMicros ??
                  productDetails.subscriptionOfferDetails?.first.pricingPhases
                      .first.priceAmountMicros ??
                  0) /
              1000000.0,
      currencyCode:
          productDetails.oneTimePurchaseOfferDetails?.priceCurrencyCode ??
              productDetails.subscriptionOfferDetails?.first.pricingPhases.first
                  .priceCurrencyCode ??
              'USD',
      currencySymbol:
          productDetails.oneTimePurchaseOfferDetails?.formattedPrice[0] ??
              productDetails.subscriptionOfferDetails?.first.pricingPhases.first
                  .formattedPrice[0] ??
              r'$',
      productDetails: productDetails,
    );
  }

And the getter method for ProductDetailsWrapper.

String? get price =>
      oneTimePurchaseOfferDetails?.formattedPrice ??
      subscriptionOfferDetails?.first.pricingPhases.first.formattedPrice;

The reason why I set the price, rawPrice, currencyCode, etc. in this way is that I just needed to handle a single case like 👉 Subscription: Base Plan = 1: 1

Are there any ideas for this migration? Here is my repository link which I'm working on.

@huycozy huycozy mentioned this issue Feb 23, 2023
@danagbemava-nc danagbemava-nc added the customer: crowd Affects or could affect many people, though not necessarily a specific customer. label Mar 9, 2023
@wosika
Copy link

wosika commented Mar 15, 2023

It's been six months, no support plan?😥

@sandesh-dearreal
Copy link

sandesh-dearreal commented Apr 10, 2023

When should be expect this to be added?

@erperejildo
Copy link

It's been six months, no support plan?😥

When should be expect this to be added?

never wait for something like this guys. Specially if it affects your earnings

auto-submit bot pushed a commit to flutter/packages that referenced this issue May 17, 2023
Sunsets BillingClient v4 calls in favor of the new v5 calls. Changes mostly follow the [Migration guide](https://developer.android.com/google/play/billing/migrate-gpblv5).

Besides solving several issues, this change is also required as [billing client v4 will be obsolete by August 2nd, 2023](https://developer.android.com/google/play/billing/deprecation-faq).

`getProductDetails()` will now return both base plans and their offers for subscriptions. Before, it would only return subscriptions that were backwards compatible with billing client v4.

Price changes for subscriptions seem to be handled by the Play Store now instead. Therefore, `launchPriceChangeConfirmationFlow()` has been removed, making this PR a breaking change. Context:

* [Billing Client API](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#launchPriceChangeConfirmationFlow(android.app.Activity,%20com.android.billingclient.api.PriceChangeFlowParams,%20com.android.billingclient.api.PriceChangeConfirmationListener))
* [Billing Client docs](https://developer.android.com/google/play/billing/subscriptions#price-change)

This PR fixes the following issues:
* Fixes [#110909](flutter/flutter#110909)
* Fixes [#107370](flutter/flutter#107370)
* Fixes [#114265](flutter/flutter#114265)
@danagbemava-nc danagbemava-nc added the r: fixed Issue is closed as already fixed in a newer version label May 18, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this issue May 22, 2023
In the upgrade to billing client v5 in #3752, some method signature strings on the Java side were updated. Unfortunately, as the Dart side was not updated. This mismatch broke the interaction between the Dart and native Android code through the method channels.

This PR updates the strings on the Dart side so the method invocation work correctly again.

This is a follow-up to
- flutter/flutter#110909
- flutter/flutter#107370
- flutter/flutter#114265
auto-submit bot pushed a commit to flutter/packages that referenced this issue May 23, 2023
…4065)

Bumps `in_app_purchase_android` to 3.0.0.

This PR is the final step for closing flutter/flutter#110909.
@github-actions
Copy link

github-actions bot commented Jun 1, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2023
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter customer: crowd Affects or could affect many people, though not necessarily a specific customer. p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

Successfully merging a pull request may close this issue.