horse revenue Docs

Guides

Access codes

Codes made on the Codes tab give access without a purchase, for press, partners, giveaways or someone who bought lifetime access somewhere else. A code gives an entitlement for a while, until a date, or for life.

#Make a code

On the app's Monetization → Codes tab, choose New code:

ChoiceOptions
WhoA personal code for one person (up to 3 of their installs), or a campaign code for up to a number of people, once each
GivesAn entitlement, such as pro
AccessFor a while (some days), Until a date, or For life
Last day to redeemOptional. After it, nobody new can redeem the code.

Many personal codes makes a batch at once, one per person, which you can export with Copy all as CSV. Each code has a note, such as Creator giveaway, so you can find it again.

Personal and campaign codes on the Codes tab, in the demo workspace.
Personal and campaign codes on the Codes tab, in the demo workspace.

Disable stops anyone new from redeeming a code, and people who already have it keep their access. Disable and remove access takes the access away as well.

#Redeem in the app

do {
    let (info, redemption) = try await Horse.shared.redeem(code: text, token: savedToken)
    savedToken = redemption.token      // keep it, for example in iCloud key-value storage
    unlock(info.isEntitled("pro"))
} catch let error as RedeemCodeError {
    switch error {
    case .invalid, .disabled, .expired, .usedUp: show(error.localizedDescription)
    case .discountCode(let offeringId): openPaywall(offeringId)   // an offering's promo code
    case .rateLimited: show("Try again in a minute")
    }
}

Keep the token that comes back. Passing it to redeem again after a reinstall moves the access to the new install without spending the code a second time. Saved in iCloud key-value storage, it even survives deleting the app.

Access from a code shows as an entitlement with store == .promotional.

Set a code link on the Codes tab: an https link your app opens (a universal link) with {code} in it, such as https://example.com/redeem/{code}. The dashboard then shares ready-made links, and your app handles the URL by calling redeem with the code from it.

#Apple's offer codes

Apple's own offer codes are different: they're set up in App Store Connect and redeemed in Apple's sheet. A designed paywall's legal links can open that sheet.