Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get some user Information when user buy some items on Apple In app purchase by swift?

I am working an app that has In app purchase function. And i need some unique user information when they make some purchases in order to store it on my Database for some reason.

So how can i get some info like email,username or userId from the purchased user?

Thanks!

like image 741
Varis Darasirikul Avatar asked Jul 17 '15 07:07

Varis Darasirikul


People also ask

Can in-app purchases be tracked?

How to track Android in-app purchases automatically from Google Play. For Android apps that use in-app billing, you can automatically track when someone who clicked your ad makes an in-app purchase. You don't need to add code to your app. The value of the purchase will automatically be reported as the conversion value.

How do I monitor in-app purchases?

Find and download apps purchased by you or family members or your profile picture at the top right, then tap Purchased. If you set up Family Sharing, tap My Purchases or choose a family member to view their purchases. Note: You can see purchases made by family members only if they choose to share their purchases.


2 Answers

You cannot obtain this information from the Apple purchase flow, so the answer depends on what you are trying to accomplish.

If you are selling a non-consumable item, such as a game unlock, Deepak's solution will work for you -- by providing a "restore" button in you application the user will be able to connect to their iTunes account from any of their devices and re-obtain the item.

If you are selling a consumable item, such as in-game currency, you should have the users register with your backend service and be authenticated when they make their purchase. Once you have verified the purchase you can write it to your database and you will be responsible for restoring their state regardless of the device they log in on.

Note that if you combine these approaches it would be possible, though unlikely, that a user could share a non-consumable purchase by using the same iTunes account but different accounts on your system by performing a Apple restore action. If you are managing your own inventory on a server, I recommend using consumables.

So the short answer is, if you want that information, you have to ask for it from the user.

like image 191
Ben Flynn Avatar answered Oct 19 '22 23:10

Ben Flynn


[Answer is valid if you have users registered with your system]The transactions can be restored based on user who has logged into your system ,please refer to link here then you can map the information from your system to the product you are selling via in-app purchase.

like image 27
Deepak Samuel Rajan Avatar answered Oct 20 '22 00:10

Deepak Samuel Rajan