iosin-app-purchaseapp-store-connectapp-store-connect-api

Unknown Error trying to add Pricing to a In App Purchase String


I am trying to automated the upload of In app purchase string via the new iTunes Connect API endpoints. I have successfully called the Create InAppPurchase but now trying to add the pricing tier with a call to inAppPurchasePriceSchedules ( https://developer.apple.com/documentation/appstoreconnectapi/add_a_scheduled_price_change_to_an_in-app_purchase ) but it is failing.

I am getting an "UNEXPECTED_ERROR" message and to contact apple if the problem continues

{
   "errors":[
      {
         "status":"500",
         "code":"UNEXPECTED_ERROR",
         "title":"An unexpected error occurred.",
         "detail":"An unexpected error occurred on the server side. If this issue continues, contact us at https://developer.apple.com/contact/."
      }
   ]
}

I am not sure what I am doing wrong? I might have missed exactly what I need to be doing. I am finding it hard to understand this API endpoint as its asking for a ID of a price point which I get by calling one of the other endpoints for price points. But when I call it requesting Tier 6, I am returned with 175 results for a single tier (it seems one per territory for that single tier 6). So then, do I need to include 175 pricing tiers to the endpoint I am getting an error for? I have tried adding a single tier and also all 175 but it still gives the same error Adding to my confusion,

I have found the examples shown on this page ( https://developer.apple.com/documentation/appstoreconnectapi/app_store/in-app_purchase/managing_in-app_purchases ) do not match the OpenAPI/Swagger definition for the inAppPurchasePriceSchedules endpoint, for example the example shows a property prices but swagger has a manualPrices property in the data.relationships section.

The Request I am Making

[POST] v1/inAppPurchasePriceSchedules

   "data":{
      "type":"inAppPurchasePriceSchedules",
      "relationships":{
         "inAppPurchase":{
            "data":{
               "type":"inAppPurchases",
               "id":"1640694240"
            }
         },
         "manualPrices":{
            "data":[
               {
                  "type":"inAppPurchasePrices",
                  "id":"${price1}"
               }
            ]
         }
      }
   },
   "included":[
      {
         "attributes":{
            "startDate":null
         },
         "relationships":{
            "inAppPurchaseV2":{
               "data":{
                  "type":"inAppPurchasesV2",
                  "id":"1640694240"
               }
            },
            "inAppPurchasePricePoint":{
               "data":{
                  "type":"inAppPurchasePricePoints",
                  "id":"eyJzIjoiMTY0MDY5NDI0MCIsInQiOiJHQlIiLCJwIjoiNiJ9"
               }
            }
         },
         "type":"inAppPurchasePrices",
         "id":"${price1}"
      }
   ]
} 


Solution

  • The problem for me was that the Type value of include.relationships.inAppPurchaseV2 should have been "inAppPurchases" not "inAppPurchasesV2"