Offer routes: update, delete
The Offer Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.
Reference for Offer, one group of Offer routes.
Offer.update
Changes the given properties of an Offer. Verb page.
PATCH /{namespace}/ offers/ {id}Path: id. Body, as JSON: the other inputs. Emits Offer.updated.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
id | string | required | The id of the Offer. |
price | money | The amount, currency, and unit. Zero is a price. Never randomized. | |
terms | text | The conditions the Customer accepts, refund rights included. Never randomized. | |
from | string | Lineage: the slot it compiles from, as Hypothesis#<slot>@v<version>. | |
activation | json | The Event, count and window that mark a Customer activated, such as Reminder.sent 20 times within 7 days. | |
credit | money | The Credit Grant each purchase issues, for an Offer that sells prepaid credit, such as $50 of calls. | |
atBound | string | What 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). | |
interval | string | How often it bills: once, day, week, month or year. | |
availableFrom | datetime | When it can first be bought. Unset: from when it is published. | |
availableUntil | datetime | When it can last be bought. Existing Subscriptions continue past it. | |
trial | json | The free trial every new Customer starts with: days, and card true to take a card up front. Unset: no trial. | |
seats | string | How a per-seat Price counts: manual (the buyer sets the quantity) or members (people in the Customer’s Tenant, prorated as they change). | |
uptime | json | The monthly uptime it promises, and the share of that month’s charge credited back below each level. | |
license | string | What a buyer may do with the records it sells: use them internally, display them to its own users, or redistribute them. | |
attribution | text | The credit line a buyer shows wherever the records appear. | |
privateTo | Party | The one Party who sees it and may accept it, making it a private Offer; no pricing page lists it. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
offer | Offer | required | The Offer. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X PATCH https: //api.sb/ leaseline.app/ offers/ offer_2hzYe1ERo0 \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"price": {"amount": 29, "currency": "USD"}}'{
"api": "https: //api.sb/ leaseline.app",
"offer": {
"$id": "https: //api.sb/ leaseline.app/ offers/ offer_2hzYe1ERo0",
"$type": "Offer",
"price": {
"amount": 29,
"currency": "USD"
}
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Offer.update",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}Offer.delete
Deletes an Offer: a soft delete that keeps its history, undone by Thing.restore. Verb page.
DELETE /{namespace}/ offers/ {id}Path: id. Emits Offer.deleted.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
id | string | required | The id of the Offer. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
offer | Offer | required | The Offer. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X DELETE https: //api.sb/ leaseline.app/ offers/ offer_2hzYe1ERo0 \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"{
"api": "https: //api.sb/ leaseline.app",
"offer": {
"$id": "https: //api.sb/ leaseline.app/ offers/ offer_2hzYe1ERo0",
"$type": "Offer",
"price": {
"amount": 29,
"currency": "USD"
}
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Offer.delete",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}