使用Google API创建Google应用内商品

时间:2016-07-21 06:26:57

标签: android node.js google-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."
  }
}`

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

2 个答案:

答案 0 :(得分:1)

转到PRICING&您在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" } } }

答案 1 :(得分:0)

您真的不想这么做,假设您必须将所有内容发送到大约150个国家/地区。您只能在插入或更新产品时解析['autoConvertMissingPrices' => true],以便Google进行转换。

就我而言,这就是我要做的。 { 'autoConvertMissingPrices' => true }

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