Subscriptions

The Subscriptions API enables you to manage Subscriptions and Subscription Plans with ease. A Subscription represents a recurring agreement between you and your customer, allowing for regular charges, such as for season cards.

Subscription Plans define specific properties for Subscriptions that are created based on the Plan. These properties include details like pricing and billing intervals, ensuring precise customization of subscription parameters and behavior

The Subscription object

Required attributes

  • Name
    _id
    Type
    string
    Description

    The ID of the subscription

  • Name
    sellerId
    Type
    string
    Description

    The ID of the seller of the subscription

  • Name
    status
    Type
    enum(DRAFT, ACTIVE, INCOMPLETE, CANCELED, ARCHIVED, PENDING-CANCELLATION)
    Description

    The status of the subscription

  • Name
    customerId
    Type
    string
    Description

    The ID of the customer of the subscription

  • Name
    planId
    Type
    string
    Description

    The ID of the plan of the subscription

  • Name
    currency
    Type
    enum(EUR, USD, GBP, AUD, CHF, THB, ILS, COP, MXN, DKK, NOK, SEK, QAR, CAD, ISK, GTQ, INR, DOP, SGD, PLN, SAR, TTD, ZAR, KYD, HKD, CZK, KRW, JPY, NZD, AED, MAD, TWD, BRL, BWP, NAD, KES, SCR, TRY, SZL, LSL, TZS, UGX, ZMW, ZWG, GHS, NGN, SLE, LRD, XOF, XAF, GEL, IDR, ARS, CRC, HUF, EGP, MYR, VND, PHP)
    Description

    An ISO 4217 3-character code of the currency

  • Name
    items
    Type
    array<object>
    Description

    The origin information of the subscription

