In-App Purchase Refresh receipt

Hi Guys,

I'm implementing Auto-renewebla subscription for my app.

we have a plans for user to access for one month, 3 months, 1 year.While registering user has to choos one of the plan.After registration user can upgrade/downgrade his plan through app.


As per appl guidelines we need to implement restore purchase in app.if i restore the purchase, i'll get all the purchased details, but how i know which plan is purchased recently?


Currently i'm using Receipt Verification API to get all the purchase details. in that response I'll array of purchased records, and last object will be the latest, so that i'll know last one latest and ill give access to the user based on purchased dates and end date.


How can achive this using restore purchase or refreshingreceipt?


Thank you in advance.

Replies

Initially when user purchase a subscription we will save subscription details in the BE.


1.Let say user 1 purchased 1 month plan with his apple id and his original transaction is 1234, we save that in BE DB.

2.User 2 purchased 6 months plan in device 2 his original transaction is 9876, will save that in BE DB.

3.Now user1 logged in to app with user1 app credentials in Device 2 which have Appstore credentials of user 2.

4.Now if i restore purchases in device 2 will get 6 months plan transaction id 9876, In application user1 will have transaction id 1234, when user tries to purchase another plan, we will . check both transaction ids,if they are not same will restrict the purchase, untill device 2 have user 1 appstore credentials.

>4.Now if i restore purchases


You ("i") should not restore purchases. Let the user using the device restore purchases. When they restoreCompletedTransactions or refresh the receipt the user will be asked to log into their Apple account. User 1 will log into user 1's account not user 2's account since user 1 does not know user 2's password. (If user 1 knew user 2's password then user 1 is user 2 for all intents and purposes.) Actually, the system might not allow user 1 to access restore functions on a device on which the app was installed under user 2's Apple ID - I'm not sure.

Here person is same same person can have multiple app user credentials right, and can have multiple Apple IDs.so he will know the Apple id passwords of both.

To avoid (If user 1 knew user 2's password then user 1 is user 2 for all intents and purposes.) i'll restrict the purchase based on Original_TransactionId.

But your case was:

1.user 1 purchased 1 month plan

2.User 2 purchased 6 months plan

3.

4.Now if (user1) restore purchases in device 2 will get 6 months


But if user1 is user2 then why not let the user 1/2 get the 6 months they purchased.

I just wantto keep the purchases are to be specific to respsective Apple ID.


Let say User1 Purchase 1 month plan today, I'm sending purchase to our BE to calculate the remaining days and saving plan details for future referance.Here remaing days is 30 days

If user2 purchases 6 months plan 5 months and 35 days ago, he can access plan only 5 days from now.

If user1 logged in Device 2 with AppleID 2, and restores the purchases, 6 months plan will be applied, I''m, sending purchase to our BE to calulate remaining dyas, now he can access app 5 days only right.


Ton handle this case, I'm trying to restrict the user to purchase subscription plan from another AppleID.


Please let me know if I'm wrong.