how to get price of an in app purchase item on my server using product id - in-app-purchase

I have a receipt verification server. iOS application sends me the receipt, I validate the receipt using Apple's api, and I return a json with the required fields for the app. In the process if the user's subscription is started, I want to log that subscription with the price of the product. However I do not have the information for the price in the receipt. I just have product id. Is there an API for me to just ask Apple for the price of a given product id?
Thanks in advance

If you have access to AppStoreConnect for your application, you can use the AppStoreConnect API to drill down to prices for product IDs, it requires you to set up a shared secret to make use of the API:
https://developer.apple.com/documentation/appstoreconnectapi

I am facing the same problem. AppStore api does not provide prices for products or not even provide prices for Tiers.
But you can get the price of the products from your client end. So on the client-side, when a purchase is successful, post the product's price and transactionId. This way you can match the transactionId and know the price of that sale. But you have to be aware of the price differences. SKProduct only gives you localized price, so your obtained info from client will be localized. You have to convert them to the same currency to have a meaningful result.

Related

How to verify ios In-App Purchase with different account?

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.

Get subscriber id from in-app purchase

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

How to verify subscription of user from developer account of iTunes?

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

Is it possible to refresh the receipt of an in-app subscription from an iTunes API?

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.

Auto-renewable subscription, how to get the user (client) email address and zip code?

How can I get the user email address and his zip code address when I'm validating an receipt got from an auto-renewable item receipt?
When the user buys my item he has to agree with providing me contact data like email, zip code and so on... but so far I found no way to get the email using the StoreKit API.
You can find informations about a new tool published by Apple in order to download Opt-In Reports, containing informations about user subscriptions infos, here : AppStoreReportingInstructions.pdf See 3.2. Auto-Ingest Tool

Resources