gpt4 book ai didi

ios - 从 Cloud Code 解析 iOS 应用购买验证

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:58:14 24 4
gpt4 key购买 nike

几天以来,我一直在尝试在购买前保存(在沙盒上)上实现 iOS 应用内购买验证,但它总是失败。我用 postman 尝试了收据,它有效。

那么,就是Parse.Cloud.httpRequest的问题了。

我还尝试将收据直接放入 Cloud Code 中,但始终出现相同的错误 (21002)。 https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html

这是我的代码:

Parse.Cloud.httpRequest({
method: 'POST',
url:'https://sandbox.itunes.apple.com/verifyReceipt',
body:{'receipt-data':receipt},
success: function (httpResponse) {
console.log(httpResponse.text);
if (httpResponse.status == 0) {
// success
} else {
// error
}
},
error: function (httpResponse) {
// error
}
});

有人做过吗?

最佳答案

如果这是自动续订订阅?如果是这样,您错过了密码字段:

password Only used for receipts that contain auto-renewable subscriptions. Your app’s shared secret (a hexadecimal string).

在 jsonBody 中:

var jsonBody = {
"receipt-data" : reference,
"password" : "xxxxx"
};

你还应该对 POST BODY 进行 JSON 编码(下面的节点示例)

itunes_client.post("", {}, JSON.stringify(jsonBody), 

关于ios - 从 Cloud Code 解析 iOS 应用购买验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31452246/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com