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

Issue for receipt validation in Android #1262

Closed
avrutisavaliya-logistic opened this issue Feb 23, 2021 · 15 comments
Closed

Issue for receipt validation in Android #1262

avrutisavaliya-logistic opened this issue Feb 23, 2021 · 15 comments
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed

Comments

@avrutisavaliya-logistic
Copy link

avrutisavaliya-logistic commented Feb 23, 2021

Version of react-native-iap

5.2.11

Version of react-native

0.63.4

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

Android

Tested environment (Emulator? Real Device?)

Real device

Steps to reproduce the behavior

const result = await RNIap.validateReceiptAndroid(
purchases.packageNameAndroid,
purchases.productId,
purchases.purchaseToken,
token,
true,
);
debugLog('result', result);

AccessToken

    'ya29.c.Kp0B8wcvHchb91nouXpvbj17Mu5w2Aev48E0eRXh0oyE-_8crm_7sLZB1n5ENCfgwshWPp9CWHRfCdKHUX9YLBgrITjJ52FcNPAZH6R5HXsvvZpn7LaTt-UB1szOdda4RbwVs9yY82zykCc_zl8Oe4QhWBI0bjrG0xN18Gf5qOVjVCt1-4D9zetO-BtvK6qw6TuuW0gHDgQ8ccjkUDvpnQ'

Error

           gives error Possible Unhandled Promise Rejection (id: 3): Error
@hyochan
Copy link
Owner

hyochan commented Feb 23, 2021

Are you sure that the error is from validateReceiptAndroid?

@hyochan hyochan added 👣 waiting for response Need feedback to continue 🙏 help wanted Extra attention is needed 🤖 android Related to android labels Feb 23, 2021
@avrutisavaliya-logistic
Copy link
Author

#1262 (comment)
yes @hyochan this error is comming from this function call

@hyochan
Copy link
Owner

hyochan commented Feb 24, 2021

Looks like you need to catch it. Your response is currently returning error

@avrutisavaliya-logistic
Copy link
Author

avrutisavaliya-logistic commented Feb 24, 2021

await RNIap.validateReceiptAndroid(
purchases.packageNameAndroid,
purchases.productId,
purchases.purchaseToken,
token,
true,
)
.then((res) => {
debugLog(res);
})
.catch((error) => {
debugLog('error', error);
});

error Error
at index.js:855
at step (index.js:32)
at Object.next (index.js:13)
at fulfilled (index.js:4)
at tryCallOne (core.js:37)
at core.js:123
at JSTimers.js:274
at _callTimer (JSTimers.js:130)
at _callImmediatesPass (JSTimers.js:181)
at MessageQueue.callImmediates [as _immediatesCallback] (JSTimers.js:441)

{

'also this link gives me error' 

Subscription check

"error": {
"code": 403,
"message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
"errors": [
  {
    "message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
    "domain": "androidpublisher",
    "reason": "projectNotLinked"
  }
]

}

please help me to figure this out

@avrutisavaliya-logistic
Copy link
Author

@hyochan
Copy link
Owner

hyochan commented Feb 25, 2021

Thanks for the report. Fixed in 5.2.13 and 6.0.0-rc.23 Next time please give a PR!

@hyochan hyochan removed the 👣 waiting for response Need feedback to continue label Feb 25, 2021
@BStenfors9119
Copy link

Upgraded to 5.2.13 then RC 6.0.0-rc.23 but still getting the error of "Possible Unhandled Promise Rejection" when calling validateReceiptAndroid.

Not sure if the signature changed but here is my line calling the method:

let validReceipt = await RNIap.validateReceiptAndroid("product.name", receipt.productId, receipt.purchaseToken, accessKey, true);

Current Versions:
React: 16.11.0
RN: 0.62.0
RN-IAP: 6.0.0-rc.23

TIA,
B

@hyochan
Copy link
Owner

hyochan commented Mar 1, 2021

Upgraded to 5.2.13 then RC 6.0.0-rc.23 but still getting the error of "Possible Unhandled Promise Rejection" when calling validateReceiptAndroid.

Not sure if the signature changed but here is my line calling the method:

let validReceipt = await RNIap.validateReceiptAndroid("product.name", receipt.productId, receipt.purchaseToken, accessKey, true);

Current Versions:
React: 16.11.0
RN: 0.62.0
RN-IAP: 6.0.0-rc.23

TIA,
B

@BStenfors9119 Have you removed the cache and try again? Try removing node_modules and restart

@BStenfors9119
Copy link

Upgraded to 5.2.13 then RC 6.0.0-rc.23 but still getting the error of "Possible Unhandled Promise Rejection" when calling validateReceiptAndroid.
Not sure if the signature changed but here is my line calling the method:
let validReceipt = await RNIap.validateReceiptAndroid("product.name", receipt.productId, receipt.purchaseToken, accessKey, true);
Current Versions:
React: 16.11.0
RN: 0.62.0
RN-IAP: 6.0.0-rc.23
TIA,
B

@BStenfors9119 Have you removed the cache and try again? Try removing node_modules and restart

Ahhhh, good thinking will do that right now.

By the way just wanted to extend my appreciation for this module.
Dealing with financial transactions are such a PITA and thankful you and the folks involved have created this module.

Will report back on clearing node_modules.

Cheers,
B

@BStenfors9119
Copy link

@hyochan no such luck deleting the node modules and reinstalling them.

Still getting the same exception when trying to validate a android receipt.

This is the error it is returning:
{"statusCode":401,"line":160476,"column":69,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false"}

TIA,
B

@BStenfors9119
Copy link

@hyochan no such luck deleting the node modules and reinstalling them.

Still getting the same exception when trying to validate a android receipt.

This is the error it is returning:
{"statusCode":401,"line":160476,"column":69,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false"}

TIA,
B

Sorry for the confusion and totally embarrassed.
This was a ID-10-T error, I was pointing at the wrong URL to get my access key :( (face palm).

This is working as expected using version 5.2.13.

Sorry for any wasted time :/.

B

@edersonfaccin
Copy link

@BStenfors9119 I have the same problem, I am successfully generating accessToken on the backend with nodejs, but the return from validateReceiptAndroid is returning {"statusCode":401,"line":1124,"column":69}.

And if put the url in browser returns bellow

{
"error": {
"code": 401,
"message": "The current user has insufficient permissions to perform the requested operation.",
"errors": [
{
"message": "The current user has insufficient permissions to perform the requested operation.",
"domain": "androidpublisher",
"reason": "permissionDenied"
}
]
}
}

I am using
react 16.13.1
react-native 0.63.4
react-native-iap 5.2.14

Thank you very much if you could help me

@phillmill
Copy link

@edersonfaccin I had this issue as well but was able to resolve by simply saving one of my in app purchases. Weird I know, but it started working after doing that.

I also have heard that changing permissions in Google Play can take 24 hours to propogate too

@MohammedTahirr
Copy link

Hi, where do we get the access token from?

@ahaseeb001
Copy link

anyone solved this issue ???????????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Related to android 🙏 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants