How do you determine the customer/user when receiv

2019-05-31 23:41发布

问题:

So, Apple has implemented their server to server notification for various events in the subscription lifecycle.

I was very excited to get going on this but then it seems there is some sort of glaring thing I'm missing. I'm not sure how to match the notification data to a user on my side. I'm surprised there isn't a uid/apple id passed with the notification to match on. Maybe I'm supposed to be using the original_transaction_id but its unclear whether that is unique.

Does anyone know what to use in the status response?

回答1:

I use the original_transaction_id to match the event to a user.



回答2:

Apple will send to your server a receipt_data. In receipt_data will have original_transaction_id. But If you just only have original_transaction_id received from apple, you couldn't detect who is buyer this item. So in my opinion, Your server need store an unique id between original_transaction_id and user_id. When apple send receipt_data to hook that you set up to receive apple statusUpdateNotification, you will get user_id from match with original_transaction_id to put data into your database.