Creating Google In-App Products using Google APIs Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Creating Google In-App Products using Google APIs without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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 ?

Answer

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

We are here to answer your question about Creating Google In-App Products using Google APIs - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji