@k-yamada
If you want to set a custom price in a certain country or region, request an example:
#Base territory
base_territory_id = "CHN"
base_territory_id2 = "HKG"
iap_price_id = "A random name, used to distinguish a price plan"
# Globally balanced prices
iap_price_point_id = "eyJzIjoiNjQ0NDY1MzEwNSIsInQiOiJDSE4iLCJwIjoiMTAwMDEifQ" # CNY¥ 1.00
iap_price_point_id2 = "eyJzIjoiNjQ0NDY1MzEwNSIsInQiOiJDSE4iLCJwIjoiMTAwMDUifQ" # CNY¥ 2.50
# Customised price
iap_price_point_id3 = "eyJzIjoiNjQ0NDY1MzEwNSIsInQiOiJIS0ciLCJwIjoiMTAwMTUifQ" # HKD $16.00
# Request body
body = {
'data': {
'relationships': {
'inAppPurchase': {
'data': {
'id': f"{app_iap_id}",
'type': 'inAppPurchases'
}
},
'baseTerritory': {
'data': {
'id': f"{base_territory_id}",
'type': 'territories'
}
},
'manualPrices': {
'data': [
{
'id': f'{iap_price_id}',
'type': 'inAppPurchasePrices'
},
{
'id': f"{iap_price_id}2",
'type': 'inAppPurchasePrices'
},
{
'id': f"{iap_price_id}3",
'type': 'inAppPurchasePrices'
}
]
}
},
'type': 'inAppPurchasePriceSchedules'
},
'included': [
{
'id': f'{iap_price_id}',
'type': 'inAppPurchasePrices',
'attributes': {
'startDate': '2023-04-25',
'endDate': None
},
'relationships': {
'inAppPurchasePricePoint': {
'data': {
'id': f"{iap_price_point_id}",
'type': 'inAppPurchasePricePoints'
}
},
'inAppPurchaseV2': {
'data': {
'id': f"{app_iap_id}",
'type': 'inAppPurchases'
}
}
}
},
{
'id': f'{iap_price_id}2',
'type': 'inAppPurchasePrices',
'attributes': {
'startDate': None,
'endDate': '2023-04-25'
},
'relationships': {
'inAppPurchasePricePoint': {
'data': {
'id': f"{iap_price_point_id2}",
'type': 'inAppPurchasePricePoints'
}
},
'inAppPurchaseV2': {
'data': {
'id': f"{app_iap_id}",
'type': 'inAppPurchases'
}
}
}
},
{
'id': f'{iap_price_id}3',
'type': 'inAppPurchasePrices',
'attributes': {
'startDate': None,
'endDate': None
},
'relationships': {
'inAppPurchasePricePoint': {
'data': {
'id': f"{iap_price_point_id3}",
'type': 'inAppPurchasePricePoints'
}
},
'inAppPurchaseV2': {
'data': {
'id': f"{app_iap_id}",
'type': 'inAppPurchases'
}
}
}
}
]
}
This example shows that the mainland China CHN is the benchmark country, and all countries and regions are set to have automatic global equilibrium prices, except Hong Kong, China HKG. Then from now to 2023-04-25, use the CNY¥2.50 price point of the benchmark country mainland China to set the global equilibrium price. Starting from 2023-04-25, use the CNY¥ 1.00 price of the benchmark country mainland China. Click to set the global equilibrium price. The exception is Hong Kong, China. From now on, it has been manually adjusting the custom price HKD $16.00, that is, the fixed price, without following the global equilibrium price adjustment.
There are many pits here. The baseTerritory benchmark country field must be set, otherwise an error will be reported:
{
"errors" : [ {
"id" : "82b5ea44-b220-402b-b7b9-88031f76a115",
"status" : "409",
"code" : "ENTITY_ERROR.ATTRIBUTE.REQUIRED",
"title" : "The provided entity is missing a required field",
"detail" : "You must provide a value for the field (baseTerritory) with this request",
"source" : {
"pointer" : "/data/attributes/baseTerritory"
}
} ]
}
Then although the manualPrices field means manual price, it does not mean customised price, indicating all the price schedule plans that need to be set. Here we have set three price time plans:
'manualPrices': {
'data': [
{
'id': f'{iap_price_id}',
'type': 'inAppPurchasePrices'
},
{
'id': f"{iap_price_id}2",
'type': 'inAppPurchasePrices'
},
{
'id': f"{iap_price_id}3",
'type': 'inAppPurchasePrices'
}
]
}
The id above represents the name of the price time schedule, which is used to distinguish each time schedule. Then, it is necessary to list the specific price schedule:
'included': [
{
'id': f'{iap_price_id}',
'type': 'inAppPurchasePrices',
'attributes': {
'startDate': '2023-04-25',
'endDate': None
},
'relationships': {
'inAppPurchasePricePoint': {
'data': {
'id': f"{iap_price_point_id}",
'type': 'inAppPurchasePricePoints'
}
},
'inAppPurchaseV2': {
'data': {
'id': f"{app_iap_id}",
'type': 'inAppPurchases'
}
}
}
},
... Omit ...
... Omit ...
]
The most complicated thing here is two places, included.x.id and manualPrices.data.x.id are a correspondence, so there is a price schedule, there is a corresponding included.x.id , they keep up with relationships.inAppPurchasePricePoint.data.id is irrelevant, of course, if you find it convenient, it is also possible to set all three as the id of the price point.