Skip to content

Commit 7dea755

Browse files
committed
docs(iap-subscriptions): update offer codes with pricing and auto-renew
- Add per-territory price and free territory support for IAP offer codes - Introduce isAutoRenewEnabled flag for subscription offer codes - Update CLI commands and API docs with new create parameters and examples
1 parent 0f29d04 commit 7dea755

1 file changed

Lines changed: 29 additions & 4 deletions

File tree

docs/features/iap-subscriptions/offer-codes.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A 3-level hierarchy: **offer code → custom codes / one-time-use codes → valu
99
| Command | Required flags |
1010
|---------|----------------|
1111
| `asc iap-offer-codes list --iap-id <id>` | `--iap-id` |
12-
| `asc iap-offer-codes create --iap-id <id> --name <n> --eligibility <e>...` | first two; `--eligibility` repeatable, ∈ `NON_SPENDER`, `ACTIVE_SPENDER`, `CHURNED_SPENDER` |
12+
| `asc iap-offer-codes create --iap-id <id> --name <n> --eligibility <e>... [--price <T>=<pp-id>...] [--free-territory <T>...]` | first two; `--eligibility` repeatable, ∈ `NON_SPENDER`, `ACTIVE_SPENDER`, `CHURNED_SPENDER`. `--price` is `<territory>=<price-point-id>` (repeatable). `--free-territory` is repeatable. **Per-territory pricing is read-only after creation — supply every territory at create time.** |
1313
| `asc iap-offer-codes update --offer-code-id <id> --active <bool>` | both |
1414
| `asc iap-offer-codes prices list --offer-code-id <id>` | `--offer-code-id` |
1515
| `asc iap-offer-code-custom-codes list --offer-code-id <id>` | `--offer-code-id` |
@@ -25,7 +25,7 @@ A 3-level hierarchy: **offer code → custom codes / one-time-use codes → valu
2525
| Command | Required flags |
2626
|---------|----------------|
2727
| `asc subscription-offer-codes list --subscription-id <id>` | `--subscription-id` |
28-
| `asc subscription-offer-codes create --subscription-id <id> --name <n> --duration <d> --mode <m> --periods <n> --eligibility <e>... --offer-eligibility <oe>` | all |
28+
| `asc subscription-offer-codes create --subscription-id <id> --name <n> --duration <d> --mode <m> --periods <n> --eligibility <e>... --offer-eligibility <oe> [--auto-renew <bool>] [--price <T>=<pp-id>...] [--free-territory <T>...]` | all required as before. `--auto-renew` defaults to `true`; pass `false` for non-renewing offers (ASC accepts only `--mode FREE_TRIAL` in that case). `--price`/`--free-territory` same shape as IAP. |
2929
| `asc subscription-offer-codes update --offer-code-id <id> --active <bool>` | both |
3030
| `asc subscription-offer-codes prices list --offer-code-id <id>` | `--offer-code-id` |
3131
| `asc subscription-offer-code-custom-codes list/create/update` | as IAP equivalents |
@@ -134,9 +134,9 @@ Custom codes and one-time-use codes both surface a `deactivate` affordance only
134134
| Path | Method | Description |
135135
|------|--------|-------------|
136136
| `/api/v1/iap/:iapId/offer-codes` | GET | List IAP offer codes (returns `productionCodeCount`/`sandboxCodeCount` per item) |
137-
| `/api/v1/iap/:iapId/offer-codes` | POST | Create an IAP offer code — body: `{name, customerEligibilities: ["NON_SPENDER"\|"ACTIVE_SPENDER"\|"CHURNED_SPENDER"]}` |
137+
| `/api/v1/iap/:iapId/offer-codes` | POST | Create an IAP offer code — body: `{name, customerEligibilities[], prices: [{territory, pricePointId?}]}`. Omit `pricePointId` (or set to `null`) for a free territory. **Required at create time — read-only after.** |
138138
| `/api/v1/subscriptions/:subscriptionId/offer-codes` | GET | List subscription offer codes (same per-environment counts) |
139-
| `/api/v1/subscriptions/:subscriptionId/offer-codes` | POST | Create a subscription offer code — body: `{name, duration, mode, periods, customerEligibilities[], offerEligibility}` |
139+
| `/api/v1/subscriptions/:subscriptionId/offer-codes` | POST | Create a subscription offer code — body: `{name, duration, mode, periods, customerEligibilities[], offerEligibility, isAutoRenewEnabled?, prices: [{territory, pricePointId?}]}`. `isAutoRenewEnabled` defaults to `true` (also accepts `autoRenew`). Same `prices` shape and read-only-after rule as IAP. |
140140
| `/api/v1/iap-offer-codes/:offerCodeId/prices` | GET | Per-territory prices for an IAP offer code |
141141
| `/api/v1/subscription-offer-codes/:offerCodeId/prices` | GET | Per-territory prices for a subscription offer code |
142142
| `/api/v1/iap-offer-codes/:offerCodeId/one-time-codes` | GET | List one-time-use code batches |
@@ -149,9 +149,34 @@ Custom codes and one-time-use codes both surface a `deactivate` affordance only
149149
`environment` in the POST body is optional — defaults to `production`. Accepts `"production"`, `"sandbox"`, `"PRODUCTION"`, or `"SANDBOX"`.
150150

151151
```bash
152+
# Generate sandbox redemption codes for an existing offer code
152153
curl -X POST http://localhost:8080/api/v1/iap-offer-codes/oc-1/one-time-codes \
153154
-H "Content-Type: application/json" \
154155
-d '{"numberOfCodes": 100, "expirationDate": "2026-12-31", "environment": "sandbox"}'
156+
157+
# Create a paid IAP offer code with mixed paid + free territories
158+
curl -X POST http://localhost:8080/api/v1/iap/iap-1/offer-codes \
159+
-H "Content-Type: application/json" \
160+
-d '{
161+
"name": "LAUNCH_PROMO",
162+
"customerEligibilities": ["NON_SPENDER", "CHURNED_SPENDER"],
163+
"prices": [
164+
{"territory": "USA", "pricePointId": "pp-usa"},
165+
{"territory": "JPN", "pricePointId": "pp-jpn"},
166+
{"territory": "BRA"}
167+
]
168+
}'
169+
170+
# Create a non-renewing subscription offer code (autoRenew false ⇒ free trial only)
171+
curl -X POST http://localhost:8080/api/v1/subscriptions/sub-1/offer-codes \
172+
-H "Content-Type: application/json" \
173+
-d '{
174+
"name": "WELCOME_TRIAL",
175+
"duration": "ONE_MONTH", "mode": "FREE_TRIAL", "periods": 1,
176+
"customerEligibilities": ["NEW"], "offerEligibility": "STACKABLE",
177+
"isAutoRenewEnabled": false,
178+
"prices": [{"territory": "USA"}]
179+
}'
155180
```
156181

157182
The CSV `values` endpoint is intentionally CLI-only — REST clients should list the parent `one-time-codes` resource and follow its affordances to deactivate or create new batches.

0 commit comments

Comments
 (0)