如何区分实际的inApp和沙箱inApp?

时间:2018-07-03 06:42:59

标签: android in-app

在下面的代码中,在Apple上验证inApp收据时,我们收到状态码21007,该状态码表示这是Sandbox inApp的收据,然后我们使用Sandbox URL对其进行测试。

receipt_dict = json.loads(receipt)
request_data = json.dumps({"receipt-data": receipt_dict["Payload"]})

request = urllib2.Request(url=INAPP_URL_APPLE, data=request_data) 
request.add_header("Content-Type",'application/json')
response = urllib2.urlopen(request)

response_json = response.read()

if response.getcode() == 200 and json.loads(response_json)["status"] == 21007:
    # if receipt is a Sandbox, test it with Sandbox URL
    response = urllib2.urlopen(urllib2.Request(url=INAPP_URL_APPLE_SANDBOX, data=request_data))
    response_json = response.read()
    our_response['platform'] = IOS_SANDBOX

我想知道有什么方法可以区分Android上的Actual和Sandbox InApps吗?

0 个答案:

没有答案