Skip to main content

Create a subscription

POST 

https://epcc-integration.global.ssl.fastly.net/v2/subscriptions/subscriptions

Create a subscription

Request

Query Parameters

    filter string

Body

    data BuildSubscriptionrequired
    external_ref ExternalRef (string)

    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.

    account_id UUID (string)required

    The unique identifier.

    offering_id UUID (string)required

    The unique identifier.

    plan_id UUID (string)required

    The unique identifier.

    currency CurrencyIdentifier (string)required

    Possible values: <= 1024 characters

    The three-letter ISO currency code in uppercase.

    payment_authority PaymentAuthority
    type stringrequired

    Possible values: [elastic_path_payments_stripe, authorize_net]

    The name of the payment gateway facilitating the secure transmission of payment data.

    customer_id stringrequired

    Possible values: <= 1024 characters

    The unique identifier for a customer.

    card_id stringrequired

    Possible values: <= 1024 characters

    The unique identifier of the card used to facilitate payment of the subscription.

    name stringrequired

    Possible values: >= 3 characters and <= 1024 characters

    email emailrequired

    Possible values: >= 3 characters and <= 1024 characters

    meta SubscriptionMeta
    timestamps Timestampsrequired
    updated_at stringrequired

    The date and time a resource was updated.

    created_at stringrequired

    The date and time a resource was created.

    canceled_at string

    The date and time a subscription was cancelled.

    paused_at string

    The date and time a subscription was paused.

    resumed_at string

    The date and time a subscription was resumed.

    end_date string

    The date and time a subscription will end.

    status Status (string)required

    Possible values: [active, inactive]

    The status of a subscription, either active or inactive.

    state SubscriptionState
    id UUID (string)

    The unique identifier.

    type SubscriptionStateType (string)required

    Possible values: [subscription_state]

    This represents the type of resource object being returned. Always subscription_state.

    attributes SubscriptionStateAttributesrequired
    action SubscriptionStateAction (string)required

    Possible values: [cancel, pause, resume]

    The subscription lifecycle is the states that a subscription can go through when a customer subscribes to a service or a product.

    A subscription can have the following states; canceled, paused, or resumed.

    See Managing the subscription lifecycle.

    meta StateMetarequired
    created_at stringrequired

    The date and time a resource was created.

    canceled Canceled (boolean)required

    Whether a subscription is canceled or not.

    paused Paused (boolean)required

    Whether a subscription is paused or not.

    closed Closed (boolean)required

    Whether a subscription is closed or not.

    invoice_after stringrequired

    The date and time after which a subscription invoice will be generated.

Responses

Success. The subscription is created.

Schema
    data Subscription
    id UUID (string)

    The unique identifier.

    type SubscriptionType (string)required

    Possible values: [subscription]

    attributes SubscriptionAttributesrequired
    external_ref ExternalRef (string)

    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.

    account_id UUID (string)required

    The unique identifier.

    offering Offeringrequired
    id UUID (string)

    The unique identifier.

    type SubscriptionOfferingType (string)required

    Possible values: [subscription_offering]

    attributes OfferingAttributesrequired
    external_ref ExternalRef (string)

    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.

    name stringrequired

    Possible values: >= 3 characters and <= 1024 characters

    The name of the offering.

    description string

    Possible values: <= 1024 characters

    The offering description to display to customers.

    updated_at stringrequired

    The date and time a resource was updated.

    created_at stringrequired

    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.

    anyOf
    title
    meta OfferingMetarequired
    external_product_refs string[]required
    owner stringrequired

    The owner of a resource, either store or organization.

    timestamps Timestampsrequired
    updated_at stringrequired

    The date and time a resource was updated.

    created_at stringrequired

    The date and time a resource was created.

    plan_id UUID (string)required

    The unique identifier.

    currency CurrencyIdentifier (string)required

    Possible values: <= 1024 characters

    The three-letter ISO currency code in uppercase.

    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.

    anyOf
    title
    meta SubscriptionMetarequired
    owner stringrequired

    The owner of a resource, either store or organization.

    timestamps Timestampsrequired
    updated_at stringrequired

    The date and time a resource was updated.

    created_at stringrequired

    The date and time a resource was created.

    canceled_at string

    The date and time a subscription was cancelled.

    paused_at string

    The date and time a subscription was paused.

    resumed_at string

    The date and time a subscription was resumed.

    end_date string

    The date and time a subscription will end.

    status Status (string)required

    Possible values: [active, inactive]

    The status of a subscription, either active or inactive.

    state SubscriptionState
    id UUID (string)

    The unique identifier.

    type SubscriptionStateType (string)required

    Possible values: [subscription_state]

    This represents the type of resource object being returned. Always subscription_state.

    attributes SubscriptionStateAttributesrequired
    action SubscriptionStateAction (string)required

    Possible values: [cancel, pause, resume]

    The subscription lifecycle is the states that a subscription can go through when a customer subscribes to a service or a product.

    A subscription can have the following states; canceled, paused, or resumed.

    See Managing the subscription lifecycle.

    meta StateMetarequired
    created_at stringrequired

    The date and time a resource was created.

    canceled Canceled (boolean)required

    Whether a subscription is canceled or not.

    paused Paused (boolean)required

    Whether a subscription is paused or not.

    closed Closed (boolean)required

    Whether a subscription is closed or not.

    invoice_after stringrequired

    The date and time after which a subscription invoice will be generated.

Authorization: http

name: BearerTokentype: httpscheme: bearer
curl -L -X POST 'https://epcc-integration.global.ssl.fastly.net/v2/subscriptions/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"data": {
"external_ref": "abc123",
"account_id": "00000000-0000-0000-0000-000000000000",
"offering_id": "00000000-0000-0000-0000-000000000000",
"plan_id": "00000000-0000-0000-0000-000000000000",
"currency": "USD",
"payment_authority": {
"type": "elastic_path_payments_stripe",
"customer_id": "cus_OPfKlxWV3hp9h6",
"card_id": "card_8Diw3FQPhxK27WADPVMeXieP"
},
"name": "Albert Einstein",
"email": "albert@elasticpath.com"
}
}'
Request Collapse all
Base URL
https://epcc-integration.global.ssl.fastly.net/v2
Auth
Parameters
— query
Body
{
  "data": {
    "external_ref": "abc123",
    "account_id": "00000000-0000-0000-0000-000000000000",
    "offering_id": "00000000-0000-0000-0000-000000000000",
    "plan_id": "00000000-0000-0000-0000-000000000000",
    "currency": "USD",
    "payment_authority": {
      "type": "elastic_path_payments_stripe",
      "customer_id": "cus_OPfKlxWV3hp9h6",
      "card_id": "card_8Diw3FQPhxK27WADPVMeXieP"
    },
    "name": "Albert Einstein",
    "email": "albert@elasticpath.com"
  }
}
ResponseClear

Click the Send API Request button above and see the response here!