Hello,
I'm trying to delete an in-app purchase via the App Store Connect API.
There is a DELETE method but it does not work when the in-app purchase is in "APPROVED" state and therefore on sale.
https://developer.apple.com/documentation/appstoreconnectapi/delete_an_in-app_purchase
I have to manually uncheck "Approved for sale" and then save to be able to make a DELETE call through the API.
I am missing something on the API side to do this action programmatically.
OK i found the solution.
First i have to "PATCH" availableInAllTerritories with URL https://api.appstoreconnect.apple.com/v2/inAppPurchases/:inappid with and InAppPurchaseV2UpdateRequest object.
Then state change to DEVELOPER_REMOVED_FROM_SALE and i can delete the inapp with DELETE method.