使用谷歌API创建谷歌应用内产品



我的请求是

`{
  "packageName": "com.test.package",
  "sku": "title",
  "status": "inactive",
  "subscriptionPeriod": "P1M",
  "purchaseType": "subscription",
  "listings": {
    "en-US": {
      "title": "title",
      "description": "title"
    }
  },
  "defaultLanguage": "en-US",
  "defaultPrice": {
    "priceMicros": "100000000",
    "currency": "SGD"
  }
 }`

到插入产品的后期调用(参考:[https://www.googleapis.com/androidpublisher/v2/applications/packageName/inappproducts])。正在获取此请求的错误响应

`{
  "error": {
    "errors": [
      {
        "domain": "androidpublisher",
        "reason": "inAppProductRegionsMissingPricing",
        "message": "Must provide a price for each region the app has been published in."
      }
    ],
    "code": 403,
    "message": "Must provide a price for each region the app has been published in."
  }
}`

有人能解释这个错误吗,因为我已经设置了默认价格?此外,我如何从谷歌播放控制台获取应用程序发布的所有国家列表及其货币?

转到定价&中应用程序的分发页https://play.google.com/apps/publish/

在国家/地区中,了解您为此应用程序选择了多少地区。

在插入应用内产品时,您可以为所选的所有地区提供价格。

所以假设你选择了巴基斯坦作为地区

  • PK(2个字母的ISO国家代码,作为价格阵列中每个地区每个价格的密钥)

那么你的请求应该是

{ "packageName": "com.test.package", "sku": "title", "status": "inactive", "subscriptionPeriod": "P1M", "purchaseType": "subscription", "listings": { "en-US": { "title": "title", "description": "title" } }, "defaultLanguage": "en-US", "defaultPrice": { "priceMicros": "100000000", "currency": "SGD" }, "prices": { "PK": { "priceMicros": "100000000", "currency": "SGD" } } }

如果你真的不想这样做,想象一下你必须把所有这些发送到大约150个国家。您可以在插入或更新产品时解析['autoConvertMissingPrices' => true],以便谷歌进行转换。

在我的情况下,这就是我所做的。{ 'autoConvertMissingPrices' => true }

$purchase = $service->inappproducts->update(
  'app.package.name',
  'product_sku',
  $product,
  ['autoConvertMissingPrices' => true]
);

相关内容

  • 没有找到相关文章

最新更新