Ich habe überprüft, dass alle Werte korrekt sind, erhalte aber weiterhin Folgendes:
Code: Select all
{
"environment": "Sandbox",
"status": 21003
}
Code: Select all
def verify_receipt(receipt_data: str, sandbox: bool = True) -> dict:
"""
Verify an App Store receipt with Apple's verification service
Args:
receipt_data: The base64 encoded receipt data
sandbox: Whether to use sandbox environment (default True)
Returns:
dict: The verification response from Apple
"""
# URLs for verification
SANDBOX_URL = "https://sandbox.itunes.apple.com/verifyReceipt"
PRODUCTION_URL = "https://buy.itunes.apple.com/verifyReceipt"
# Shared secret from App Store Connect
SHARED_SECRET = "xxx......"
# Prepare the verification URL
verify_url = SANDBOX_URL if sandbox else PRODUCTION_URL
# Prepare the request payload
payload = {
'receipt-data': receipt_data,
'password': SHARED_SECRET,
'exclude-old-transactions': True
}
response = requests.post(verify_url, json=payload)
result = response.json()
