The answer is in the Instant Payment Alert service.
Upon completion of the transaction, PayPal notifies you in a separate process of the payment details for the last transaction.
You can check this data for data stored locally. If they match, everything is in order. If they do not match, you will need to examine the problem.
I never understood why PayPal does not allow data to be signed with some kind of hash + shared secret ... but this will not help you in the future.
If you send variables to PayPal, you can encrypt the data. Unfortunately, this is not possible for a GET request caused by a redirect.
Jacco source share