I am facing one issue. I have integrated iOS in-app purchase plugin in my Cordova phone-gap app. In-app purchase plugin is working fine but sometimes due to some issues subscription will be paid but I am not able to get return response on server side because it will not hit my server side file where I have add API to fetch response but its subscription will be paid and user will receive receipt with order ID, Document Number.
Now the question is how do I verify from my iTunes developer account that user is subscribed or not. In my sales report I will get only subscriber ID field and not getting any order ID, receipt Number etc.
So is there any alternate way to verify user's subscription status?
Thanks
Related
I'm developing an app with non-consumable products. My app need to register and log in for service.
I figure out that the products that user has bought are tied with Apple ID. If user use same Apple ID but different accounts from my server, how will I verify them whether the account buy the product or not?
I have used original_transaction_id to validate it.
Steps-
When any user make a payment, validate the receipt on server.
If a valid payment then update paid in your database and store
original_transaction_id of that receipt.
Next time if the user use same Apple ID, after validating the receipt, check if the original_transaction_id exists in the database or not. If already
exists means user is using same Apple ID for other accounts too,
else its using its Apple ID to make payment first time.
The logic of the app.
You register with login password. Then if you doesn't have subscription (checked by server) you go to "Buy subscription page".
Problem.
I register user1. buy subscription. token1 goes to server.
I register user2. as he doesn't have subscription he goes to "Buy subscription page", clicks "Buy", apple says "You already bought subscription" and gives token2 (why does it give different token?)
var receiptUrl = NSData.FromUrl(NSBundle.MainBundle.AppStoreReceiptUrl);
return receiptUrl.GetBase64EncodedString(NSDataBase64EncodingOptions.None);
token2 goes to server. As a result we have 1 bought subscription but 2 users that use the same subscription.
Is there any way to identify itunes of user? to save along the token and be able to check if that itunes user already bought subscription for some server side account
This is a fundamental problem in StoreKit receipts and I think most developers don't realize it.
The problem is that Apple doesn't give developers a way to identify which iTunes account a receipt belongs to. This makes it trivial for a user to share their iTunes credentials with other users and unlock subscriptions.
The correct way to handle this is to, in your database, store the actual transaction_id from the Apple verifyReceipt response, and ensure it is unique in your database. This is a lot of work, so it may not be worth it.
It is further complicated by the fact that sometimes, you want an iTunes account to be usable with different app side accounts. For example if a user creates an account and purchases a subscription, lets the subscription expire, then later creates a new account and tries to purchase again, it should be permitted, even though the same receipt is now being used by multiple accounts.
If you don't want to deal with it, I have a service that handles all these edge cases automatically.
I have created a small app that has in-app subscription products.
I want to fetch the subscriber ID via API after the transaction has occurred. I searched extensively and found that this ID is available only in a report "Subscriber Report"
Subscriber ID | BigInt | The randomly generated Subscriber ID that is unique to each customer and developer
Is there a receipt response where this ID might be available? Can I map transaction id received in the receipt response to a subscriber?
Thanks!
No, the subscriber ID in Apple "Subscriber Report" is internal so the information is actually anonymous.
Looking on the bright side in wwwdc 2017 apple announced that they will provide the subscription details for users as part of the receipt so you will be able to get all the information in the subscriber report for a given user. See the part on 'Voluntary Churn' in https://medium.com/joytunes/wwdc-2017-amazing-new-features-for-subscriptions-676662a7d993
I have a backend api that accepts the receipt hash data from client ios devices when an iTunes subscription is purchased. I use https://buy.itunes.apple.com/verifyReceipt to verify the receipt data from Apple and to get the subscription details such as transaction id, expiration date etc.
It seems based on this post that I need to refresh such receipts to discover whether or not there is a cancellation_date. Other than doing this from an ios device as described in the developer docs, is there any other way to call an itunes endpoint from the server-side?
Send the receipt itself and have the server store it. Then, re-send the receipt from the server as often as needed to check for subscription updates.
Apple docs:
Persisting Using Your Own Server
Send a copy of the receipt to your server along with some kind of credentials or identifier so you can keep track of which receipts belong to a particular user. For example, let users identify themselves to your server with an email or user name, plus a password. Don’t use the identifierForVendor property of UIDevice—you can’t use it to identify and restore purchases made by the same user on a different device, because different devices have different values for this property.
The documentation for how to validate a receipt on the server side may be helpful here as well.
In My application I am using consumable in-app-purchase for SMS credit and managing this credit from my server. Application send me the receipt of transaction on server and I verify on server.
But in one of transaction receipt is not received to server but customer money is deducted. So there is any way to verify the purchase on iTunes. So I can check and add balance to client account.
Please suggest.
I know its not a technical question but its related to developer.