Receipt verification Verification failed with status VERIFICATION_FAILURE

Hello team, There is a Function,App create a order;When the app is all paid out,it sends me a credentials; I accept and verify; verify_and_decode_signed_transaction function have an error;

requests.exceptions.ConnectionError: HTTPConnectionPool(host='ocsp.apple.com', port=80): Max retries exceeded with url: /ocsp03-applerootcag3 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1123c7d00>: Failed to establish a new connection: [Errno 61] Connection refused'))

The above exception was the direct cause of the following exception: appstoreserverlibrary.signed_data_verifier.VerificationException: Verification failed with status VERIFICATION_FAILURE

    def verify_purchase(self, request, *args, **kwargs):
        try:
            receipt_data = request.data.get('receipt_data')

            transaction_id = receiptUtilInstance.extract_transaction_id_from_app_receipt(receipt_data)

            sendResponse: TransactionInfoResponse = appleClientInstance.client.get_transaction_info(transaction_id)
            signedPayLoad: str = sendResponse.signedTransactionInfo
            time.sleep(3)
            payload = signedDataInstance.client.verify_and_decode_signed_transaction(signedPayLoad)

please help me

At first glance a few things stand out. Obviously you have a connection error (Connection refused). Assuming you are sure your internet connection is stable, did you verify in your terminal that you can reach ocsp.apple.com on port 80? I just tried it on my machine and it works.

% curl --verbose http://ocsp.apple.com/ocsp03-applerootcag3
* Host ocsp.apple.com:80 was resolved.
* IPv6: 2620:149:a0d:f100::2, 2620:149:a0d:f000::1
* IPv4: 17.253.120.201, 17.253.120.202
*   Trying [2620:149:a0d:f100::2]:80...
* Connected to ocsp.apple.com (2620:149:a0d:f100::2) port 80
> GET /ocsp03-applerootcag3 HTTP/1.1
> Host: ocsp.apple.com
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
< Server: Apple
< Date: Sun, 29 Sep 2024 22:52:28 GMT
< Content-Type: application/ocsp-response
< Content-Length: 5
< Age: 0
...

If it is an intermittent problem, you should add retry with exponential backoff or otherwise queue it for later.

Receipt verification Verification failed with status VERIFICATION_FAILURE
 
 
Q