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

Error when upgrade subscriptions plan #525

Closed
tybq93-zz opened this issue Jun 14, 2019 · 12 comments
Closed

Error when upgrade subscriptions plan #525

tybq93-zz opened this issue Jun 14, 2019 · 12 comments
Labels
🙏 help wanted Extra attention is needed 📱 iOS Related to iOS 🚶🏻 stale Stale

Comments

@tybq93-zz
Copy link

tybq93-zz commented Jun 14, 2019

Version of react-native-iap

3.0.0-rc.5

Version of react-native

0.59.2

Platforms you faced the error (IOS or Android or both?)

iOS

Expected behavior

When upgrade subscriptions, it's should return new transactionReceipt

Actual behavior

return error code:0 and debugMessage: "cannot connect to itune store" (look like this message is same for all error type)

Tested environment (Emulator? Real Device?)

Real device

Steps to reproduce the behavior

The first time i try subscription for plan 3 Months. Everything work perfect!

But after that, i try to upgrade to plan 6 months, it's still show alert that said purchase was successfully.
But in the purchaseErrorListener function return an error with code = 0, and debugMessage: "cannot connect to iTunes store" (look like this message is same for all error type).. And i also CANNOT get any new transactionReceipt in purchaseUpdatedListener function.
I don't have experience with native swift code, so hard to understand what happen in this module. :(

@hyochan hyochan added 🙏 help wanted Extra attention is needed 📱 iOS Related to iOS labels Jun 15, 2019
@tybq93-zz
Copy link
Author

