Post

Replies

Boosts

Views

Activity

Implement AppstoreConnect API POST Request subscriptionPromotionalOffers
Hi guys! Unfortunately, the TSI Team is not willing to help me. Maybe someone here is able to help. :) I'm trying to create a subscriptionPromotionalOffer for the AppstoreConnect API in PHP. I'm using the latest app_store_connect_api_2.3_openapi.json and I generated the PHP API with openapi-generator-cli-6.6.0. Request url: https://api.appstoreconnect.apple.com/v1/subscriptionPromotionalOffers I'm sending the following payload: { "data":{ "type":"subscriptionPromotionalOffers", "attributes":{ "name":"TEST_SUBSCRIPTION_NAME", "offerCode":"TEST_SUBSCRIPTION_CODE", "duration":"ONE_YEAR", "offerMode":"PAY_UP_FRONT", "numberOfPeriods":1 }, "relationships":{ "subscription":{ "data":{ "type":"subscriptions", "id":"1575201034" } }, "prices":{ "data":[ { "type":"subscriptionPromotionalOfferPrices", "id":"eyJzIjoiMTU3NTIwMTAzNCIsInQiOiJVU0EiLCJwIjoiMTAyMTIifQ" } ] } } } } I'm getting the following error: `409 Conflict` response: { "errors" : [ { "id" : "79b54fc7-0e8d-4228-99ab-4937551b5303", "status" : "409", "code" : "ENTITY_ERROR.RELATIONSHIP.INVALID", "title" : "The provided entity includes a relationship with an invalid value", "detail" : "Missing a required include subscriptionPricePoint", "source" : { "pointer" : "/data/relationships/prices" } } ] } I think the error is a wrong id for subscriptionPromotionalOfferPrices which I don't understand. I`m saving all ids for all prices for all pricePoints for all subscriptions in my local db and try to use those ids for the subscriptionPromotionalOfferPrices. I also tried to provide the id for each country. If I do this, I get the same error for each id for each country. The provided id eyJzIjoiMTU3NTIwMTAzNCIsInQiOiJVU0EiLCJwIjoiMTAyMTIifQ references to 26.99$ price for the USA subscriptionPricePoint. Can someone provide me a working example for this request? If the id is wrong, can someone tell me: How to query the right ids for each country for each subscription? I already tried https://api.appstoreconnect.apple.com/v1/subscriptionPromotionalOffers/{id}/prices and https://api.appstoreconnect.apple.com/v1/subscriptionPromotionalOffers/{id} to fetch information for an existing Promotional Offer, but I was not able to fetch meaningful data from that endpoints. I'm able to modify all prices for an existing subscription via API, so I'm sure the IDs I use are valid subscriptionPricePoint ids for each country.
2
1
1.3k
Jun ’23