Best way to associate mobile IAP purchase with a user in the cloud

I use Unity IAP to initiate a mobile purchase then verify the receipt in my own cloud and add an item to the user’s inventory in the cloud. This means that I need to send both the receipt and the user ID to the cloud, otherwise the cloud will not know who’s inventory to modify.
The problem is that the method IStoreListener.ProcessPurchase (which sends the receipt to the cloud) may not succeed immediately after purchase. So if user “A” made a purchase, then the method succeeded while user “B” is logged in, user “B” will receive the purchase instead.
How is that normally solved? I thought about using the payload parameter in IStoreController.InitiatePurchase, but it seems Apple store receipt does not include the payload.
I also thought about linking the transaction ID to the user ID via the playerprefs, but I am not sure how reliable that is.