iosapp-store-connectitunes-app

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?


Solution

  • 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.