[GH-ISSUE #158] Add Offer Codes CLI support (subscription one-time use codes) #40

Closed
opened 2026-02-26 21:32:57 +03:00 by kerem · 3 comments
Owner

Originally created by @rudrankriyam on GitHub (Jan 25, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/158

Summary

Add support for subscription offer codes (one-time use codes) via the App Store Connect API to distribute subscription offers.

Background

Offer codes replace promo codes for subscriptions. The App Store Connect API supports one-time use offer codes via subscriptionOfferCodeOneTimeUseCodes and the related subscriptionOfferCodes relationships. App promo codes are not available via the API.

Current State

Not implemented. Users must use the App Store Connect web UI to generate offer codes manually.

Desired Feature

Commands

# List one-time use offer code batches for a subscription offer
asc offer-codes list --offer-code "OFFER_CODE_ID" [--output json|table|markdown]

# Generate one-time use offer codes (and optionally download values)
asc offer-codes generate --offer-code "OFFER_CODE_ID" \
  --quantity 10 \
  --expiration-date "2026-02-01" \
  --output ./offer-codes.txt

# Download one-time use offer code values for a batch
asc offer-codes values --id "ONE_TIME_USE_CODE_ID" --output ./offer-codes.txt

API Endpoints

The App Store Connect API provides:

  • POST /v1/subscriptionOfferCodeOneTimeUseCodes - Create one-time use codes
  • GET /v1/subscriptionOfferCodes/{id}/oneTimeUseCodes - List batches for an offer code
  • GET /v1/subscriptionOfferCodeOneTimeUseCodes/{id} - Get batch details
  • GET /v1/subscriptionOfferCodeOneTimeUseCodes/{id}/values - Download code values (CSV)
  • PATCH /v1/subscriptionOfferCodeOneTimeUseCodes/{id} - Deactivate a batch

Fields

Request:

  • numberOfCodes - Number of codes to generate
  • expirationDate - Date in YYYY-MM-DD format
  • offerCode - Relationship to subscriptionOfferCodes

Response:

  • numberOfCodes - Number of codes created
  • createdDate - Creation timestamp
  • expirationDate - Expiration date
  • active - Whether the batch is active
  • offerCode - Related subscription offer code

Examples

# Generate 10 offer codes
asc offer-codes generate --offer-code "OFFER_CODE_ID" --quantity 10 --expiration-date "2026-02-01"

# List batches for an offer code
asc offer-codes list --offer-code "OFFER_CODE_ID" --output table
  • sandbox - Sandbox testers for subscription purchase testing

Priority

Medium - Useful for tester and marketing distribution workflows.

Originally created by @rudrankriyam on GitHub (Jan 25, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/158 ## Summary Add support for subscription offer codes (one-time use codes) via the App Store Connect API to distribute subscription offers. ## Background Offer codes replace promo codes for subscriptions. The App Store Connect API supports one-time use offer codes via `subscriptionOfferCodeOneTimeUseCodes` and the related `subscriptionOfferCodes` relationships. App promo codes are not available via the API. ## Current State Not implemented. Users must use the App Store Connect web UI to generate offer codes manually. ## Desired Feature ### Commands ```bash # List one-time use offer code batches for a subscription offer asc offer-codes list --offer-code "OFFER_CODE_ID" [--output json|table|markdown] # Generate one-time use offer codes (and optionally download values) asc offer-codes generate --offer-code "OFFER_CODE_ID" \ --quantity 10 \ --expiration-date "2026-02-01" \ --output ./offer-codes.txt # Download one-time use offer code values for a batch asc offer-codes values --id "ONE_TIME_USE_CODE_ID" --output ./offer-codes.txt ``` ### API Endpoints The App Store Connect API provides: - `POST /v1/subscriptionOfferCodeOneTimeUseCodes` - Create one-time use codes - `GET /v1/subscriptionOfferCodes/{id}/oneTimeUseCodes` - List batches for an offer code - `GET /v1/subscriptionOfferCodeOneTimeUseCodes/{id}` - Get batch details - `GET /v1/subscriptionOfferCodeOneTimeUseCodes/{id}/values` - Download code values (CSV) - `PATCH /v1/subscriptionOfferCodeOneTimeUseCodes/{id}` - Deactivate a batch ### Fields **Request:** - `numberOfCodes` - Number of codes to generate - `expirationDate` - Date in YYYY-MM-DD format - `offerCode` - Relationship to `subscriptionOfferCodes` **Response:** - `numberOfCodes` - Number of codes created - `createdDate` - Creation timestamp - `expirationDate` - Expiration date - `active` - Whether the batch is active - `offerCode` - Related subscription offer code ### Examples ```bash # Generate 10 offer codes asc offer-codes generate --offer-code "OFFER_CODE_ID" --quantity 10 --expiration-date "2026-02-01" # List batches for an offer code asc offer-codes list --offer-code "OFFER_CODE_ID" --output table ``` ### Related Commands - `sandbox` - Sandbox testers for subscription purchase testing ### Priority Medium - Useful for tester and marketing distribution workflows.
kerem 2026-02-26 21:32:57 +03:00
Author
Owner

@rudrankriyam commented on GitHub (Jan 26, 2026):

@cursor implement this

<!-- gh-comment-id:3799146367 --> @rudrankriyam commented on GitHub (Jan 26, 2026): @cursor implement this
Author
Owner

@cursor[bot] commented on GitHub (Jan 26, 2026):

  • I added full promo codes support end-to-end: new ASC client types/endpoints with pagination + table/markdown output, new asc promocodes list and asc promocodes generate commands (including optional file output), plus README docs/examples.
  • I added tests for promo code query building, request payloads, client HTTP behavior, CLI validation, and output formatting.

Tests run:

  • make test
  • go test ./cmd -run PromoCodes
  • go test ./internal/asc -run PromoCodes

Walkthrough artifact: A screen recording of the promo code test commands passing is available at promo_codes_tests_success/recording_demo.mp4.

View PR
Open in Cursor Open in Web

<!-- gh-comment-id:3799146805 --> @cursor[bot] commented on GitHub (Jan 26, 2026): - I added full promo codes support end-to-end: new ASC client types/endpoints with pagination + table/markdown output, new `asc promocodes list` and `asc promocodes generate` commands (including optional file output), plus README docs/examples. - I added tests for promo code query building, request payloads, client HTTP behavior, CLI validation, and output formatting. **Tests run:** - `make test` - `go test ./cmd -run PromoCodes` - `go test ./internal/asc -run PromoCodes` **Walkthrough artifact:** A screen recording of the promo code test commands passing is available at `promo_codes_tests_success/recording_demo.mp4`. <a href="https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/187"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/view-pr-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/view-pr-light.svg"><img alt="View PR" src="https://cursor.com/view-pr-light.svg"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-6ffc9537-d29e-45aa-a0b4-fc62c820fc02"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a href="https://cursor.com/agents?id=bc-6ffc9537-d29e-45aa-a0b4-fc62c820fc02"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web" src="https://cursor.com/open-in-web.svg"></picture></a>
Author
Owner

@rudrankriyam commented on GitHub (Jan 26, 2026):

Resolved by #187 (offer codes CLI support).

<!-- gh-comment-id:3800451495 --> @rudrankriyam commented on GitHub (Jan 26, 2026): Resolved by #187 (offer codes CLI support).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/App-Store-Connect-CLI#40
No description provided.