Optional attributes

  • Name
    customerPaymentMethodId
    Type
    string
    Description

    The ID of the payment method of the subscription

  • Name
    origin
    Type
    object
    Description

    The origin information of the subscription

    Required nested attributes (1)
    • Name
      eventId
      Type
      string
      Description

      The ID of the event of the origin

    Optional nested attributes (1)
    • Name
      shopId
      Type
      string
      Description

      The ID of the shop of the origin

  • Name
    billing
    Type
    object
    Description

    The billing information of the subscription

    Required nested attributes (1)
    • Name
      cycles
      Type
      array<object>
      Description

      An array of billing cycles

      Required nested attributes (3)
      • Name
        start
        Type
        string
        Description

        An ISO timestamp indicating when the billing start is

      • Name
        end
        Type
        string
        Description

        An ISO timestamp indicating when the billing end is

      • Name
        status
        Type
        enum(FAILED, SCHEDULED, BILLED, CANCELED)
        Description

        The status of the billing

      Optional nested attributes (3)
      • Name
        due
        Type
        string
        Description

        An ISO timestamp indicating when the billing due is

      • Name
        transactionId
        Type
        string
        Description
      • Name
        isMinimumInterval
        Type
        boolean
        Description
  • Name
    consents
    Type
    array<object>
    Description

    An array of granted consents

    Required nested attributes (2)
    • Name
      type
      Type
      enum(autorenewal)
      Description

      The type of the subscription consent

    • Name
      granted
      Type
      string
      Description

      The date when the consent was granted

  • Name
    payment
    Type
    object
    Description

    The payment of the subscription

    Required nested attributes (2)
    • Name
      anchor
      Type
      string
      Description

      The anchor date of the payment

    • Name
      schedules
      Type
      array<object>
      Description
      Required nested attributes (3)
      • Name
        status
        Type
        enum(SCHEDULED, PENDING, SUCCEEDED, FAILED, REFUNDED)
        Description

        The status of the payment schedule resource

      • Name
        total
        Type
        number
        Description

        The total to be charged of the payment schedule

      • Name
        billingCycleId
        Type
        string
        Description

        The Billing Cycle ID of the payment schedule

      Optional nested attributes (5)
      • Name
        due
        Type
        string
        Description

        An ISO timestamp indicating when the due of the payment schedule is

      • Name
        paymentId
        Type
        string
        Description

        The Payment ID of the payment schedule

      • Name
        paymentRequestId
        Type
        string
        Description

        The Payment Request ID of the payment schedule

      • Name
        attempts
        Type
        array<object>
        Description

        An array of payment schedule attempts

        Required nested attributes (5)
        • Name
          _id
          Type
          string
          Description

          The ID of the payment schedule attempt

        • Name
          date
          Type
          string
          Description

          The date of the payment schedule attempt

        • Name
          status
          Type
          enum(SCHEDULED, PENDING, SUCCEEDED, FAILED, REFUNDED)
          Description

          The status of the payment schedule attempt

        • Name
          paymentRequestId
          Type
          string
          Description

          The Payment Request ID of the payment schedule attempt

        • Name
          paymentMethodId
          Type
          string
          Description

          The Payment Method ID of the payment schedule attempt

      • Name
        nextAttempt
        Type
        string
        Description

        An ISO timestamp indicating when the next attempt of the payment schedule is

  • Name
    cycles
    Type
    array<object>
    Description

    An array of applied cycles on the subscription

    Optional nested attributes (2)
    • Name
      cycleId
      Type
      string
      Description

      The cycle ID of the applied cycle

    • Name
      appliedAt
      Type
      string
      Description

      An ISO timestamp indicating when the cycle was applied

  • Name
    history
    Type
    array<object>
    Description

    An array of history items indicating changes on the subscription

    Optional nested attributes (4)
    • Name
      type
      Type
      enum(subscription.created, subscription.status_changed, subscription.cycle_applied, subscription.cycle_failed, subscription.billing_cycle_applied, subscription.payment_method_changed, subscription.item_changed, subscription.item_deleted, subscription.consent_granted, subscription.consent_revoked, subscription.upgraded)
      Description

      The type of the history item

    • Name
      date
      Type
      string
      Description

      An ISO timestamp indicating the date of the history item

    • Name
      userId
      Type
      string
      Description

      The user ID if the history item comes from a non-subscription-holders

    • Name
      data
      Type
      object
      Description

      The data of the history item

  • Name
    transactionId
    Type
    string
    Description

    The ID of the transaction of the subscription

  • Name
    startAt
    Type
    string
    Description

    An ISO timestamp indicating when the subscription starts

  • Name
    cancelAt
    Type
    string
    Description

    An ISO timestamp indicating when the subscription cancels

  • Name
    canceledAt
    Type
    string
    Description

    An ISO timestamp indicating when the subscription was canceled

  • Name
    company
    Type
    string
    Description

    The company of the subscription holder

  • Name
    firstname
    Type
    string
    Description

    The first name of the subscription holder

  • Name
    lastname
    Type
    string
    Description

    The last name of the subscription holder

  • Name
    name
    Type
    string
    Description

    The name of the subscription holder

  • Name
    email
    Type
    string
    Description

    The email of the subscription holder

  • Name
    phone
    Type
    string
    Description

    The phone number of the subscription holder

  • Name
    address
    Type
    object
    Description

    The address information of the subscription holder

    Optional nested attributes (7)
    • Name
      fullAddress
      Type
      string
      Description

      Optional full address

    • Name
      street
      Type
      string
      Description

      The street of the address. Street name including number.

    • Name
      line2
      Type
      string
      Description

      The additional field of the address.

    • Name
      postal
      Type
      string
      Description

      The postal code of the address.

    • Name
      city
      Type
      string
      Description

      The city of the address.

    • Name
      country
      Type
      string
      Description

      The country of the address. An ISO 3166 country code.

    • Name
      state
      Type
      string
      Description

      The state of the address. If applicable

  • Name
    secret
    Type
    string
    Description

    The secret token of the subscription

  • Name
    attributes
    Type
    object
    Description

Example

{
  "_id": "507f191e810c19729de860ea",
  "sellerId": "507f191e810c19729de860ea",
  "status": "DRAFT",
  "customerId": "507f191e810c19729de860ea",
  "planId": "507f191e810c19729de860ea",
  "currency": "EUR",
  "items": [],
  "customerPaymentMethodId": "507f191e810c19729de860ea",
  "origin": {
    "eventId": "507f191e810c19729de860ea",
    "shopId": "507f191e810c19729de860ea"
  },
  "billing": {
    "cycles": [
      {
        "start": "2030-01-23T23:00:00.123Z",
        "end": "2030-01-23T23:00:00.123Z",
        "status": "FAILED",
        "due": "2030-01-23T23:00:00.123Z",
        "transactionId": "507f191e810c19729de860ea",
        "isMinimumInterval": true
      }
    ]
  },
  "consents": [
    {
      "type": "autorenewal",
      "granted": "2030-01-23T23:00:00.123Z"
    }
  ],
  "payment": {
    "anchor": "2030-01-23T23:00:00.123Z",
    "schedules": []
  },
  "cycles": [],
  "history": [],
  "transactionId": "507f191e810c19729de860ea",
  "startAt": "2030-01-23T23:00:00.123Z",
  "cancelAt": "2030-01-23T23:00:00.123Z",
  "canceledAt": "2030-01-23T23:00:00.123Z",
  "company": "string",
  "firstname": "string",
  "lastname": "string",
  "name": "Example Name",
  "email": "example@vivenu.com",
  "phone": "string",
  "address": {
    "fullAddress": "string",
    "street": "string",
    "line2": "string",
    "postal": "string",
    "city": "string",
    "country": "string",
    "state": "string"
  },
  "secret": "2030-01-23T23:00:00.123Z",
  "attributes": {}
}

GET/api/subscriptions/:id

Get a Subscription

Get a Subscription

Request

GET
/api/subscriptions/:id
const response = await fetch('https://vivenu.com/api/subscriptions/507f191e810c19729de860ea', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

{
  "_id": "507f191e810c19729de860ea",
  "sellerId": "507f191e810c19729de860ea",
  "status": "DRAFT",
  "customerId": "507f191e810c19729de860ea",
  "planId": "507f191e810c19729de860ea",
  "currency": "EUR",
  "items": [],
  "customerPaymentMethodId": "507f191e810c19729de860ea",
  "origin": {
    "eventId": "507f191e810c19729de860ea",
    "shopId": "507f191e810c19729de860ea"
  },
  "billing": {
    "cycles": [
      {
        "start": "2030-01-23T23:00:00.123Z",
        "end": "2030-01-23T23:00:00.123Z",
        "status": "FAILED",
        "due": "2030-01-23T23:00:00.123Z",
        "transactionId": "507f191e810c19729de860ea",
        "isMinimumInterval": true
      }
    ]
  },
  "consents": [
    {
      "type": "autorenewal",
      "granted": "2030-01-23T23:00:00.123Z"
    }
  ],
  "payment": {
    "anchor": "2030-01-23T23:00:00.123Z",
    "schedules": []
  },
  "cycles": [],
  "history": [],
  "transactionId": "507f191e810c19729de860ea",
  "startAt": "2030-01-23T23:00:00.123Z",
  "cancelAt": "2030-01-23T23:00:00.123Z",
  "canceledAt": "2030-01-23T23:00:00.123Z",
  "company": "string",
  "firstname": "string",
  "lastname": "string",
  "name": "Example Name",
  "email": "example@vivenu.com",
  "phone": "string",
  "address": {
    "fullAddress": "string",
    "street": "string",
    "line2": "string",
    "postal": "string",
    "city": "string",
    "country": "string",
    "state": "string"
  },
  "secret": "2030-01-23T23:00:00.123Z",
  "attributes": {}
}

PUT/api/subscriptions/:id

Update a Subscription

Update a Subscription

Payload

Required attributes

  • Name
    secret
    Type
    string
    Description

Optional attributes

  • Name
    status
    Type
    enum(DRAFT, ACTIVE, INCOMPLETE, CANCELED, ARCHIVED, PENDING-CANCELLATION)
    Description

    The status of the subscription

  • Name
    customerPaymentMethodId
    Type
    string
    Description

    The ID of the payment method of the subscription

  • Name
    attributes
    Type
    object
    Description
  • Name
    consents
    Type
    array<object>
    Description

    An array of granted consents

    Required nested attributes (2)
    • Name
      type
      Type
      enum(autorenewal)
      Description

      The type of the subscription consent

    • Name
      granted
      Type
      string
      Description

      The date when the consent was granted

Request

PUT
/api/subscriptions/:id
const response = await fetch('https://vivenu.com/api/subscriptions/507f191e810c19729de860ea', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "secret": "string",
    "status": "DRAFT",
    "customerPaymentMethodId": "507f191e810c19729de860ea",
    "attributes": {},
    "consents": [
      {
        "type": "autorenewal",
        "granted": "2030-01-23T23:00:00.123Z"
      }
    ]
  }),
})

const data = await response.json()

GET/api/subscriptions

Get all Subscriptions

Get all Subscriptions

Query parameters

Optional query parameters

  • Name
    top
    Type
    number
    Description
  • Name
    skip
    Type
    number
    Description
  • Name
    customerId
    Type
    string
    Description
  • Name
    planId
    Type
    string
    Description
  • Name
    planVariantIds
    Type
    array<string>
    Description
  • Name
    eventId
    Type
    string
    Description
  • Name
    customerPaymentMethodId
    Type
    string
    Description
  • Name
    updatedAt
    Type
    object
    Description
  • Name
    status
    Type
    array<enum(DRAFT, ACTIVE, INCOMPLETE, CANCELED, ARCHIVED, PENDING-CANCELLATION)>
    Description

Request

GET
/api/subscriptions
const response = await fetch('https://vivenu.com/api/subscriptions?top=10.5&skip=10.5&customerId=507f191e810c19729de860ea&planId=507f191e810c19729de860ea&planVariantIds=value1%2Cvalue2&eventId=507f191e810c19729de860ea&customerPaymentMethodId=507f191e810c19729de860ea&updatedAt=2030-01-23T23%3A00%3A00.123Z&status=value1%2Cvalue2', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

{
  "docs": [],
  "total": 1
}

PUT/api/subscriptions/:id/items/:itemId

Update Subscription Items

Update Subscription Items

Payload

Required attributes

  • Name
    secret
    Type
    string
    Description

Optional attributes

  • Name
    seatingReservationToken
    Type
    string
    Description
  • Name
    item
    Type
    object
    Description

Request

PUT
/api/subscriptions/:id/items/:itemId
const response = await fetch('https://vivenu.com/api/subscriptions/507f191e810c19729de860ea/items/507f191e810c19729de860ea', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "secret": "string",
    "seatingReservationToken": "string"
  }),
})

const data = await response.json()

The Subscription Plan object

Required attributes

  • Name
    _id
    Type
    string
    Description

    The ID of the subscription plan

  • Name
    name
    Type
    string
    Description

    The name of the subscription plan

  • Name
    sellerId
    Type
    string
    Description

    The ID of the seller of the subscription plan

Optional attributes

  • Name
    pricingPolicy
    Type
    enum(fixed, inherited)
    Description

    The pricing policy of the subscription plan

  • Name
    variants
    Type
    array<object>
    Description

    An array of variants of the subscription plan

    Required nested attributes (2)
    • Name
      _id
      Type
      string
      Description

      The ID of the plan variant

    • Name
      name
      Type
      string
      Description

      The name of the plan variant

    Optional nested attributes (2)
    • Name
      canChangeVariant
      Type
      boolean
      Description

      Whether the variant is changeable or not

    • Name
      allowedVariants
      Type
      array<string>
      Description

      Allowed variants to change of the variant

  • Name
    billingCycle
    Type
    object
    Description

    The billing plan of the subscription plan

    Required nested attributes (1)
    • Name
      scheme
      Type
      enum(one-off, recurring, interactive_recurring)
      Description

      The scheme of the billing cycle

    Optional nested attributes (4)
    • Name
      interval
      Type
      enum(DAY, WEEK, MONTH)
      Description

      The interval of the billing cycle

    • Name
      every
      Type
      number
      Description

      The recurrence of the billing cycle

    • Name
      minimumIntervals
      Type
      number
      Description
    • Name
      renewalOptions
      Type
      object
      Description

      Renewal options for interactive recurring billing

      Required nested attributes (1)
      • Name
        periodStart
        Type
        object
        Description

        When the renewal window opens, relative to the current cycle end

        Required nested attributes (2)
        • Name
          unit
          Type
          enum(hours, days, weeks, months, years)
          Description

          The unit in which the offset is specified

        • Name
          offset
          Type
          integer
          Description

          The offset to the date

        Optional nested attributes (1)
        • Name
          target
          Type
          string
          Description

          The target of the relative date

  • Name
    paymentSchedules
    Type
    array<object>
    Description

    An array of payment plans of the subscription plan

    Required nested attributes (1)
    • Name
      _id
      Type
      string
      Description
    Optional nested attributes (3)
    • Name
      scheme
      Type
      enum(one-off, installments)
      Description

      The scheme of the payment

    • Name
      interval
      Type
      enum(DAY, WEEK, MONTH)
      Description

      The interval of the payment

    • Name
      numberOfInstallments
      Type
      number
      Description

      The number of installments of the payment

  • Name
    renewalPolicy
    Type
    object
    Description

    The renewal policy of the subscription plan

    Optional nested attributes (5)
    • Name
      changesPeriodStart
      Type
      string
      Description

      An ISO timestamp indicating when the changes period starts

    • Name
      changesPeriodEnd
      Type
      string
      Description

      An ISO timestamp indicating when the changes period ends

    • Name
      allowedChanges
      Type
      object
      Description

      Allowed Changes settings of the renewal policy

      Optional nested attributes (2)
      • Name
        ticketType
        Type
        boolean
        Description

        Whether changes of ticketTypes are allowed or not

      • Name
        seat
        Type
        boolean
        Description

        Whether changes of seats are allowed or not

    • Name
      confirmationPeriodStart
      Type
      string
      Description

      An ISO timestamp indicating when the confirmation period starts

    • Name
      confirmationPeriodEnd
      Type
      string
      Description

      An ISO timestamp indicating when the confirmation period ends

  • Name
    paymentPolicy
    Type
    object
    Description

    The payment policy of the subscription plan

    Optional nested attributes (4)
    • Name
      interaction
      Type
      enum(payNowOnly, customerPaymentMethod)
      Description

      The interaction type of the payment policy

    • Name
      allowedPaymentGateways
      Type
      array<string>
      Description

      Allowed payment gateways

    • Name
      changePaymentMethodPolicy
      Type
      enum(always, never, onDraft)
      Description

      Change payment method policy

    • Name
      allowedChangePaymentMethodGateways
      Type
      array<string>
      Description

      Allowed change payment method gateways

  • Name
    requestedConsents
    Type
    array<object>
    Description

    The subscription consent types requested during checkout

    Optional nested attributes (3)
    • Name
      type
      Type
      enum(autorenewal)
      Description
    • Name
      description
      Type
      string
      Description
    • Name
      default
      Type
      boolean
      Description

Example

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "sellerId": "507f191e810c19729de860ea",
  "pricingPolicy": "fixed",
  "variants": [],
  "billingCycle": {},
  "paymentSchedules": [
    {}
  ],
  "renewalPolicy": {
    "changesPeriodStart": "2030-01-23T23:00:00.123Z",
    "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
    "allowedChanges": {},
    "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
    "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
  },
  "paymentPolicy": {
    "interaction": "customerPaymentMethod",
    "allowedPaymentGateways": [],
    "changePaymentMethodPolicy": "always",
    "allowedChangePaymentMethodGateways": []
  },
  "requestedConsents": [
    {
      "type": "autorenewal",
      "description": "string",
      "default": true
    }
  ]
}

POST/api/subscriptions/plans

Create a subscription Plan

Create a subscription Plan

Payload

Required attributes

  • Name
    name
    Type
    string
    Description

    The name of the subscription plan

