Skip to content
SDKProductWhat you sellOffer

Offer methods: create, get, list

The Offer Verbs create, get, list as typed SDK methods, with inputs, result, refusals and an example.

Reference for Offer, one group of Offer methods.

Offer.create

Creates an Offer. Verb page.

TypeScript
interface OfferVerbs {
  create(input: OfferCreateInput, options?: SB.CallOptions): SB.Call<Offer>
}

Emits Offer.created.

Inputs

InputTypeRequiredDescription
pricemoneyrequiredThe amount, currency, and unit. Zero is a price. Never randomized.
termstextThe conditions the Customer accepts, refund rights included. Never randomized.
fromstringLineage: the slot it compiles from, as Hypothesis#<slot>@v<version>.
activationjsonThe Event, count and window that mark a Customer activated, such as Reminder.sent 20 times within 7 days.
creditmoneyThe Credit Grant each purchase issues, for an Offer that sells prepaid credit, such as $50 of calls.
atBoundstringWhat a call past an Entitlement’s Limit gets: stop, overage or upgrade (refuse it, bill it through the Meter, or move to the next Offer).
intervalstringHow often it bills: once, day, week, month or year.
availableFromdatetimeWhen it can first be bought. Unset: from when it is published.
availableUntildatetimeWhen it can last be bought. Existing Subscriptions continue past it.
trialjsonThe free trial every new Customer starts with: days, and card true to take a card up front. Unset: no trial.
seatsstringHow a per-seat Price counts: manual (the buyer sets the quantity) or members (people in the Customer’s Tenant, prorated as they change).
uptimejsonThe monthly uptime it promises, and the share of that month’s charge credited back below each level.
licensestringWhat a buyer may do with the records it sells: use them internally, display them to its own users, or redistribute them.
attributiontextThe credit line a buyer shows wherever the records appear.
privateToPartyThe one Party who sees it and may accept it, making it a private Offer; no pricing page lists it.
productProductEach Offer sells one Product; one Product sits inside many Offers at different prices and terms.
brandBrandEach Offer carries exactly one Brand, whose name, voice and logo the buyer sees.
motionMotionEach Offer sells through one Motion, which says who buys and who acts for them.

Returns

OutputTypeRequiredDescription
offerOfferrequiredThe Offer.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const offer = await $.Offer.create({ price: { amount: 29, currency: 'USD' } })

Offer.get

Returns one Offer by id. Verb page.

TypeScript
interface OfferVerbs {
  get(input: OfferGetInput, options?: SB.CallOptions): SB.Call<Offer>
}

Reads only: it emits no Event.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Offer.
atstringA time or Version name: the record as it stood then. Unset: as it stands now.

Returns

OutputTypeRequiredDescription
offerOfferrequiredThe Offer.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const offer = await $.Offer.get({ id: 'offer_2hzYe1ERo0' })

Offer.list

Returns Offers, newest first, one page at a time. Verb page.

TypeScript
interface OfferVerbs {
  list(input?: OfferListInput, options?: SB.CallOptions): SB.ListCall<Offer>
}

Reads only: it emits no Event.

Inputs

InputTypeRequiredDescription
limitintegerAt most this many records, up to 100. The default is 20.
afterstringThe cursor from the previous page.
wherestringA filter over the properties, such as paidAt = null and total.amount > 500.
sortstringProperties to sort by, comma-separated; a leading minus sorts descending.
totalbooleanTrue adds the match count as meta.total, exact up to 10,000 matches and estimated above.
facetsstringProperties to count by value, comma-separated, returned as meta.facets.
fieldsstringProperties to return on each record, comma-separated; $id and $type always return.
includestringRelated records to embed in place of their URLs, comma-separated.
depthintegerHow many levels of related records to embed. The default is 1.
qstringWords to match across the text properties, ranked by relevance.
matchstringRanks the search by words, or meaning; words is the default.

Returns

OutputTypeRequiredDescription
offerslist of OfferrequiredOne page of Offers.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const offers = await $.Offer.list({ limit: 20 })