A user makes in-app purchase, uses our services and then later on asks Apple to refund. Is there a way we can identify this refund and associate it with a user so that we can block him from using our system further.
How to find out if a user has got in-app purchase refunded
The IAP FAQ offers some relief:
Receipt
How do I use the cancellation_date field?
The Cancellation Date (
cancellation_date
) field is designed for use with auto-renewable subscription, non-consumable and non-renewing subscription products. This field is set when a customer contacts Apple customer support for a refund and the transaction is canceled. The utility of the cancellation_date
field is most useful with auto-renewing subscription products. After the refund is issued and the cancellation_date
field is added to the iTunes Server records for the user, there is no automatic update process for the application copy of the appStoreReceipt to be automatically updated. In the case of a receipt with an auto-renewing subscription product, validating the appStoreReceipt results in the iTunes Store verifyReceipt server providing the most current information about the auto-renewing subscription product in the latest_receipt_info field of the validated receipt.At present this support does not exist for validating appStoreReceipts which have non-consumable and non-renewing subscription products. After the refund event, validating the appStoreReceipt in the app will not reflect a refund for non-consumable and non-renewing subscription purchases. The iTunes Server can update the appStoreReceipt to show the
cancellation_date
, but an update event must occur. The appStoreReceipt is refreshed only in the following cases after the refund has occurred - when there is a successful purchase of an in-app purchase item, when the SKReceiptRefreshRequest
call is used and when the restoreCompletedTransactions
is used to restore previously purchased products.Important:
cancellation_date
is not currently added for consumable products....but how do you intend to ban users even if you blacklist them based on refunds?
Apple will rarely agree to a refund for a consumable IAP.
But if they do, there is no way for you to detect that refund in the receipt.
You can config with apple to receive refund related notifications https://developer.apple.com/documentation/appstoreservernotifications/notificationtype