Optional attributes

  • Name
    pricingPolicy
    Type
    enum(fixed, inherited)
    Description

    The pricing policy of the subscription plan

  • Name
    variants
    Type
    array<object>
    Description

    An array of variants of the subscription plan

    Required nested attributes (2)
    • Name
      _id
      Type
      string
      Description

      The ID of the plan variant

    • Name
      name
      Type
      string
      Description

      The name of the plan variant

    Optional nested attributes (2)
    • Name
      canChangeVariant
      Type
      boolean
      Description

      Whether the variant is changeable or not

    • Name
      allowedVariants
      Type
      array<string>
      Description

      Allowed variants to change of the variant

  • Name
    paymentSchedules
    Type
    array<object>
    Description

    An array of payment plans of the subscription plan

    Required nested attributes (1)
    • Name
      _id
      Type
      string
      Description
    Optional nested attributes (3)
    • Name
      scheme
      Type
      enum(one-off, installments)
      Description

      The scheme of the payment

    • Name
      interval
      Type
      enum(DAY, WEEK, MONTH)
      Description

      The interval of the payment

    • Name
      numberOfInstallments
      Type
      number
      Description

      The number of installments of the payment

  • Name
    billingCycle
    Type
    object
    Description

    The billing plan of the subscription plan

    Required nested attributes (1)
    • Name
      scheme
      Type
      enum(one-off, recurring, interactive_recurring)
      Description

      The scheme of the billing cycle

    Optional nested attributes (4)
    • Name
      interval
      Type
      enum(DAY, WEEK, MONTH)
      Description

      The interval of the billing cycle

    • Name
      every
      Type
      number
      Description

      The recurrence of the billing cycle

    • Name
      minimumIntervals
      Type
      number
      Description
    • Name
      renewalOptions
      Type
      object
      Description

      Renewal options for interactive recurring billing

      Required nested attributes (1)
      • Name
        periodStart
        Type
        object
        Description

        When the renewal window opens, relative to the current cycle end

        Required nested attributes (2)
        • Name
          unit
          Type
          enum(hours, days, weeks, months, years)
          Description

          The unit in which the offset is specified

        • Name
          offset
          Type
          integer
          Description

          The offset to the date

        Optional nested attributes (1)
        • Name
          target
          Type
          string
          Description

          The target of the relative date

  • Name
    renewalPolicy
    Type
    object
    Description

    The renewal policy of the subscription plan

    Optional nested attributes (5)
    • Name
      changesPeriodStart
      Type
      string
      Description

      An ISO timestamp indicating when the changes period starts

    • Name
      changesPeriodEnd
      Type
      string
      Description

      An ISO timestamp indicating when the changes period ends

    • Name
      allowedChanges
      Type
      object
      Description

      Allowed Changes settings of the renewal policy

      Optional nested attributes (2)
      • Name
        ticketType
        Type
        boolean
        Description

        Whether changes of ticketTypes are allowed or not

      • Name
        seat
        Type
        boolean
        Description

        Whether changes of seats are allowed or not

    • Name
      confirmationPeriodStart
      Type
      string
      Description

      An ISO timestamp indicating when the confirmation period starts

    • Name
      confirmationPeriodEnd
      Type
      string
      Description

      An ISO timestamp indicating when the confirmation period ends

  • Name
    paymentPolicy
    Type
    object
    Description

    The payment policy of the subscription plan

    Optional nested attributes (4)
    • Name
      interaction
      Type
      enum(payNowOnly, customerPaymentMethod)
      Description

      The interaction type of the payment policy

    • Name
      allowedPaymentGateways
      Type
      array<string>
      Description

      Allowed payment gateways

    • Name
      changePaymentMethodPolicy
      Type
      enum(always, never, onDraft)
      Description

      Change payment method policy

    • Name
      allowedChangePaymentMethodGateways
      Type
      array<string>
      Description

      Allowed change payment method gateways

  • Name
    requestedConsents
    Type
    array<object>
    Description

    The subscription consent types requested during checkout

    Optional nested attributes (3)
    • Name
      type
      Type
      enum(autorenewal)
      Description
    • Name
      description
      Type
      string
      Description
    • Name
      default
      Type
      boolean
      Description

Request

POST
/api/subscriptions/plans
const response = await fetch('https://vivenu.com/api/subscriptions/plans', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "name": "Example Name",
    "pricingPolicy": "fixed",
    "variants": [],
    "paymentSchedules": [
      {}
    ],
    "billingCycle": {},
    "renewalPolicy": {
      "changesPeriodStart": "2030-01-23T23:00:00.123Z",
      "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
      "allowedChanges": {},
      "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
      "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
    },
    "paymentPolicy": {
      "interaction": "customerPaymentMethod",
      "allowedPaymentGateways": [],
      "changePaymentMethodPolicy": "always",
      "allowedChangePaymentMethodGateways": []
    },
    "requestedConsents": [
      {
        "type": "autorenewal",
        "description": "string",
        "default": true
      }
    ]
  }),
})

