hyochan / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.hyo.dev
MIT License
2.85k stars 647 forks source link

getProducts response payload has missing fields on android #2154

Closed fitimbytyqi closed 1 year ago

fitimbytyqi commented 1 year ago

Description Hey guys, thanks for creating this awesome package and always thankful for the supporting you give.

I'm having a weird issue calling getProducts function. The response that comes from android has some missing fields (two of them which are price and currency) unlike response from IOS.

Expected Behavior When calling getProducts, I expect the response to have the same fields from ProductCommon type which both ios and android extends from.

Screenshots This is the response when calling from android.

Screen Shot 2022-12-06 at 10 37 03

This is the response when calling from ios (same products).

Screen Shot 2022-12-06 at 10 39 18

As you can see price and currency are missing in android payload.

Environment:

To Reproduce Steps to reproduce the behavior:

  1. Call getProducts from useIAP hook.
  2. Console.log(products);
  3. Notice that the response is a bit different regarding some fields

Additional Context I'm not sure if this is a package issue or the configuration on playstore/appstore but Im sure i've set the prices and currency for the iap products.

Also as you can notice the price is 9.99EUR but in the response payload is returning the price in dollar.

Screen Shot 2022-12-06 at 10 44 27
andresesfm commented 1 year ago

Hello @fitimbyttyqi, For The billing client 5 update, Google added two objects: oneTimePurchaseDetails and subscriptionDetails. As such now you have to get the desired values from either of them depending on the product type. I hope this helps

fitimbytyqi commented 1 year ago

@andresesfm Thanks a lot for the information.

One more question, about the price, I've set the currency to EUR for each product but its returning $, any idea why is that happening?

I'm assuming this has to do with my playstore Test account which probably has the location set to US or something like that?

andresesfm commented 1 year ago

Your screenshot of the price in EUR doesn't match the product Id of the json response

fitimbytyqi commented 1 year ago

@andresesfm Yeah, but there is a product underneath with that Id and different price, I just didn't screenshot them all.

Do you think that has to do with PlayStore location ? the way the currency in response returns?

andresesfm commented 1 year ago

@andresesfm Yeah, but there is a product underneath with that Id and different price, I just didn't screenshot them all.

Do you think that has to do with PlayStore location ? the way the currency in response returns?

It's based on the device location

fitimbytyqi commented 1 year ago

@andresesfm Okay, thanks a lot once more for the explanation :)