admin管理员组文章数量:1355107
I want to change the price of a subscription in Google Play Console. I retrieve the subscription, it comes in, I see it, change its price, and try to send it back. I wrote the following code and get these errors.
I tried creating a new Subscription without any extra parameters – it didn’t help. I tried removing some parameters like UpdateMask or RegionsVersionVersion – I get errors saying they are required. Even if I try to send it without any changes, I still get an error.
What am I doing wrong?
{"The service androidpublisher has thrown an exception. HttpStatusCode is BadRequest. Request contains an invalid argument."}
{Google.Apis.Requests.RequestError
Request contains an invalid argument. [400]
Errors [
Message[Request contains an invalid argument.] Location[ - ] Reason[badRequest] Domain[global]
]
}
var getRequest = service.Monetization.Subscriptions.Get(packageName, subscriptionId);
Subscription subscription = await getRequest.ExecuteAsync();
for (int j = 0; j < subscription.BasePlans[0].RegionalConfigs.Count; j++)
{
string regioncode = subscription.BasePlans[0].RegionalConfigs[j].RegionCode;
int trueindex = countrycode.IndexOf(regioncode);
if (trueindex != -1)
{
decimal priceValue = decimal.Parse(price[trueindex], CultureInfo.InvariantCulture);
decimal unitsDecimal = Math.Truncate(priceValue);
long units = (long)unitsDecimal;
decimal fractionalPart = priceValue - unitsDecimal;
int nanos = (int)(fractionalPart * 1_000_000_000M);
subscription.BasePlans[0].RegionalConfigs[j].Price.Units = units;
subscription.BasePlans[0].RegionalConfigs[j].Price.Nanos = nanos;
}
}
var request = service.Monetization.Subscriptions.Patch(subscription, packageName, subscriptionId);
request.UpdateMask = "basePlans.regionalConfigs.price";
request.RegionsVersionVersion = "2022/02";
await request.ExecuteAsync();
本文标签: Google Play Developer API in CStack Overflow
版权声明:本文标题:Google Play Developer API in C# - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744018821a2576836.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论