const data = await response.json()

Response (201)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "sellerId": "507f191e810c19729de860ea",
  "pricingPolicy": "fixed",
  "variants": [],
  "billingCycle": {},
  "paymentSchedules": [
    {}
  ],
  "renewalPolicy": {
    "changesPeriodStart": "2030-01-23T23:00:00.123Z",
    "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
    "allowedChanges": {},
    "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
    "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
  },
  "paymentPolicy": {
    "interaction": "customerPaymentMethod",
    "allowedPaymentGateways": [],
    "changePaymentMethodPolicy": "always",
    "allowedChangePaymentMethodGateways": []
  },
  "requestedConsents": [
    {
      "type": "autorenewal",
      "description": "string",
      "default": true
    }
  ]
}

GET/api/subscriptions/plans/:id

Get a Subscription Plan

Get a Subscription Plan

Request

GET
/api/subscriptions/plans/:id
const response = await fetch('https://vivenu.com/api/subscriptions/plans/507f191e810c19729de860ea', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "sellerId": "507f191e810c19729de860ea",
  "pricingPolicy": "fixed",
  "variants": [],
  "billingCycle": {},
  "paymentSchedules": [
    {}
  ],
  "renewalPolicy": {
    "changesPeriodStart": "2030-01-23T23:00:00.123Z",
    "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
    "allowedChanges": {},
    "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
    "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
  },
  "paymentPolicy": {
    "interaction": "customerPaymentMethod",
    "allowedPaymentGateways": [],
    "changePaymentMethodPolicy": "always",
    "allowedChangePaymentMethodGateways": []
  },
  "requestedConsents": [
    {
      "type": "autorenewal",
      "description": "string",
      "default": true
    }
  ]
}

PUT/api/subscriptions/plans/:id

Update a subscription Plan

Update a subscription Plan

Payload

Optional attributes

  • Name
    name
    Type
    string
    Description

    The name of the subscription plan

  • Name
    pricingPolicy
    Type
    enum(fixed, inherited)
    Description

    The pricing policy of the subscription plan

  • Name
    variants
    Type
    array<object>
    Description

    An array of variants of the subscription plan

    Required nested attributes (2)
    • Name
      _id
      Type
      string
      Description

      The ID of the plan variant

    • Name
      name
      Type
      string
      Description

      The name of the plan variant

    Optional nested attributes (2)
    • Name
      canChangeVariant
      Type
      boolean
      Description

      Whether the variant is changeable or not

    • Name
      allowedVariants
      Type
      array<string>
      Description

      Allowed variants to change of the variant

  • Name
    paymentSchedules
    Type
    array<object>
    Description

    An array of payment plans of the subscription plan

    Required nested attributes (1)
    • Name
      _id
      Type
      string
      Description
    Optional nested attributes (3)
    • Name
      scheme
      Type
      enum(one-off, installments)
      Description

      The scheme of the payment

    • Name
      interval
      Type
      enum(DAY, WEEK, MONTH)
      Description

      The interval of the payment

    • Name
      numberOfInstallments
      Type
      number
      Description

      The number of installments of the payment

  • Name
    billingCycle
    Type
    object
    Description

    The billing plan of the subscription plan

    Required nested attributes (1)
    • Name
      scheme
      Type
      enum(one-off, recurring, interactive_recurring)
      Description

      The scheme of the billing cycle

    Optional nested attributes (4)
    • Name
      interval
      Type
      enum(DAY, WEEK, MONTH)
      Description

      The interval of the billing cycle

    • Name
      every
      Type
      number
      Description

      The recurrence of the billing cycle

    • Name
      minimumIntervals
      Type
      number
      Description
    • Name
      renewalOptions
      Type
      object
      Description

      Renewal options for interactive recurring billing

      Required nested attributes (1)
      • Name
        periodStart
        Type
        object
        Description

        When the renewal window opens, relative to the current cycle end

        Required nested attributes (2)
        • Name
          unit
          Type
          enum(hours, days, weeks, months, years)
          Description

          The unit in which the offset is specified

        • Name
          offset
          Type
          integer
          Description

          The offset to the date

        Optional nested attributes (1)
        • Name
          target
          Type
          string
          Description

          The target of the relative date

  • Name
    renewalPolicy
    Type
    object
    Description

    The renewal policy of the subscription plan

    Optional nested attributes (5)
    • Name
      changesPeriodStart
      Type
      string
      Description

      An ISO timestamp indicating when the changes period starts

    • Name
      changesPeriodEnd
      Type
      string
      Description

      An ISO timestamp indicating when the changes period ends

    • Name
      allowedChanges
      Type
      object
      Description

      Allowed Changes settings of the renewal policy

      Optional nested attributes (2)
      • Name
        ticketType
        Type
        boolean
        Description

        Whether changes of ticketTypes are allowed or not

      • Name
        seat
        Type
        boolean
        Description

        Whether changes of seats are allowed or not

    • Name
      confirmationPeriodStart
      Type
      string
      Description

      An ISO timestamp indicating when the confirmation period starts

    • Name
      confirmationPeriodEnd
      Type
      string
      Description

      An ISO timestamp indicating when the confirmation period ends

  • Name
    paymentPolicy
    Type
    object
    Description

    The payment policy of the subscription plan

    Optional nested attributes (4)
    • Name
      interaction
      Type
      enum(payNowOnly, customerPaymentMethod)
      Description

      The interaction type of the payment policy

    • Name
      allowedPaymentGateways
      Type
      array<string>
      Description

      Allowed payment gateways

    • Name
      changePaymentMethodPolicy
      Type
      enum(always, never, onDraft)
      Description

      Change payment method policy

    • Name
      allowedChangePaymentMethodGateways
      Type
      array<string>
      Description

      Allowed change payment method gateways

  • Name
    requestedConsents
    Type
    array<object>
    Description

    The subscription consent types requested during checkout

    Optional nested attributes (3)
    • Name
      type
      Type
      enum(autorenewal)
      Description
    • Name
      description
      Type
      string
      Description
    • Name
      default
      Type
      boolean
      Description