Do we have any solution to fix this? Please help me :(

@tybq93-zz
Copy link
Author

so i think the only solution at this time is check if user already bought a subscription before, the UI app shouldn't let user update to another subscriptions plan.
Still wait some better way to fix this.

@hyochan
Copy link
Member

hyochan commented Jun 18, 2019

@tybq93 Could you provide some ideation for the implementation? Maybe I can go over it after that.

@hyochan hyochan added the 👣 waiting for response Need feedback to continue label Jun 20, 2019
@jvandenaardweg
Copy link
Contributor

jvandenaardweg commented Jul 2, 2019

I'm running into this problem too. Related to #274 and #306 (comment)

I have 2 subscriptions in the same subscription group (so you can downgrade/upgrade). One for 4.99 and one for 9.99.

When I upgrade (requestSubscription('9.99')) from no subscription to a 9.99 subscription, all fine. When I'm on the 9.99 subscription and want to "downgrade" (`requestSubscription('4.99') to the 4.99 subscription, it fails.

The topic start has a problem during upgrade, but i might think these problems are related.

After failure, when I press the "downgrade" button (requestSubscription('4.99')) again for the 4.99 subscription, it gives an alert saying i'm subscribed to that one. But I never received a receipt through purchaseUpdatedListener, so could not verify it's validity. The purchase is also not available in getAvailablePurchases, so I can't verify if it's purchased. I'm stuck.

Some extra info:

Below some screenshots:

Right after pressing Upgrade and calling requestSubscription('4.99'):
https://user-images.githubusercontent.com/5155373/60538753-826ea080-9d0b-11e9-83f5-b67b15674ade.jpg

Next step...
https://user-images.githubusercontent.com/5155373/60538762-826ea080-9d0b-11e9-9b77-3db7657be2a9.jpg

Next step, confirming, looks good...
https://user-images.githubusercontent.com/5155373/60538759-826ea080-9d0b-11e9-8557-e0f4bcb9371f.jpg

Next step, "All set"? But nothing in purchaseUpdatedListener()
https://user-images.githubusercontent.com/5155373/60538755-826ea080-9d0b-11e9-9e40-aa93b9f5ff33.jpg

Next step, requestSubscription('4.99') fails
https://user-images.githubusercontent.com/5155373/60538754-826ea080-9d0b-11e9-993e-482e1ac2908b.jpg

@jvandenaardweg
Copy link
Contributor

jvandenaardweg commented Jul 3, 2019

I've been doing some Google searching, found this from an Apple employee:

The problem which you have described leads me to ask - In the App Store Connect records for your application - what is the order of the subscription items within the subscription group. Is the 1 Week subscription plan an upgrade to the 3 month subscription? or vice versa? The ordering of the subscription items listed in the application records determines whether one subscription item is an upgrade or a downgrade to another item. Duration of subscription is not used to determine whether one subscription item is an upgrade or a downgrade to another subscription item.

@tybq93 have you checked the order of your subscription plans in iTunes Connect? 6 months needs to be on top of the 3 months, since it's an upgrade according to you. You can drag and drop to re-order in iTunes connect in your subscription group

Because of this, I think your current situation suggests a "downgrade" and why I think the problem you describe is related to my "downgrade" problem.

That Apple topic might also explain why I see the error on downgrade:

If the 3 month plan is a downgrade to the 1 week plan, then when the 1 week plan is currently active for a subscriber, then if the user attempts to "downgrade" to the 3 month plan, the iTunes Store should indicate to the user that the new plan will go into effect at the end of the current subscription. In this case, the user account has not been charged. The essence is that the transaction was not a success, but instead a failure. As there is no "user to be charged later" state, the App Store returns the failed transaction result.

I think "downgrading" / "crossgrading" is not testable on the Sandbox environment, but I can't confirm it just yet. Stackoverflow comments suggest it just does not work in Sandbox. But the error is really confusing and wonder if that's still there in Production. Guess the only way to find out is to put it in Production...

@maulikdhameliya
Copy link

@jvandenaardweg Hey man, thanks for your technical analysis. I am also getting this problem with the sandbox environment. Not sure if it will fix in the production environment or not. Did you have some luck finding out what is causing this problem and how to solve this?

@grubstarstar
Copy link

grubstarstar commented Oct 23, 2019

Also getting this issue in #803 any more insight into this? Any further pointers would be very much appreciated.

@denkeni
Copy link
Contributor

denkeni commented Dec 30, 2019

I have similar experience when implementing in-app purchase subscription in iOS native code. And I would suggest:

The iOS in-app purchase sandbox environment is really confusing and even buggy. Upgrading does work, and it should get receipt immediately. Downgrading only happens at next billing period, so does your downgrading receipt. But sandbox environment gives you "maximum 5 automatic renewals", which you cannot (easily) expect how many renewals will occur. What's more, you cannot cancel subscription in sandbox environment, because App Store subscription management page doesn't work in sandbox environment. These have made subscription testing really painful. Read more on my blog post Unpredictable Sandbox Environment for IAP Auto-renewable Subscriptions if you're interested.

I got "Cannot connect to iTunes Store" error message at quite a few scenarios (ex. tap some subscription plan), which was confusing for the users, and it does not help error handling at all. That was the reason I got rid of in-app page for upgrading/downgrading subscription on production app.

The iOS subscription implementation isn't complete without having your own server for validating receipt and receiving Server-to-Server Notifications. Because iOS users can switch or cancel subscription plans at any time or on any device, without entering the app (i.e. through App Store subscription management page). And you'd better not rely on getAvailablePurchases at every iOS app launch to check it, because iOS would prompt sign-in dialogue, which results in bad user experience (See: #747).

Abstraction does leak. Deal with it.

@hyochan hyochan removed the 👣 waiting for response Need feedback to continue label Dec 30, 2019
@grubstarstar
Copy link

grubstarstar commented Jan 22, 2020

I will get back to this in the next month or two hopefully and will let you know thE outcome @hyochan

@stale
Copy link

stale bot commented Apr 23, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the 🚶🏻 stale Stale label Apr 23, 2020
@stale
Copy link

stale bot commented May 23, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed May 23, 2020
@Mihai-github
Copy link

@jvandenaardweg did you find out how to solve this issue, I can confirm I'm having the same behavior try to upgrade works fine but trying to downgrade fails for me with the following error:

{
    "responseCode": "0",
    "code": "E_UNKNOWN",
    "debugMessage": "An unknown error occurred",
    "message": "An unknown error occurred",
    "productId": "_______"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙏 help wanted Extra attention is needed 📱 iOS Related to iOS 🚶🏻 stale Stale
Projects
None yet
Development

No branches or pull requests

7 participants