# Make offer codes for a one-time purchase

> Have an Agent create an offer code for a one-off product such as a consumable or a non-consumable, add a custom code or a batch of one-time codes, send you the codes, and turn them off.

Source: https://air.build/docs/app-store/make-offer-codes-for-a-one-time-purchase/

An offer code gives people one of your app's one-off products at a lower price, or for free. Apple's help says people redeem a code through a redemption URL, by entering it in the App Store, or in your app. See Apple's [Create offer codes for In-App Purchases](https://developer.apple.com/help/app-store-connect/manage-in-app-purchases/create-offer-codes-for-in-app-purchases).

> [!NOTE]
> AirBuild's **Offers** page is for subscription plans (see [Offer free trials, discounts and offer codes](https://air.build/docs/app-store/offer-trials-and-discounts/#make-offer-codes)). A one-off product on the **In-App Purchases** tab has no **Offers** page, so you ask an Agent in the Project's chat. It uses `asc iap offer-codes` (listed under `iap` in [asc: in-app purchases and subscriptions](https://air.build/docs/cli/asc-monetization/#iap)). AirBuild doesn't show these offer codes: ask the Agent, or look in App Store Connect.

## How an offer code works

The offer code is the offer itself: who can redeem it, and its price in each country or region. The codes people type are added to it afterward, in two kinds:

| Kind | What it is | `asc iap offer-codes` |
| --- | --- | --- |
| Custom code | One code you name, such as `SPRING26`. Apple's help says many people can redeem it, up to a limit you set. An end date is optional. | `custom-codes create` |
| One-time codes | A batch of codes Apple generates. Apple's help says each one is redeemed once. An end date is required. | `one-time-codes create` |

Apple's help says you can create the offer and sandbox codes whatever your app's status, but to generate one-time or custom codes, your app must be Ready for Distribution and the in-app purchase must be Approved. It also sets how many codes a batch can have and how far out they can expire: see Apple's page above.

## Create the offer

Ask in the Project's chat, for example:

```text
Make an offer code called SPRING for the Pro unlock: free in the United States and Canada, for people who have never bought anything in the app.
```

1. The Agent finds the product. You can name it by its reference name or its product ID.
2. It sets a price for each country or region you name: `FREE`, or one of Apple's price steps for that product, which it looks up with `asc iap pricing price-points list`.
3. It sets who can redeem it. Apple's help lists three groups: people who have never bought anything in your app, people who bought in the last 30 days, and people who bought more than 30 days ago. In `asc` they're `NON_SPENDER`, `ACTIVE_SPENDER` and `CHURNED_SPENDER`. The `asc` help lists these values without saying which group each one is. If you don't say, the command picks all three.
4. It creates the offer with `asc iap offer-codes create` and tells you in the chat.

Check the offer before it's made: Apple's help says an offer can't be edited once it's created. To change it, make a new one.

## Add a custom code

```text
Add the custom code SPRING26 to the SPRING offer, for 500 redemptions, ending June 30.
```

The Agent adds it with `asc iap offer-codes custom-codes create`. It takes the code, how many redemptions (`--quantity`, which the help calls the number of codes) and, if you give one, the end date (`--expiration-date`).

## Make one-time codes

```text
Generate 1,000 one-time codes for the SPRING offer, ending June 30, and send them to me as a file.
```

1. The Agent asks Apple for the batch with `asc iap offer-codes one-time-codes create`, with how many codes (`--quantity`) and the day they stop working (`--expiration-date`).
2. It fetches the codes with `asc iap offer-codes one-time-codes values`, which gets the code values of a batch, and sends them to you in the chat.

To try redeeming before you hand codes out, ask for sandbox codes, for example "Generate 10 sandbox codes for the SPRING offer, ending next month." The command takes `--environment SANDBOX` (or `PRODUCTION`). Apple's help calls these one-time codes for testing. For sandbox testers, see [Test in-app purchases before release](https://air.build/docs/app-store/test-purchases-before-release/#buy-as-a-sandbox-tester).

## See your offers and codes

| Ask | `asc iap offer-codes` |
| --- | --- |
| "Which offer codes does the Pro unlock have?" | `list` |
| "Show me the SPRING offer." | `view` |
| "What does the SPRING offer cost in each country?" | `prices` |
| "Which custom codes does the SPRING offer have?" | `custom-codes list` |
| "Which batches of one-time codes does the SPRING offer have?" | `one-time-codes list` |
| "Send me the codes from the June batch again." | `one-time-codes values` |

In App Store Connect, open your app's in-app purchase: Apple's help puts its offers in the Offer Codes section.

## Turn off an offer or its codes

`asc` has no command to delete an offer code. You turn it off instead:

| Ask | What happens |
| --- | --- |
| "Turn off the SPRING offer." | `offer-codes update --active false`. The command also takes `--active true`. |
| "Turn off the custom code SPRING26." | `custom-codes update --active false`. The help calls it "Turn a custom code on or off." |
| "Turn off the June batch of one-time codes." | `one-time-codes update --active false`. This can't be undone: "Turning a batch off is permanent: Apple rejects --active true on an inactive batch." The command runs only with `--confirm`, so the Agent asks you first. |

## Questions

**Why doesn't my product have an Offers page?**

In AirBuild, **Offers** is on subscription plans only. For a one-off product, ask an Agent, as on this page.

**App Store Connect won't generate codes.**

Apple's help says one-time and custom codes need your app to be Ready for Distribution and the in-app purchase to be Approved. Check where the product stands on the **In-App Purchases** tab, and see [Submit to App Review and release](https://air.build/docs/app-store/submit-for-review/).

**The Agent says eligibilities must be one of NON_SPENDER, ACTIVE_SPENDER, CHURNED_SPENDER.**

Say who can redeem the offer in plain words: people who have never bought anything in the app, who bought in the last 30 days, or who bought more than 30 days ago.

**The Agent says the quantity must be a positive integer.**

The message is `--quantity must be a positive integer`. Give the number of codes or redemptions as a whole number, such as 500.

**The Agent says the environment must be PRODUCTION or SANDBOX.**

One-time codes are either real (`PRODUCTION`) or for testing (`SANDBOX`). Say which you want.

**The Agent says --confirm is required to turn off a one-time use code batch.**

The full message is `--confirm is required to turn off a one-time use code batch; turning it off is permanent`. The Agent needs your yes before it turns the batch off for good.

**Can I change an offer's price or who can redeem it?**

No. Apple's help says an offer can't be edited once it's created. Turn the old one off and make a new one.
