Skip to content

Instantly share code, notes, and snippets.

@gregtap
Last active April 30, 2019 12:25
Show Gist options
  • Select an option

  • Save gregtap/cbd84ed9486e4a727b8d250909b3ae7e to your computer and use it in GitHub Desktop.

Select an option

Save gregtap/cbd84ed9486e4a727b8d250909b3ae7e to your computer and use it in GitHub Desktop.

Revisions

  1. Greg TAPPERO revised this gist Apr 30, 2019. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions test.py
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    )
    http = credentials.authorize(http)

    service = build('androidpublisher', 'v2', http=http)
    service = build('androidpublisher', 'v3', http=http)

    # android_in_app = service.purchases().products().get(packageName=package_name,
    # productId="{}.{}".format(package_name, product, token=token)).execute()
    @@ -18,8 +18,9 @@

    package_name = "mobile.chefclub.App"
    token = "gepkfnlflefaghcnnioohhbd.AO-J1OyYB7ProV2FCuCZzxT4eh5Da47f3JsTqTxuJP-9oc4FkdJdOwA6RDwVGUQ9rJJUcDy3Y3Ffv_Rswmu4fbrt2lvjAsWzdGHMzFibog1OfLhHfxP0ru81W6Qjv5KdTpBMgtXs6tt6sd5eBxQjXCiWjmyVeLB__Q"
    android_in_app = service.purchases().products().get(packageName=package_name,
    productId="mobile.chefclub.test_premium_subscription",
    # The token provided to the user's device when the inapp product was purchased.
    android_in_app = service.purchases().subscriptions().get(packageName=package_name,
    subscriptionId="mobile.chefclub.test_premium_subscription",
    token=token).execute()

    print(android_in_app)
  2. Greg TAPPERO revised this gist Apr 30, 2019. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions test.py
    Original file line number Diff line number Diff line change
    @@ -9,18 +9,17 @@
    )
    http = credentials.authorize(http)

    service = build('androidpublisher', 'v3', http=http)
    service = build('androidpublisher', 'v2', http=http)

    # android_in_app = service.purchases().products().get(packageName=package_name,
    # productId="{}.{}".format(package_name, product, token=token)).execute()
    products = service.inappproducts().list(packageName="mobile.chefclub.App").execute()
    print("%s products" % len(products))

    package_name = "mobile.chefclub.App"
    product = "test_premium_subscription"
    token = "gepkfnlflefaghcnnioohhbd.AO-J1OyYB7ProV2FCuCZzxT4eh5Da47f3JsTqTxuJP-9oc4FkdJdOwA6RDwVGUQ9rJJUcDy3Y3Ffv_Rswmu4fbrt2lvjAsWzdGHMzFibog1OfLhHfxP0ru81W6Qjv5KdTpBMgtXs6tt6sd5eBxQjXCiWjmyVeLB__Q"
    android_in_app = service.purchases().products().get(packageName=package_name,
    productId="{}.{}".format(package_name, product),
    productId="mobile.chefclub.test_premium_subscription",
    token=token).execute()

    print(android_in_app)
  3. Greg TAPPERO renamed this gist Apr 30, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. Greg TAPPERO created this gist Apr 30, 2019.
    26 changes: 26 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    from googleapiclient.discovery import build
    from oauth2client.service_account import ServiceAccountCredentials
    import httplib2


    http = httplib2.Http(timeout=30)
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
    "credentials.json", "https://www.googleapis.com/auth/androidpublisher"
    )
    http = credentials.authorize(http)

    service = build('androidpublisher', 'v3', http=http)

    # android_in_app = service.purchases().products().get(packageName=package_name,
    # productId="{}.{}".format(package_name, product, token=token)).execute()
    products = service.inappproducts().list(packageName="mobile.chefclub.App").execute()
    print("%s products" % len(products))

    package_name = "mobile.chefclub.App"
    product = "test_premium_subscription"
    token = "gepkfnlflefaghcnnioohhbd.AO-J1OyYB7ProV2FCuCZzxT4eh5Da47f3JsTqTxuJP-9oc4FkdJdOwA6RDwVGUQ9rJJUcDy3Y3Ffv_Rswmu4fbrt2lvjAsWzdGHMzFibog1OfLhHfxP0ru81W6Qjv5KdTpBMgtXs6tt6sd5eBxQjXCiWjmyVeLB__Q"
    android_in_app = service.purchases().products().get(packageName=package_name,
    productId="{}.{}".format(package_name, product),
    token=token).execute()

    print(android_in_app)