$npx -y skills add hanamizuki/solopreneur --skill gplay-iap-setupIn-app products, subscriptions, base plans, and offers setup for Google Play monetization, including bulk-localizing subscription display names, descriptions, and benefits across all locales. Use when configuring in-app purchases or subscription products.
| 1 | # In-App Purchase Setup for Google Play |
| 2 | |
| 3 | Use this skill when you need to set up monetization for your Android app. |
| 4 | |
| 5 | ## Two APIs: Legacy vs New Monetization |
| 6 | |
| 7 | Google Play has two APIs for one-time products: |
| 8 | |
| 9 | | | Legacy (`gplay iap`) | New Monetization (`gplay onetimeproducts`) | |
| 10 | |---|---|---| |
| 11 | | API | `inappproducts` | `monetization.onetimeproducts` | |
| 12 | | Price format | `priceMicros`/`currency` | `units`/`nanos`/`currencyCode` | |
| 13 | | Structure | Flat `prices` map | `purchaseOptions` with `regionalPricingAndAvailabilityConfigs` | |
| 14 | | States | `active`/`inactive` | `DRAFT` → `ACTIVE` (requires explicit activation) | |
| 15 | | Regional pricing | `--auto-convert-prices` flag | `--regions-version` required | |
| 16 | |
| 17 | **Prefer the new monetization API** (`gplay onetimeproducts`) for new products. It supports purchase options, better regional pricing control, and is the actively developed API. |
| 18 | |
| 19 | **Use the legacy API** (`gplay iap`) only for managing existing legacy products. |
| 20 | |
| 21 | **Never mix the two APIs for the same product.** A product created via `gplay iap create` cannot be managed via `gplay onetimeproducts` and vice versa. |
| 22 | |
| 23 | ## Critical: Product IDs Are Permanent |
| 24 | |
| 25 | **Google Play permanently reserves product IDs after deletion.** If you create `premium_unlock` and later delete it, the ID `premium_unlock` can never be reused — not even with a different API. Choose product IDs carefully. |
| 26 | |
| 27 | This means: |
| 28 | - Do NOT create a "test" product with a good ID and then delete it |
| 29 | - Do NOT create via the legacy API and then try to recreate via the new API |
| 30 | - If you burn an ID, you must choose a new one (e.g., `premium_unlock_v2`) |
| 31 | |
| 32 | ## One-Time Products (New Monetization API) |
| 33 | |
| 34 | ### List products |
| 35 | ```bash |
| 36 | gplay onetimeproducts list --package com.example.app |
| 37 | ``` |
| 38 | |
| 39 | ### Create product |
| 40 | |
| 41 | **`--regions-version` is required** — the `create` command uses PATCH with `allowMissing=true` internally: |
| 42 | ```bash |
| 43 | gplay onetimeproducts create \ |
| 44 | --package com.example.app \ |
| 45 | --product-id premium_unlock \ |
| 46 | --json @product.json \ |
| 47 | --regions-version "2025/03" |
| 48 | ``` |
| 49 | |
| 50 | ### product.json (new monetization format) |
| 51 | ```json |
| 52 | { |
| 53 | "productId": "premium_unlock", |
| 54 | "listings": [ |
| 55 | { "languageCode": "en-US", "title": "Premium Unlock", "description": "Unlock all premium features" }, |
| 56 | { "languageCode": "es-ES", "title": "Desbloqueo Premium", "description": "Desbloquea todas las funciones premium" } |
| 57 | ], |
| 58 | "purchaseOptions": [ |
| 59 | { |
| 60 | "buyOption": { "legacyCompatible": true }, |
| 61 | "newRegionsConfig": { |
| 62 | "availability": "AVAILABLE", |
| 63 | "usdPrice": { "currencyCode": "USD", "units": "9", "nanos": 990000000 }, |
| 64 | "eurPrice": { "currencyCode": "EUR", "units": "9", "nanos": 990000000 } |
| 65 | }, |
| 66 | "regionalPricingAndAvailabilityConfigs": [ |
| 67 | { "regionCode": "US", "availability": "AVAILABLE", "price": { "currencyCode": "USD", "units": "9", "nanos": 990000000 } }, |
| 68 | { "regionCode": "GB", "availability": "AVAILABLE", "price": { "currencyCode": "GBP", "units": "7", "nanos": 990000000 } }, |
| 69 | { "regionCode": "IN", "availability": "AVAILABLE", "price": { "currencyCode": "INR", "units": "249", "nanos": 990000000 } } |
| 70 | ] |
| 71 | } |
| 72 | ] |
| 73 | } |
| 74 | ``` |
| 75 | |
| 76 | ### Activate the purchase option |
| 77 | |
| 78 | New products start in **DRAFT** state. You must activate before users can purchase: |
| 79 | ```bash |
| 80 | gplay purchase-options batch-update-states \ |
| 81 | --package com.example.app \ |
| 82 | --product-id premium_unlock \ |
| 83 | --json '{"requests":[{"activatePurchaseOptionRequest":{"packageName":"com.example.app","productId":"premium_unlock","purchaseOptionId":"default"}}]}' |
| 84 | ``` |
| 85 | |
| 86 | ### Update product |
| 87 | ```bash |
| 88 | gplay onetimeproducts patch \ |
| 89 | --package com.example.app \ |
| 90 | --product-id premium_unlock \ |
| 91 | --json @product-updated.json \ |
| 92 | --regions-version "2025/03" \ |
| 93 | --update-mask "purchaseOptions" |
| 94 | ``` |
| 95 | |
| 96 | ### Get product |
| 97 | ```bash |
| 98 | gplay onetimeproducts get --package com.example.app --product-id premium_unlock |
| 99 | ``` |
| 100 | |
| 101 | ### Delete product |
| 102 | ```bash |
| 103 | gplay onetimeproducts delete \ |
| 104 | --package com.example.app \ |
| 105 | --product-id premium_unlock \ |
| 106 | --confirm |
| 107 | ``` |
| 108 | |
| 109 | ### Batch operations |
| 110 | ```bash |
| 111 | # Get multiple products |
| 112 | gplay onetimeproducts batch-get \ |
| 113 | --package com.example.app \ |
| 114 | --product-ids "premium_unlock,coins_100" |
| 115 | |
| 116 | # Update multiple products (regionsVersion goes inside JSON) |
| 117 | gplay onetimeproducts batch-update \ |
| 118 | --package com.example.app \ |
| 119 | --json @products-batch.json |
| 120 | ``` |
| 121 | |
| 122 | ## Legacy In-App Products (IAP) |
| 123 | |
| 124 | Use only for managing existing legacy products. |
| 125 | |
| 126 | ### List products |
| 127 | ```bash |
| 128 | gplay iap list --package com.example.app |
| 129 | ``` |
| 130 | |
| 131 | ### Create product |
| 132 | `iap create` has no `--sku` flag — the SKU/productId lives in the JSON body: |
| 133 | ```bash |
| 134 | gplay iap create \ |
| 135 | --package com.example.app \ |
| 136 | --json @product.json |
| 137 | ``` |
| 138 | |
| 139 | ### product.json (legacy format) |
| 140 | ```json |
| 141 | { |