react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

iOS: requestPurchase does not initiate new subscription\purchase

Open servin-osm opened this issue 1 year ago • 7 comments

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

servin-osm avatar Aug 27 '24 15:08 servin-osm

@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..

Gnative avatar Aug 27 '24 17:08 Gnative

@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/

servin-osm avatar Aug 28 '24 13:08 servin-osm

@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

Gnative avatar Aug 28 '24 13:08 Gnative

thank you. will try it

servin-osm avatar Aug 28 '24 14:08 servin-osm

@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)?

servin-osm avatar Aug 30 '24 14:08 servin-osm

@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.

Gnative avatar Aug 30 '24 15:08 Gnative

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

servin-osm avatar Aug 30 '24 15:08 servin-osm

I’m closing all issues reported in versions below 14, as the library now supports the new architecture with NitroModules and has been completely revamped.

hyochan avatar Sep 30 '25 18:09 hyochan