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

Subscription upgrades getting automatically canceled immediately after purchasing #1107

Open
9 of 11 tasks
chenna8464 opened this issue Jun 28, 2024 · 20 comments
Open
9 of 11 tasks
Labels
bug Something isn't working

Comments

@chenna8464
Copy link

chenna8464 commented Jun 28, 2024

‼️ Required data ‼️

Environment

  • Output of flutter doctor
Screenshot 2024-06-28 at 2 02 44 PM
  • Version of purchases-flutter : 6.29.4
  • Testing device version : Android API 33.
  • How often the issue occurs- every one of your customers is impacted? Only in dev?
    till now we checked in sandbox mode with productions API's basically app was running in beta
  • Debug logs that reproduce the issue
  • Steps to reproduce, with a description of expected vs. actual behavior
    Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Describe the bug

initially, i made a monthly payment of $14 which had a free trial, and then after I made a yearly payment of $134. here the payment has gone through successfully but in the revenue cat, it is showing like below (see screenshot). and sometimes it's happening for initial payment as well.
the main issue is the payment is cancelled due to a billing error, and the webhook is sending the price as 0

Screenshot 2024-06-28 at 2 11 10 PM

Additional context

the code i am using for the upgrade is
if (oldProductId.isNotEmpty && Platform.isAndroid) { purchaserInfo = await Purchases.purchasePackage(product!, googleProductChangeInfo: GoogleProductChangeInfo(oldProductId, prorationMode: GoogleProrationMode.immediateAndChargeFullPrice)); } else { purchaserInfo = await Purchases.purchasePackage(product!); }

@chenna8464 chenna8464 added the bug Something isn't working label Jun 28, 2024
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@chenna8464
Copy link
Author

and we have enabled pub/sub also

@vegaro
Copy link
Contributor

vegaro commented Jun 28, 2024

how are you configuring the SDK @chenna8464 ? Can you share some of the configure code? Without your API key of course 😄

@chenna8464
Copy link
Author

this is the initialization of the SDK

static Future<void> init() async { if (await Purchases.isConfigured) return; await Purchases.configure(PurchasesConfiguration( Platform.isIOS ? EnvironmentConfig.revenueCatPublicKeyiOS : EnvironmentConfig.revenueCatPublicKeyAndroid, )); Purchases.addReadyForPromotedProductPurchaseListener( (productIdentifier, startPurchase) { startPurchase.call(); }); Purchases.getOfferings(); await Purchases.collectDeviceIdentifiers(); }

and this is where the purchase is happening

` Package? product;
CustomerInfo? purchaserInfo;

  final context = navigator.currentContext!;
  final appProvider = context.read<AppProvider>();

  product = await _getPackage(appProvider.selectedPlan);

  if (Platform.isIOS) {
    await Purchases.checkTrialOrIntroductoryPriceEligibility(
        [product!.storeProduct.identifier]);
  }
  await Purchases.setEmail(email);

  if (oldProductId.isNotEmpty && Platform.isAndroid) {
    purchaserInfo = await Purchases.purchasePackage(product!,
        googleProductChangeInfo: GoogleProductChangeInfo(oldProductId,
            prorationMode:
                GoogleProrationMode.immediateAndChargeFullPrice));
  } else {
    purchaserInfo = await Purchases.purchasePackage(product!);
  }

  final isPurchaseSuccesful =
      purchaserInfo.entitlements.all["mentor_access"]!.isActive;`  

@chenna8464
Copy link
Author

@vegaro

@chenna8464
Copy link
Author

chenna8464 commented Jun 28, 2024

and we have the same ticket, this we raised long back and it closed saying that revcat fixed the issue
#803

@chenna8464
Copy link
Author

@vegaro any update on this?

@vegaro
Copy link
Contributor

vegaro commented Jul 1, 2024

@chenna8464 your code looks correct. In that other issue, the UI looks slightly different since it actually shows there was a product change.

Without having the user id it's going to be hard to understand what happened. Do you mind sharing an app user id (or the url link to the user page in the dashboard) so we can look into the details of the purchase? You can send a message to support with more details at support@revenuecat.com if you prefer not to share here, and post the ticket number when you do.

@chenna8464
Copy link
Author

@vegaro
Copy link
Contributor

vegaro commented Jul 1, 2024

Thanks @chenna8464

We have been looking into the receipts of those users and it looks like when we check the purchases with Google, they are already cancelled, with a system initiated cancellation. Is it possible you are purchasing using the wrong test card in the purchase screen?

image

I was looking at ketan.gurav+1334@magnifi.com purchases and that one doesn't have a product change and when RevenueCat gets the purchase, Google indicates it's already canceled, which is odd.

@chenna8464
Copy link
Author

chenna8464 commented Jul 1, 2024 via email

@chenna8464
Copy link
Author

@vegaro sent an email with the reply, but adding the same message here

we are using the correct test cards for purchase, check this user testsub7@yopmail.com ( this user did the payment and the upgrade also worked but some users still getting the same error (BILLING ERROR))

the plans expired/were cancelled because it has some time limit to expire,
but if you check the webhook that was sent for this user which has a price 0.
and it happened for some other users, whose subscriptions expired/cancelled
it is happening In two cases only for Android, iOS is working fine in all
cases

  1. in the initial payment itself
  2. while doing the upgrade

@vegaro
Copy link
Contributor

vegaro commented Jul 2, 2024

Hi @chenna8464

Been looking into this a bit more and we've realised that what you are seeing is expected for Indian subscriptions. We have a whole blogpost about it, but the tldr; is that India has laws that regulate auto renewing subscriptions that are over 5000 INR so Google immediately cancels this purchases, and sends a notification to our servers with a systemInitiatedCancellation reason. This is why you see the yearly subscription cancelled and not renewing, but the monthly subscription is working as expected.

There's for sure some work to do in our dashboard to make this less confusing, so I will pass that feedback along and hopefully we can add more clarification for Indian subscriptions in our UI.

@chenna8464
Copy link
Author

Hi @vegaro , understood, now i changed the region to United States(US) to check the payment above 5000INR, by using https://developer.android.com/google/play/billing/test#play-billing-lab

now this user have some issues after payment testsub13@magnifi.com,

  1. I made the monthly payment of $14, without a free trial
  2. after 3 minutes i did a payment for $134 as an upgrade plan which doesn't have free trail.

now the issue is. I received a webhook for $14 successfully,

but for $134.
**Started a subscription of** This webhook has the correct price of $134
and
**Changed their renewal preference to** webhook has a $0 price, which is not correct right? it should have the correct price

Screenshot 2024-07-03 at 3 49 31 PM

@nyeu
Copy link

nyeu commented Jul 3, 2024

Hi @chenna8464,

The webhook for product changes is anticipated to have a $0 price. This is designed to simply notify you of the change. You will subsequently receive a renewal webhook with the updated subscription details, reflecting the correct pricing. For more information about product changes, please refer to our documentation here.

@chenna8464
Copy link
Author

Hi @vegaro , thanks for the update, and also have a small doubt,

The webhook for product changes is anticipated to have a $0 price. This is designed to simply notify you of the change. You will subsequently receive a renewal webhook with the updated subscription details, reflecting the correct pricing. For more information about product changes, please refer to our documentation

will this be the same behaviour in production as well, when we do payments using real money not in sandbox?

@nyeu
Copy link

nyeu commented Jul 9, 2024

Hi @chenna8464,
You are correct, this is the expected behavior in sandbox and production.

@chenna8464
Copy link
Author

chenna8464 commented Jul 9, 2024

@vegaro have one more doubt, in the flow
INITIAL PURCHASE event will come when i do the initial purchase let's say monthly and then after the free trial. it will convert to a paid user
after that, i upgraded from monthly to yearly, and then again i received an INITIAL PURCHASE event

INITIAL PURCHASE -- $14 monthly free tail
RENEWAL (converted from free trail to paid)
INITIAL PURCHASE -- $134.99 yearly no free tail
PRODUCT_CHANGE
RENEWAL

we got two INITIAL PURCHASE events

testsub22@magnifi.com, can you please check this user and give me some clarity on this. we are stuck on this flow to handle in our BE

@chenna8464
Copy link
Author

chenna8464 commented Jul 16, 2024

Hi @vegaro any update on this. we stuck on this, can you please give me some info on this

@nyeu
Copy link

nyeu commented Jul 16, 2024

Hi @chenna8464,
Since this is different from the initial GitHub ticket and you've opened one in Zendesk, let's continue the conversation there to keep everything organized and focused on the same topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants