gplay-iap-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIn-App Purchase Setup for Google Play
Google Play 应用内购买设置
Use this skill when you need to set up monetization for your Android app.
当你需要为你的Android应用设置变现方案时,可以使用本技能。
Product Types
产品类型
- In-App Products - One-time or consumable purchases
- Subscriptions - Recurring billing with base plans and offers
- 应用内商品(IAP) - 一次性购买或可消耗型购买
- 订阅服务 - 包含基础方案和优惠的周期性计费
In-App Products (IAP)
应用内商品(IAP)
List products
列出商品
bash
gplay iap list --package com.example.appbash
gplay iap list --package com.example.appCreate product
创建商品
bash
gplay iap create \
--package com.example.app \
--sku premium_upgrade \
--json @product.jsonbash
gplay iap create \
--package com.example.app \
--sku premium_upgrade \
--json @product.jsonproduct.json
product.json
json
{
"sku": "premium_upgrade",
"status": "active",
"purchaseType": "managedUser",
"defaultPrice": {
"priceMicros": "990000",
"currency": "USD"
},
"prices": {
"US": {
"priceMicros": "990000",
"currency": "USD"
},
"GB": {
"priceMicros": "799000",
"currency": "GBP"
}
},
"listings": {
"en-US": {
"title": "Premium Upgrade",
"description": "Unlock all premium features"
},
"es-ES": {
"title": "Actualización Premium",
"description": "Desbloquea todas las funciones premium"
}
}
}json
{
"sku": "premium_upgrade",
"status": "active",
"purchaseType": "managedUser",
"defaultPrice": {
"priceMicros": "990000",
"currency": "USD"
},
"prices": {
"US": {
"priceMicros": "990000",
"currency": "USD"
},
"GB": {
"priceMicros": "799000",
"currency": "GBP"
}
},
"listings": {
"en-US": {
"title": "Premium Upgrade",
"description": "Unlock all premium features"
},
"es-ES": {
"title": "Actualización Premium",
"description": "Desbloquea todas las funciones premium"
}
}
}Update product
更新商品
bash
gplay iap update \
--package com.example.app \
--sku premium_upgrade \
--json @product-updated.jsonbash
gplay iap update \
--package com.example.app \
--sku premium_upgrade \
--json @product-updated.jsonBatch operations
批量操作
bash
undefinedbash
undefinedUpdate multiple products
更新多个商品
gplay iap batch-update
--package com.example.app
--json @products.json
--package com.example.app
--json @products.json
gplay iap batch-update
--package com.example.app
--json @products.json
--package com.example.app
--json @products.json
Get multiple products
获取多个商品
gplay iap batch-get
--package com.example.app
--skus "premium,coins_100,coins_500"
--package com.example.app
--skus "premium,coins_100,coins_500"
undefinedgplay iap batch-get
--package com.example.app
--skus "premium,coins_100,coins_500"
--package com.example.app
--skus "premium,coins_100,coins_500"
undefinedDelete product
删除商品
bash
gplay iap delete \
--package com.example.app \
--sku premium_upgrade \
--confirmbash
gplay iap delete \
--package com.example.app \
--sku premium_upgrade \
--confirmSubscriptions
订阅服务
List subscriptions
列出订阅
bash
gplay subscriptions list --package com.example.appbash
gplay subscriptions list --package com.example.appCreate subscription
创建订阅
bash
gplay subscriptions create \
--package com.example.app \
--json @subscription.jsonbash
gplay subscriptions create \
--package com.example.app \
--json @subscription.jsonsubscription.json
subscription.json
json
{
"productId": "premium_monthly",
"basePlans": [
{
"basePlanId": "monthly",
"state": "ACTIVE",
"regionalConfigs": [
{
"regionCode": "US",
"price": {
"priceMicros": "4990000",
"currency": "USD"
}
}
],
"autoRenewingBasePlanType": {
"billingPeriodDuration": "P1M"
}
},
{
"basePlanId": "yearly",
"state": "ACTIVE",
"regionalConfigs": [
{
"regionCode": "US",
"price": {
"priceMicros": "49990000",
"currency": "USD"
}
}
],
"autoRenewingBasePlanType": {
"billingPeriodDuration": "P1Y"
}
}
],
"listings": {
"en-US": {
"title": "Premium Subscription",
"description": "Get all premium features"
}
}
}json
{
"productId": "premium_monthly",
"basePlans": [
{
"basePlanId": "monthly",
"state": "ACTIVE",
"regionalConfigs": [
{
"regionCode": "US",
"price": {
"priceMicros": "4990000",
"currency": "USD"
}
}
],
"autoRenewingBasePlanType": {
"billingPeriodDuration": "P1M"
}
},
{
"basePlanId": "yearly",
"state": "ACTIVE",
"regionalConfigs": [
{
"regionCode": "US",
"price": {
"priceMicros": "49990000",
"currency": "USD"
}
}
],
"autoRenewingBasePlanType": {
"billingPeriodDuration": "P1Y"
}
}
],
"listings": {
"en-US": {
"title": "Premium Subscription",
"description": "Get all premium features"
}
}
}Base Plans
基础方案
Base plans define the billing period and price for subscriptions.
基础方案定义了订阅服务的计费周期和价格。
Activate base plan
激活基础方案
bash
gplay baseplans activate \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthlybash
gplay baseplans activate \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthlyDeactivate base plan
停用基础方案
bash
gplay baseplans deactivate \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthlybash
gplay baseplans deactivate \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthlyMigrate prices
迁移价格
bash
gplay baseplans migrate-prices \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthly \
--json @migration.jsonbash
gplay baseplans migrate-prices \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthly \
--json @migration.jsonSubscription Offers
订阅优惠
Offers provide discounts, free trials, or introductory pricing.
优惠可提供折扣、免费试用或入门定价。
List offers
列出优惠
bash
gplay offers list \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthlybash
gplay offers list \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthlyCreate offer
创建优惠
bash
gplay offers create \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthly \
--json @offer.jsonbash
gplay offers create \
--package com.example.app \
--product-id premium_monthly \
--base-plan monthly \
--json @offer.jsonoffer.json (Free trial)
offer.json (免费试用)
json
{
"offerId": "trial_7day",
"state": "ACTIVE",
"phases": [
{
"duration": "P7D",
"pricingType": "FREE_TRIAL"
}
],
"regionalConfigs": [
{
"regionCode": "US"
}
]
}json
{
"offerId": "trial_7day",
"state": "ACTIVE",
"phases": [
{
"duration": "P7D",
"pricingType": "FREE_TRIAL"
}
],
"regionalConfigs": [
{
"regionCode": "US"
}
]
}offer.json (Introductory price)
offer.json (入门定价)
json
{
"offerId": "intro_50_off",
"state": "ACTIVE",
"phases": [
{
"duration": "P1M",
"pricingType": "SINGLE_PAYMENT",
"price": {
"priceMicros": "2490000",
"currency": "USD"
}
}
]
}json
{
"offerId": "intro_50_off",
"state": "ACTIVE",
"phases": [
{
"duration": "P1M",
"pricingType": "SINGLE_PAYMENT",
"price": {
"priceMicros": "2490000",
"currency": "USD"
}
}
]
}Activate/Deactivate offer
激活/停用优惠
bash
undefinedbash
undefinedActivate
激活
gplay offers activate
--package com.example.app
--product-id premium_monthly
--base-plan monthly
--offer-id trial_7day
--package com.example.app
--product-id premium_monthly
--base-plan monthly
--offer-id trial_7day
gplay offers activate
--package com.example.app
--product-id premium_monthly
--base-plan monthly
--offer-id trial_7day
--package com.example.app
--product-id premium_monthly
--base-plan monthly
--offer-id trial_7day
Deactivate
停用
gplay offers deactivate
--package com.example.app
--product-id premium_monthly
--base-plan monthly
--offer-id trial_7day
--package com.example.app
--product-id premium_monthly
--base-plan monthly
--offer-id trial_7day
undefinedgplay offers deactivate
--package com.example.app
--product-id premium_monthly
--base-plan monthly
--offer-id trial_7day
--package com.example.app
--product-id premium_monthly
--base-plan monthly
--offer-id trial_7day
undefinedRegional Pricing
区域定价
Convert prices
转换价格
bash
gplay pricing convert \
--package com.example.app \
--json @price-request.jsonbash
gplay pricing convert \
--package com.example.app \
--json @price-request.jsonprice-request.json
price-request.json
json
{
"basePriceMicros": "4990000",
"baseCurrency": "USD",
"targetCurrencies": ["GBP", "EUR", "JPY"]
}json
{
"basePriceMicros": "4990000",
"baseCurrency": "USD",
"targetCurrencies": ["GBP", "EUR", "JPY"]
}Common Monetization Patterns
常见变现模式
Pattern 1: Simple IAP
模式1:简单应用内购买
bash
undefinedbash
undefinedOne-time premium upgrade
一次性高级解锁
gplay iap create
--package com.example.app
--sku premium_unlock
--json @premium.json
--package com.example.app
--sku premium_unlock
--json @premium.json
undefinedgplay iap create
--package com.example.app
--sku premium_unlock
--json @premium.json
--package com.example.app
--sku premium_unlock
--json @premium.json
undefinedPattern 2: Consumable IAP
模式2:可消耗型应用内购买
bash
undefinedbash
undefinedCoins/gems that can be consumed
可消耗的金币/宝石
gplay iap create
--package com.example.app
--sku coins_100
--json @coins.json
--package com.example.app
--sku coins_100
--json @coins.json
undefinedgplay iap create
--package com.example.app
--sku coins_100
--json @coins.json
--package com.example.app
--sku coins_100
--json @coins.json
undefinedPattern 3: Subscription with Free Trial
模式3:带免费试用的订阅
bash
undefinedbash
undefined1. Create subscription
1. 创建订阅
gplay subscriptions create
--package com.example.app
--json @sub.json
--package com.example.app
--json @sub.json
gplay subscriptions create
--package com.example.app
--json @sub.json
--package com.example.app
--json @sub.json
2. Create free trial offer
2. 创建免费试用优惠
gplay offers create
--package com.example.app
--product-id premium
--base-plan monthly
--json @trial.json
--package com.example.app
--product-id premium
--base-plan monthly
--json @trial.json
undefinedgplay offers create
--package com.example.app
--product-id premium
--base-plan monthly
--json @trial.json
--package com.example.app
--product-id premium
--base-plan monthly
--json @trial.json
undefinedPattern 4: Multi-Tier Subscription
模式4:多档位订阅
json
{
"productId": "premium",
"basePlans": [
{
"basePlanId": "basic_monthly",
"price": {"priceMicros": "2990000", "currency": "USD"},
"billingPeriodDuration": "P1M"
},
{
"basePlanId": "premium_monthly",
"price": {"priceMicros": "4990000", "currency": "USD"},
"billingPeriodDuration": "P1M"
},
{
"basePlanId": "premium_yearly",
"price": {"priceMicros": "49990000", "currency": "USD"},
"billingPeriodDuration": "P1Y"
}
]
}json
{
"productId": "premium",
"basePlans": [
{
"basePlanId": "basic_monthly",
"price": {"priceMicros": "2990000", "currency": "USD"},
"billingPeriodDuration": "P1M"
},
{
"basePlanId": "premium_monthly",
"price": {"priceMicros": "4990000", "currency": "USD"},
"billingPeriodDuration": "P1M"
},
{
"basePlanId": "premium_yearly",
"price": {"priceMicros": "49990000", "currency": "USD"},
"billingPeriodDuration": "P1Y"
}
]
}Testing
测试
Use test purchases
使用测试购买
In your app code, use test product IDs:
android.test.purchasedandroid.test.canceledandroid.test.refundedandroid.test.item_unavailable
在你的应用代码中,使用测试商品ID:
android.test.purchasedandroid.test.canceledandroid.test.refundedandroid.test.item_unavailable
License testing
许可证测试
Add test accounts in Play Console:
Settings → License Testing → Add license testers
在Play Console中添加测试账号:
设置 → 许可证测试 → 添加许可证测试人员
Best Practices
最佳实践
- Use clear product IDs - e.g., , not
premium_monthlyprod_001 - Localize descriptions - Provide listings for all supported languages
- Set up regional pricing - Don't use same price everywhere
- Offer free trials - Increase conversion rates
- Test thoroughly - Use test accounts and test product IDs
- Monitor conversions - Track which products/offers perform best
- Update prices carefully - Price changes affect existing subscribers
- 使用清晰的商品ID - 例如 ,而非
premium_monthlyprod_001 - 本地化描述 - 为所有支持的语言提供商品列表
- 设置区域定价 - 不要在所有地区使用相同价格
- 提供免费试用 - 提高转化率
- 全面测试 - 使用测试账号和测试商品ID
- 监控转化情况 - 追踪哪些商品/优惠表现最佳
- 谨慎更新价格 - 价格变动会影响现有订阅用户
Billing Periods
计费周期
- - 1 week
P1W - - 1 month
P1M - - 3 months
P3M - - 6 months
P6M - - 1 year
P1Y
- - 1周
P1W - - 1个月
P1M - - 3个月
P3M - - 6个月
P6M - - 1年
P1Y