当我用沙箱测试应用程序内购买时,对sandbox url https://sandbox.itunes.apple.com/verifyReceipt的post请求返回。
data: { environment: 'Sandbox', status: 21003 }
21003状态代码表示无法对收据进行身份验证。https://developer.apple.com/documentation/appstorereceipts/status?language=objc
这是意料之中吗?我假设我的测试收据对于沙箱环境是有效的,并返回0的状态。
发布于 2021-06-23 00:52:32
不,这不是预料中的。我需要在密码字段中提供一个有效的代码,即使应用程序内的购买不是为自动更新订阅提供的。
发布于 2021-08-10 05:38:45
报告说,当您将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
的内容限制在最近的条目和
“密码”是表示当内容是自动更新订阅时所需的共享秘密的请求键。
是的-是共享的秘密
xxxx -是base64编码的appStoreReceipt
内容。
发布于 2022-09-26 10:20:46
也许有人需要我为此写的一个bash脚本。
#!/bin/bash
clear
green='\033[0;32m'
cyan='\033[0;36m'
noColor='\033[0m' # No Color
sig=$1
mode=$2
if [ -z "$mode" ];
then
PS3="Please select a mode: "
options=("Sandbox" "Production")
select opt in "${options[@]}"
do
case $opt in
"Sandbox") break;;
"Production") break;;
*) echo -e ${red}"\ninvalid option" \"$REPLY\"${noColor};;
esac
done
else
opt=$mode
fi
if [[ "$opt" == "Production" ]]
then
echo -e ${green}"Production selected"${noColor}
commandToExecute="curl -d '{\"receipt-data\":\"$sig\"}' https://buy.itunes.apple.com/verifyReceipt"
else
echo -e ${cyan}"Sandbox selected"${noColor}
commandToExecute="curl -d '{\"receipt-data\":\"$sig\"}' https://sandbox.itunes.apple.com/verifyReceipt"
fi
eval $commandToExecute
把它叫做./scriptName signatureToValidate
https://stackoverflow.com/questions/68050138
复制相似问题