App Store Connect API: Modify an Auto-Renewable Subscription to change prices for all territories

Hello,

I want to update the prices in all territories of an auto-renewable subscription at once (in a single request). I know it's possible to do it territory by territory using the Create a Subscription Price Change API endpoint, but this means I need to call this API for every territory. And I have a lot of subscriptions I need to update.

There is an another API endpoint that seems to allow to Modify an Auto-Renewable Subscription.

For the countries where I want to change the price, I fetch the subscription price points using the List All Price Points for a Subscription API endpoint.

When I call this API endpoint with the following body (that is the expected body content for this endpoint):

{
  "data": {
    "type": "subscriptions",
    "relationships": {
      "prices": {
        "data": [
          {
            "id": "eyJzIjoiNjc0MDAyMTQ5NiIsInQiOiJDQU4iLCJwIjoiMTAwMDEifQ",
            "type": "subscriptionPrices"
          },
          {
            "type": "subscriptionPrices",
            "id": "eyJzIjoiNjc0MDAyMTQ5NiIsInQiOiJVU0EiLCJwIjoiMTAwMDEifQ"
          }
        ]
      }
    },
    "id": "6740021496"
  },
  "included": [
    {
      "relationships": {
        "subscriptionPricePoint": {
          "data": {
            "id": "eyJzIjoiNjc0MDAyMTQ5NiIsInQiOiJDQU4iLCJwIjoiMTAwMDEifQ",
            "type": "subscriptionPricePoints"
          }
        },
        "territory": {
          "data": {
            "type": "territories",
            "id": "CAN"
          }
        },
        "subscription": {
          "data": {
            "id": "6740021496",
            "type": "subscriptions"
          }
        }
      },
      "id": "eyJzIjoiNjc0MDAyMTQ5NiIsInQiOiJDQU4iLCJwIjoiMTAwMDEifQ",
      "attributes": {
        "preserveCurrentPrice": true
      },
      "type": "subscriptionPrices"
    },
    {
      "attributes": {
        "preserveCurrentPrice": true
      },
      "id": "eyJzIjoiNjc0MDAyMTQ5NiIsInQiOiJVU0EiLCJwIjoiMTAwMDEifQ",
      "type": "subscriptionPrices",
      "relationships": {
        "subscription": {
          "data": {
            "type": "subscriptions",
            "id": "6740021496"
          }
        },
        "subscriptionPricePoint": {
          "data": {
            "type": "subscriptionPricePoints",
            "id": "eyJzIjoiNjc0MDAyMTQ5NiIsInQiOiJVU0EiLCJwIjoiMTAwMDEifQ"
          }
        },
        "territory": {
          "data": {
            "type": "territories",
            "id": "USA"
          }
        }
      }
    }
  ]
}

I receive a 409 error:

{
  "errors" : [ {
    "id" : "5b6a4b62-686c-4a65-87ba-e16131db517b",
    "status" : "409",
    "code" : "ENTITY_ERROR",
    "title" : "There is a problem with the request entity",
    "detail" : "User is not allowed to edit.",
    "source" : {
      "pointer" : "subscriptionPrices"
    }
  } ]
}

I made sure

  • my bearer authorisation token is correct and still valid (not expired).
  • the p8 key has Admin rights

Can this PATCH endpoint be used for what I want to do? If yes, is there anything special to do to use this PATCH endpoint?

Thanks, Axel

I just realised it's now working as expected. I noticed my subscription was "In Review" and is now in "Developer Action Needed". Maybe the price cannot be updated while the subscription is "In Review".

Hello @alpennec, I am also working with this API, but keep encountering a panic: HTTP status code 500, body { "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/." }] } error, my subscription is Ready to Submit

App Store Connect API: Modify an Auto-Renewable Subscription to change prices for all territories
 
 
Q