Request

PUT
/api/subscriptions/plans/:id
const response = await fetch('https://vivenu.com/api/subscriptions/plans/507f191e810c19729de860ea', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "name": "Example Name",
    "pricingPolicy": "fixed",
    "variants": [],
    "paymentSchedules": [
      {}
    ],
    "billingCycle": {},
    "renewalPolicy": {
      "changesPeriodStart": "2030-01-23T23:00:00.123Z",
      "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
      "allowedChanges": {},
      "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
      "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
    },
    "paymentPolicy": {
      "interaction": "customerPaymentMethod",
      "allowedPaymentGateways": [],
      "changePaymentMethodPolicy": "always",
      "allowedChangePaymentMethodGateways": []
    },
    "requestedConsents": [
      {
        "type": "autorenewal",
        "description": "string",
        "default": true
      }
    ]
  }),
})

const data = await response.json()

Response (200)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "sellerId": "507f191e810c19729de860ea",
  "pricingPolicy": "fixed",
  "variants": [],
  "billingCycle": {},
  "paymentSchedules": [
    {}
  ],
  "renewalPolicy": {
    "changesPeriodStart": "2030-01-23T23:00:00.123Z",
    "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
    "allowedChanges": {},
    "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
    "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
  },
  "paymentPolicy": {
    "interaction": "customerPaymentMethod",
    "allowedPaymentGateways": [],
    "changePaymentMethodPolicy": "always",
    "allowedChangePaymentMethodGateways": []
  },
  "requestedConsents": [
    {
      "type": "autorenewal",
      "description": "string",
      "default": true
    }
  ]
}

GET/api/subscriptions/plans

Get all Subscription Plans

Get all Subscription Plans

Query parameters

Optional query parameters

  • Name
    top
    Type
    number
    Description
  • Name
    skip
    Type
    number
    Description

Request

GET
/api/subscriptions/plans
const response = await fetch('https://vivenu.com/api/subscriptions/plans?top=10.5&skip=10.5', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

{
  "docs": [],
  "total": 1
}

Was this page helpful?