google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

Add a base plan

Open YonatanSasoony opened this issue 3 years ago โ€ข 3 comments

Hey!

What is the best way to add a BasePlan to an existing subscription?

According to google_play_api.monetization.subscriptions.BasePlans there is not an update method.

I've tried to use google_play_api.monetization.subscriptions.patch() to update the BasePlans list:

   subscription = (
        google_play_api.monetization()
        .subscriptions()
        .get(
            packageName=package_name,
            productId=product_id,
        )
        .execute()
    )
    base_plans = subscription["basePlans"]
    base_plans.append(new_base_plan_details)
    subscription["basePlans"] = base_plans
    create_base_plan_request = (
        google_play_api.monetization()
        .subscriptions()
        .patch(
            packageName=package_name,
            productId=product_id,
            body=subscription,
        )
    )
  create_base_plan_request.uri += "&regionsVersion.version=2022/01"
  create_base_plan_request.uri += "&updateMask=Subscription.basePlans"
  create_base_plan_request.execute()

And got 400 Error: Request contains an invalid argument. Any idea what is wrong here?

YonatanSasoony avatar Aug 28 '22 12:08 YonatanSasoony

Hi @YonatanSasoony,

Please could you try out a similar request in the 'Try this API' interface on this page and check whether the issue still exists? This will determine if it is an API issue or client library issue.

In addition, for updateMask, can you try using basePlans instead of Subscription.basePlans as shown here?

https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions#Subscription

parthea avatar Sep 15 '22 16:09 parthea

@YonatanSasoony did you get it to work? Struggling with patch as well. Same issues as #2025

ghost avatar Apr 28 '23 09:04 ghost

Subscription.basePlans => base_plans ๋กœ ๋„ฃ์–ด์•ผ 200์œผ๋กœ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ, ๊ทธ๋งˆ์ €๋„ BasePlan ์ถ”๊ฐ€๊ฐ€ ์•„๋‹ˆ๊ณ , ์ˆ˜์ •์‚ฌํ•ญ์ž…๋‹ˆ๋‹ค. productId๊ฐ€ ์—†์„๊ฒฝ์šฐ์—๋Š” ์‹ ๊ทœ ๊ตฌ๋…์ด ์ƒ์„ฑ๋˜๋Š” ๊ตฌ์กฐ์ธ๊ฒƒ๊ฐ™๋„ค์š”.

leemyongkun avatar Jan 22 '24 13:01 leemyongkun