validateReceiptIos always returns false
fabianunger opened this issue · comments
Version of react-native-iap
2.0.0-alpha3
(I tried 1.1.5 as well, same issue)
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
validateReceiptIos returns 0/1/true for valid receipts
Actual behavior
validateReceiptIos always returns false
Tested environment (Emulator? Real Device?)
Real device, sandbox app store
Steps to reproduce the behavior
I am able to make auto renewable subscription purchases successfully, and receive a transaction receipt. When I try to validate this on iOS using validateReceiptIos(receiptBody, true, 55) I always get returned false.
If I log JSON.stringify(res) I get:
{"status":21004, "environment":"Sandbox"}
There was a similar issue at #190
At which line are you inserting the log at? 🤔
also, what version of React Native are you running?
@fabianunger Strange. Should be fixed in #190. Could you share some codes?
"react": "^16.3.2"
"react-native": "^0.55.3"
validate = async (product) => {
try {
console.log(product);
const receiptBody = {
'receipt-data': product.transactionReceipt,
};
console.log(receiptBody);
const result = await RNIap.validateReceiptIos(receiptBody, true, 55);
console.log(result);
} catch(err) {
console.warn(err.code, err.message);
Alert.alert(err.message);
}
};
@fabianunger Could you try out this version and see if it gives you a more detailed error message?
npm install LinusU/react-native-iap#ios-validate
@LinusU @dooboolab
I just added the shared secret in the receiptBody and now it seams to work out.
Maybe I just missed it somewhere in the docs? Or is that not the way it is supposed to happen?
const receiptBody = {
'receipt-data': product.transactionReceipt,
'password': '*********'
};
(still using version 2.0.0-alpha3)
@LinusU
I tested it also with your version: Same outcome.
As a response I get {"status":21004, "environment":"Sandbox"}.
Works by adding the shared secret as the 'password' within the receiptBody. In general: Is this the regular way anyway?
@fabianunger You've done it right. For more information ref here. Will be good to update the doc tough.
What is the shared secret
and where can I find it?
What is the
shared secret
and where can I find it?
https://www.appypie.com/faqs/how-can-i-get-shared-secret-key-for-in-app-purchase
Validate Reciept in Production Mode returning {status: 21007} , can anyone help mw with this.
Thanks in advance
Look here:
"21007: This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead."
use this address for test environment verification: https://sandbox.itunes.apple.com/verifyReceipt