2.4.6
0.57.1
Android
validateReceiptAndroid() should return a response
Error returned that simply reads "Error"
Real device. Other iap methods work on the device.
const purchase = await RNIap.buySubscription('my_product_code')
if (Platform.OS === 'android') {
const productToken = purchase.purchaseToken
const productId = purchase.productId
const packageName = 'my.package.name'
API.getToken(userToken).then(response => {
const accessToken = response.data.access_token
const validationData = {
packageName,
productId,
productToken,
accessToken,
isSubscription: true
}
// I've also tried entering params without the object
RNIap.validateReceiptAndroid(validationData).then(response => {
console.log(JSON.stringify(response))
}).catch(e => console.log(e))
}).catch(e => console.log(e))
}
I've determined that it is likely an access token issue. Would be great if this returned more detailed error messages.
@bethshook Is this solved? I hope you can post some great article or link like here written in Korean to share the working example with others.
@hyochan Still not solved unfortunately. For now I've removed Android receipt validation.
i checked an error by rectotron and it said 'Login required' from the error response
Do not do any kind of receipt validation on client side. It's not safe and recommended. All receipt validation should be done on backend.
You do not need this library to do any kind of validation. In fact, it would be good idea to remove receipt validation from this library, as validation is not that trivial and deserves to be in a separate lib.
Use this for backend: http://github.com/voltrue2/in-app-purchase
Do not do any kind of receipt validation on client side. It's not safe and recommended. All receipt validation should be done on backend.
You do not need this library to do any kind of validation. In fact, it would be good idea to remove receipt validation from this library, as validation is not that trivial and deserves to be in a separate lib.
Use this for backend: http://github.com/voltrue2/in-app-purchase
agree
@bethshook
I am stuck on this code
API.getToken(userToken).then(response => {
const accessToken = response.data.access_token
I want to get somehow the accessToken from the frontend and not occupy with the backend at all.
@thodwris This may help you.
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.
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.
I have faced the same issue. I write down the solution here please check this link it may help you to solve your problem
https://github.com/dooboolab/react-native-iap/issues/1217#issuecomment-769629880
Most helpful comment
I've determined that it is likely an access token issue. Would be great if this returned more detailed error messages.