Build an offering
POST/subscriptions/offerings/build
An offering includes products and plans; products are combined with one or more plans to form an offering. An offering can include either:
- subscription products. See create a product.
- Product Experience Manager products. See create a product.
Offerings represent a snapshot of their products and plans. If you make updates to products or plans within an offering, the original products and plans are not updated. Only the products and plans within the offering are updated. Alternatively, you can create new products or plans and attach them to an existing offering.
When you are building an offering:
- you can create new plans and products.
- you can modify an existing product and plans. For example, you can modify the product price or any attributes of a plan included in the offering.
Here's how you build an offering:
Specify the product to build with the offering. A product can be:
- subscription products. Specify the subscription product attributes.
- Product Experience Manager products. Specify the Product Experience Manager product ID in
external_ref
inProductAttributes
. For the remaining product attributes, you can specify their values to match the values of the existing Product Experience Manager product attributes. However, you can also specify different values, depending on your requirements.
Specify the plans to build with the offering. Plans are the rules that govern your subscription, for example, any discount. You can combine and reuse plans for as many products as you want, making it quick and easy to create your subscription offerings. An offering must have at least one plan.
Request
- application/json
Body
- Array [
- ExternalRef
- ProductAttributes
- UUID
- ]
- Array [
- ExternalRef
- PlanAttributes
- UUID
- ]
data BuildOfferingrequired
Possible values: <= 2048 characters
A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.
Possible values: >= 3 characters
and <= 1024 characters
The name of the offering.
Possible values: <= 1024 characters
The offering description to display to customers.
products object[]required
Possible values: >= 1
Either references of existing products to be attached to the offering or product information to be created directly within the offering
string
Possible values: <= 2048 characters
Possible values: <= 2048 characters
A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.
Possible values: >= 3 characters
and <= 1024 characters
The name of the product.
Possible values: <= 1024 characters
The product or service description to display to customers.
Possible values: <= 1024 characters
A stock keeping unit for the product, if appropriate.
Possible values: <= 1024 characters
A URL from which an image or file for the product can be fetched. You can either upload your images and files to Commerce using the Commerce Files API or you can use your own content delivery network. If you are using the Commerce Files API, use Create a File to upload your file and return an HREF link in the response. An extensive range of media and file extensions are supported.
price Price
property name* object
The base price.
The value as a whole number of the currency's smallest subdivision.
Indicates whether the amount includes any taxes.
price_units object
The timeframe during which the product price is applicable. For example, for a streaming service, the price is $12.99 and the unit
is months
and the amount
is 1
. In other words, the streaming service is available for $12.99 a month. You may want to specify a unit price if you have many products that all have different prices. Rather than having to create separate plans for each product, you can specify the timeframe during which the product price is applicable and then create one plan that determines the billing frequency for those products.
Possible values: [day
, month
]
A unit of time.
Possible values: >= 1
The number of days or months the period covers.
string
plans object[]required
Possible values: >= 1
Either references of existing plans to be attached to the offering or plan information to be created directly within the offering
string
Possible values: <= 2048 characters
Possible values: <= 2048 characters
A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.
Possible values: >= 3 characters
and <= 1024 characters
A name for the plan.
Possible values: <= 1024 characters
The plan description to display to customers.
Possible values: [day
, week
, month
, year
]
The unit of time that billing intervals are measured.
Possible values: >= 1
The number of intervals between issuing bills.
The number of intervals from the start of the subscription before billing starts. Used with billing_interval_type
. For example, if billing_interval_type
is months
, and trial_period
is 1
, the trial period is 1 month.
Possible values: >= 1
The number of intervals that the subscription runs for.
Possible values: [close
, roll
]
Enables you to specify recurring payments. If end_behavior
is roll
, customers pay regularly and repeatedly. If end_behavior
is close
, customers pay a total amount in a limited number of partial payments.
The subscriber can pause a subscription.
The subscriber can resume a paused subscription.
The subscriber can cancel a subscription.
Possible values: <= 100
A percentage discount on the total cost of any products within an offering. For example, you can configure a percentage that equates the cost of a plan to the total value of all products within the offering, reduced by a percentage. For example, if you specify 10
, a 10% discount is applied to the total value of all repeat products in an offering.
fixed_price Price
property name* object
The base price.
The value as a whole number of the currency's smallest subdivision.
Indicates whether the amount includes any taxes.
string
Responses
- 201
- 400
- 500
Success. The new subscription offering is created with the specified subscription products and plans attached to the offering.
- application/json
- Schema
- Example (from schema)
Schema
data Offering
The unique identifier.
Possible values: [subscription_offering
]
attributes OfferingAttributesrequired
Possible values: <= 2048 characters
A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.
Possible values: >= 3 characters
and <= 1024 characters
The name of the offering.
Possible values: <= 1024 characters
The offering description to display to customers.
The date and time a resource was updated.
The date and time a resource was created.
relationships Relationships
Relationships are established between different subscription entities. For example, a product and a plan are related to an offering, as both are attached to it.
meta OfferingMetarequired
The owner of a resource, either store
or organization
.
timestamps Timestampsrequired
The date and time a resource was updated.
The date and time a resource was created.
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "subscription_offering",
"attributes": {
"external_ref": "abc123",
"name": "Magazine",
"description": "A lovely magazine that is published every month.",
"updated_at": "2017-01-10T11:41:19.244842Z",
"created_at": "2017-01-10T11:41:19.244842Z"
},
"relationships": {
"plans": {
"links": {
"related": "/offerings/:offering-id/plans",
"self": "/offerings/:offering-id"
},
"data": {
"type": "offering-plan",
"id": "625fe958-7b4b-40a0-a2c0-dbb8f31eec0d"
}
}
},
"meta": {
"external_product_refs": [
"97dddc65-eabd-45d8-b45b-2ece5cfc8c50"
],
"owner": "store",
"timestamps": {
"updated_at": "2017-01-10T11:41:19.244842Z",
"created_at": "2017-01-10T11:41:19.244842Z"
}
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- missing-name
Schema
- Array [
- ]
errors Error[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Additional supporting meta data for the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Validation Error",
"status": "400",
"detail": "data.attributes.name: \"name\" is required"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors Error[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Additional supporting meta data for the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Internal Server Error",
"status": "500"
}
]
}