我已经完成了一个iPhone应用程序,该应用程序使用IAP销售其订阅,为此,我已经采取了所有必要的步骤,并且工作正常。
我只需要知道我应该使用哪个URL来验证服务器端的收据?
当我开发应用程序并测试IAP时,我正在使用:
“https://sandbox.itunes.apple.com/verifyReceipt”
现在我已经提交了我的申请和IAP供审查,Apple将在哪个环境下测试我的IAP?我是否需要将URL更改为:
“https://buy.itunes.apple.com/verifyReceipt”
答案 0 :(得分:3)
查看Apple的technotes,转到“常见问题解答”,然后向下滚动到第15位。 它说:
- 使用沙箱网址 https://sandbox.itunes.apple.com/verifyReceipt 在测试您的应用程序时 沙盒和,而您的应用程序是 正在审核。
- 使用生产网址 https://buy.itunes.apple.com/verifyReceipt 一旦你的申请生活在 App Store。
答案 1 :(得分:1)
Mugunth Kumar在他的MKStoreKit中做到的方式是:
#ifndef NDEBUG
#define kReceiptValidationURL @"https://sandbox.itunes.apple.com/verifyReceipt"
#else
#define kReceiptValidationURL @"https://buy.itunes.apple.com/verifyReceipt"
#endif
这一直对我有用。我在我的应用程序方面这样做。
更新:
但是,这是同一技术说明TN2259发现here的实际正确答案:
How do I verify my receipt (iOS)? Always verify your receipt first with the production URL; proceed to verify with the sandbox URL if you receive a 21007 status code. Following this approach ensures that you do not have to switch between URLs while your application is being tested or reviewed in the sandbox or is live in the App Store. Note: The 21007 status code indicates that this receipt is a sandbox receipt, but it was sent to the production service for verification.
因此,正确的方法是始终首先检查实时URL上的收据,如果您返回状态代码21007,请再次检查沙箱网址。然后,您将知道它是否已经过验证,以及它是否已在实时服务器或沙箱中验证。我们将收据发送到我们的服务器,并从那里完成此检查,这使用户无法使用重定向漏洞。然后,如果它检出并且将事务记录在数据库中,我们的服务器会将一个秘密发送回应用程序。此外,我们可以跟踪每天发生的黑客攻击次数。
答案 2 :(得分:0)
请注意,正如上面提到的@Mark,文档不正确或过时 - 我向Apple提交了一份错误报告。
生产网址为https。
https://buy.itunes.apple.com/verifyReceipt
。
您可以通过请求来验证URL,它应该返回一个JSON字符串,如
{"status":21000}
花了我两张加急评论;)