Offer programs: accept, grant, publish, subscribe
The Offer Verbs accept, grant, publish, subscribe as MCP do programs, with inputs, result, refusals and an example.
Reference for Offer, one group of Offer programs.
Offer.accept
Accept records that a party takes an Offer, which makes that party a Customer of the Startup. Verb page.
do: return await $.Offer.accept(input)Emits Offer.accepted.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
offer | Offer | required | The Offer to accept. |
party | string | required | The person or organization accepting. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
customer | Customer | required | The Customer the party is or becomes. |
offer | Offer | required | The Offer accepted. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The operation is part of an Offer the caller has not accepted or paid for. | payment-required | Accept the Offer named in the response, then retry the call. | None. |
| 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. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
{
"name": "do",
"arguments": {
"code": "return await $.Offer.accept({ offer: 'offer_2hzYe1ERo0', party: 'Pinecrest Homes' })"
}
}Offer.grant
Grant adds an Entitlement to an Offer: a Verb its Customers may call, optionally bounded by a Limit. Verb page.
do: return await $.Offer.grant(input)Emits Offer.granted.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
offer | Offer | required | The Offer that grants it. |
verb | Verb | required | The Verb its Customers may call, as Noun.verb. |
limit | Limit | The Limit that bounds it. Unset: a feature, called as often as the Customer likes. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
entitlement | Entitlement | required | The new Entitlement, granted by the Offer. |
offer | Offer | required | The Offer, with the Entitlement added. |
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
{
"name": "do",
"arguments": {
"code": "return await $.Offer.grant({ offer: 'offer_2hzYe1ERo0', verb: 'verb_hlkWBvrAyZ' })"
}
}Offer.publish
Publish makes an Offer available for parties to accept. Verb page.
do: return await $.Offer.publish(input)Emits Offer.published.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
offer | Offer | required | The Offer to publish. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
offer | Offer | required | The Offer, now open to accept. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| A Service Offer promises a remedy or a pricing basis that its Service’s checks cannot back. | contract-unsupported | Add a stronger check to the Service’s steps, or offer a cheaper remedy or basis, then publish again. | None. |
| 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. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
| The median Customer’s Cost leaves less than the Startup’s target margin at this Price. | below-contribution-floor | Raise the Price to the floor the error names, or grant fewer Entitlements. | Offer.update |
Example
{
"name": "do",
"arguments": {
"code": "return await $.Offer.publish({ offer: 'offer_2hzYe1ERo0' })"
}
}Offer.subscribe
Subscribe accepts a recurring Offer as a Subscription that renews each period until it ends. Verb page.
do: return await $.Offer.subscribe(input)Emits Offer.subscribed.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
offer | Offer | required | The recurring Offer. |
quantity | integer | Seats or units. Defaults to 1. | |
promotionCode | string | A promotion code the buyer typed; applies its Coupon for the Coupon’s duration. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
subscription | Subscription | required | The new Subscription. |
offer | Offer | required | The Offer subscribed to. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The input does not match the schema of the operation. | invalid-input | Read the schema of the operation, then send every required field with the right type. | None. |
| The operation is part of an Offer the caller has not accepted or paid for. | payment-required | Accept the Offer named in the response, then retry the call. | Offer.accept |
| 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. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
{
"name": "do",
"arguments": {
"code": "return await $.Offer.subscribe({ offer: 'offer_2hzYe1ERo0' })"
}
}