Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating Google In-App Products using Google APIs

My request is

`{
  "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"
  }
 }`

to the post call for inserting a product (reference : [https://www.googleapis.com/androidpublisher/v2/applications/packageName/inappproducts]). Getting error response for this request

`{
  "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."
  }
}`

Can anyone explain this error, because i have set a default price ? And also how do i get all the countries list and its currencies in which the app is published in from google play console ?

like image 321
Sri Avatar asked Sep 12 '25 10:09

Sri


2 Answers

You really don't want to do this, imagine you having to send all that to about 150 countries. You can just parse the ['autoConvertMissingPrices' => true] when inserting or updating a product so Google does the conversion.

In my case here is what I do. { 'autoConvertMissingPrices' => true }

$purchase = $service->inappproducts->update(
  'app.package.name',
  'product_sku',
  $product,
  ['autoConvertMissingPrices' => true]
);
like image 126
Mua Rachmann Avatar answered Sep 15 '25 00:09

Mua Rachmann


Go to PRICING & DISTRIBUTION Page of your app in https://play.google.com/apps/publish/

In Countries find out how many region you have selected for this app.

while inserting the in app product you have provide price for all region you have selected.

so suppose if you have selected Pakistan as region

  • PK (2 letter ISO country code as key for each price for each region within price array)

then you request should be

{ "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" } } }

like image 36
HaroonAbbasi Avatar answered Sep 14 '25 23:09

HaroonAbbasi