Я пытаюсь отправить receipt
на мой Node.js server
.В настоящий момент он печатает receipt-data
в базе данных огня, что указывает на то, что он получил его из запроса POST
, который я отправил с моего iOS App
.Однако я не могу правильно передать свой код, который будет проверен в const receipt = request.body;
.Как я могу передать это правильно?Благодарю.
exports.receiptValidation = functions.https.onRequest((request, response) => {
const receipt = request.body;
console.log(receipt);
iap.config({
applePassword: 'MySharedAppleKey',
test: true
});
iap.setup((error) => {
if (error) {
console.log('Failed to validate receipt', error);
}
});
iap.validate(receipt).then((pResponse) => {
//Check if receipt is valid
if (iap.isValidated(pResponse)) {
console.log('The receipt is valid', pResponse);
response.send(pResponse);
}
return pResponse;
})
.catch((error) => {
console.log(`Sorry couldn't validate receipt`, error);
response.send(error);
return error
});
});
Вот мой вывод в Firebase.Я использую firebase function
