How to set the initial price for in-app purchases using the App Store Connect API

I have read the API sample.

I have no problem creating in-app billing and localization.

However, there is something unclear about the initial price setting procedure for that in-app purchase.

To set prices, use "POST /v1/inAppPurchasePriceSchedules".

An example of payload is as follows.

{
  "data": {
    "type": "inAppPurchases",
    "id": "6446452615",
    "attributes": {},
    "relationships": {
      "prices": {
        "data": [
          {
            "type": "inAppPurchasePrices",
            "id": "${price1}"
          }
        ]
      }
    }
  },
  "included": [
    {
      "type": "inAppPurchasePrices",
      "id": "${price1}",
      "attributes": {
        "startDate": null
      },
      "relationships": {
        "inAppPurchaseV2": {
          "data": {
            "type": "inAppPurchasesV2",
            "id": "6446452615"
          }
        },
        "inAppPurchasePricePoint": {
          "data": {
            "type": "inAppPurchasePricePoints",
            "id": "NjQ0NjQ1MjYxNV91c181"
          }
        }
      }
    }
  ]
}

It seems to me that "${price1}" suddenly appeared.

How do I get the id that I should set to "${price1}"?

Or is "${price1}" any value created by the developer?

Replies

The inAppPurchasePriceSchedules payload example seems wrong. The example is also different from the API specification..

In my environment, it worked with the following contents. (The values are changed according to the example.)

{
     "data": {
         "type": "inAppPurchasePriceSchedules",
         "relationships": {
             "inAppPurchase": {
                 "data": {
                     "type": "inAppPurchases",
                     "id": "6446452615"
                 }
             },
             "manualPrices": {
                 "data": [
                 {
                     "type": "inAppPurchasePrices",
                     "id": "ABCDSJOFDSFJDSI"
                 }]
             }
         }
     },
     "included": [
     {
         "type": "inAppPurchasePrices",
         "id": "ABCDEFGHIJKL",
         "attributes": {
             "startDate": null
         },
         "relationships": {
             "inAppPurchaseV2": {
                 "data": {
                     "type": "inAppPurchases",
                     "id": "6446452615"
                 }
             },
             "inAppPurchasePricePoint": {
                 "data": {
                     "type": "inAppPurchasePricePoints",
                     "id": "NjQ0NjQ1MjYxNV91c181"
                 }
            }
        }
    }]
}

Also, in setting the initial prices, the inAppPurchasePrices id was required but had no meaning.

Works with any value, eg "ABCDEFGHIJKL".

And Apple ignores the "ABCDEFGHIJKL" and gives inAppPurchasePrices an ID like "eyJpIjoiMTYzNzYwN.....".

Hello

Is your code still working ?

I tried to post to https://api.appstoreconnect.apple.com/v1/inAppPurchasePriceSchedules but i have an 422 Unprocessable Entity Response.

I'm not sure about the id ABCDEFGHIJK and ZYXWVUTSRQP, as you wrote i filled it with "random" chars.

Thanks,

Yathus