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

iOS: requestPurchase does not initiate new subscription\purchase #2828

Open
servin-osm opened this issue Aug 27, 2024 · 7 comments
Open

iOS: requestPurchase does not initiate new subscription\purchase #2828

servin-osm opened this issue Aug 27, 2024 · 7 comments

Comments

@servin-osm
Copy link

Description
If user has expired subscription and tries to buy new one function requestPurchase returns old (expired) subscription without initiating new purchase.

Expected Behavior

if subscription is expired I expect to make new purchase

Environment:

  • react-native-iap: 12.15.2
  • react-native: 0.72.4
  • Platforms (iOS, Android, emulator, simulator, device): iOS

To Reproduce
Steps to reproduce the behavior:

  1. make subscription
  2. wait until it expired
  3. try to subscribe again
@Gnative
Copy link

Gnative commented Aug 27, 2024

@servin-osm I think you will find this is how it works with IOS. In the transaction you will see a purchase type of SUBSCRIBED and a subtype of RESUBSCRIBED.

On Android it will create a new purchase..

@servin-osm
Copy link
Author

@Gnative Could you please give me an example of how to use it? I dont see it in library documentation. I'm following this doc
https://react-native-iap.dooboolab.com/docs/get-started/

@Gnative
Copy link

Gnative commented Aug 28, 2024

@servin-osm its. I send my receipts to my backend for storage and referencing with app-store and play-store notifications, which is a topic outside of this package..

My receipt validation happens on the backend server which with app-store returns an array of receipts to work through to work out my current subscription status. Then I send back a 200 response which finalises the transaction on device with
await finishTransaction({purchase, isConsumable: [true|false]});

This purchase flow is outlined in this document.
https://react-native-iap.dooboolab.com/docs/guides/purchases
https://react-native-iap.dooboolab.com/docs/guides/receipts

Maybe others just handle this on device somehow but that is how I've done it and i think its the correct process. The Docs say receipt validation on device is not recommend in production

Just watch out for strange sandbox user issues in IOS, it always causes me problems and best to delete the sandbox user and start from scratch when testing.

Good luck

@servin-osm
Copy link
Author

thank you. will try it

@servin-osm
Copy link
Author

servin-osm commented Aug 30, 2024

@Gnative Hi. could you please tell me why on android I receive "Error: The service is unreachable. This may be your internet connection, or the Play Store may be down."
on await finishTransaction({purchase, isConsumable: false});
Could it be because of Test env (License testing)?

@Gnative
Copy link

Gnative commented Aug 30, 2024

@servin-osm I don't really know, I haven't see this error before.
Are you testing on device or on a virtual device.. does it have play store installed..

Check:

  • Are you passing a correct purchase reciept.
  • Did you get your store items with getSubscriptions or getProducts and using correct correct SKUS ?
  • Did you set the items in the store and have your apps bundle id the same as in the store..

Sorry @servin-osm but there is only so much help I can give as I have to work myself. I had to work through this library myself to figure things out. I don't know your code or setup.

@servin-osm
Copy link
Author

this is local build. and I added my account to license testing, so I can test payments locally.

  • yes, parameters looks goodu
  • sing getSubscriptions
  • yes.

thank you @Gnative , appreciate your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants