Apple's in-app purchase missing orders processing ideas

Payment process explanation

1. The client requests to purchase the product from Appstore, and after Appstore verifies the product successfully, the fee will be deducted from the client's Apple account.

2. Appstore returns a piece of receipt-data (receipt) to the client, which records the certificate and signature information of this transaction.

3. The client provides receipt-data to the server (backend) that we can trust

4. The server performs a base64 encoding on the receipt-data

5. Send the encoded receipt-data to itunes.appstore for verification

6.itunes.appstore returns the verification result to the server

7. The server sends corresponding props and push data update notifications to the client for the purchase status and type of the product

problem:

The above seven steps are actually a very safe payment process. Where is the problem?

The problem is that the return of in-app purchase bills is delayed, and the intermediate user may kill the process or enter the background operation.

One: Get the ticket, save it locally, and verify with the server

2: The verification is successful, delete the locally saved data. If it is not successful, verify again and try again.

3: When the APP restarts, if there is a local ticket, it will authenticate with the server, and if the authentication is successful, the ticket will be deleted.

Four: If the above process fails to solve the problem of missing orders, you can add a similar retrieve button in the APP to retrieve them based on the locally saved bills (process three).

Note: The server needs to create a form to record the bill data to avoid multiple in-app purchases.


Reference: https://www.jianshu.com/p/041cc4be7f26

Guess you like

Origin blog.csdn.net/Momo_Da/article/details/104960631