沙盒环境returns 21003 收据验证状态码

Sandbox environment returns 21003 status code for receipt validation

当我使用沙盒测试应用内购买时,post 请求沙盒 url https://sandbox.itunes.apple.com/verifyReceipt returns

 data: { environment: 'Sandbox', status: 21003 }

21003状态码表示收据无法验证。 https://developer.apple.com/documentation/appstorereceipts/status?language=objc

这是预期的吗?我假设我的测试收据将被视为对沙盒环境有效并且 return 状态为 0。

不,这不是预期的。我需要在密码字段中提供有效代码,即使应用内购买不是针对自动续订订阅。

您报告说,当您将 appStoreReceipt 发送到 verifyReceipt 端点时,您会看到状态结果 21003。此状态表明 appStoreReceipt 格式错误、不完整或编码不正确。您能否捕获 base64 编码的 appStoreReceipt 并将内容作为文本文件发送给我,以便我手动验证内容。如果您的应用程序出售自动续订订阅项目,请包含该应用程序的共享密钥。我使用以下 curl 命令行工具来验证 appStoreReceipts.

对于沙盒收据:

curl -d '{ "exclude-old-transactions": true "password":"yyyy" "receipt-data": "xxxx"}' https://sandbox.itunes.apple.com/verifyReceipt

对于生产收据:

curl -d '{ "exclude-old-transactions": true "password":"yyyy" "receipt-data": "xxxx"}' https://buy.itunes.apple.com/verifyReceipt

其中 exclude-old-transactions 用于将 latest_receipt_info 的内容限制为仅最近的条目和

“密码”是请求密钥,用于指示内容为自动续订订阅时所需的共享密钥。

yyyy - 是共享秘密并且
xxxx - 是 appStoreReceipt.

的 base64 编码内容