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, MWK)
    Description

    An ISO 4217 3-character code of the currency

  • Name
    items
    Type
    array<SubscriptionItemResource>
    Description

    The origin information of the subscription

    Required nested attributes (4)
    • Name
      amount
      Type
      integer
      Description

      The amount of the cart item.

    • Name
      price
      Type
      number float
      Description

      The single piece price of the cart item.

    • Name
      ticketTypeId
      Type
      string
      Description

      The ID of the ticket type of the cart item.

    • Name
      ticketId
      Type
      string
      Description

      The ticket ID of the item

    Optional nested attributes (19)
    • Name
      type
      Type
      enum(ticket)
      Description

      The type of the cart item.

    • Name
      _id
      Type
      string
      Description

      Unique identifier for the cart item. If omitted, the system will automatically generate one.

    • Name
      name
      Type
      string
      Description

      The name of the cart item.

    • Name
      netPrice
      Type
      number float
      Description

      The single piece net price of the cart item.

    • Name
      taxRate
      Type
      number float
      Description

      The tax rate to be applied to this cart item. If not present the tax rate of the transaction is taken.

    • Name
      triggeredBy
      Type
      oneOf
      Description

      An ID or an array of IDs of other cart items which triggered the buy action of the cart item.

      One of Only one of the following types

      An ID of another cart item which triggered the buy action of the cart item.

    • Name
      bundleInfo
      Type
      object
      Description
      Optional nested attributes (3)
      • Name
        bundleId
        Type
        string
        Description
      • Name
        componentId
        Type
        string
        Description
      • Name
        optionId
        Type
        string
        Description
    • Name
      categoryRef
      Type
      string
      Description

      The category reference of the ticket type.

    • Name
      seatingInfo
      Type
      object
      Description

      The associated seating object.

      Required nested attributes (2)
      • Name
        _type
        Type
        enum(6, 7) float
        Description

        Indicates the type of seating object. Seat = 6, General Admission = 7.

      • Name
        statusId
        Type
        string
        Description

        The ID of a container holding information about the seating status of the seating object.

      Optional nested attributes (9)
      • Name
        _id
        Type
        string
        Description

        The ID of the seating object.

      • Name
        categoryId
        Type
        string
        Description

        The ID of the category containing the seating object.

      • Name
        name
        Type
        string
        Description

        If _type == 7. The name of the general admission.

      • Name
        seatType
        Type
        enum(handicapped, limitedView, foldable)
        Description

        If _type == 6. The type of the seat. null = normal.

      • Name
        sectionName
        Type
        string
        Description

        If _type == 6. The name of the section where the seat is located.

      • Name
        groupName
        Type
        string
        Description

        If _type == 6. The name of the row group where the seat is located.

      • Name
        rowName
        Type
        string
        Description

        If _type == 6. The name of the row where the seat is located.

      • Name
        seatName
        Type
        string
        Description

        If _type == 6. The seat name.

      • Name
        gate
        Type
        string
        Description

        The entry gate associated with the seating object.

    • Name
      slotInfo
      Type
      object
      Description

      The associated time slot object.

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

        The ID of the time slot.

      • Name
        slotStartTime
        Type
        string
        Description

        The start time of the time slot.

    • Name
      asHardTicket
      Type
      boolean
      Description

      Whether this ticket is a hard ticket.

    • Name
      listingId
      Type
      string
      Description

      Listing in secondary market.

    • Name
      listingItemId
      Type
      string
      Description

      The ID of the listing item in the secondary market.

    • Name
      triggeredAutomations
      Type
      boolean
      Description

      Whether the cart item triggered automations.

    • Name
      meta
      Type
      object
      Description

      Meta data which is propagated to the ticket.

    • Name
      addOns
      Type
      array<object>
      Description

      A list of Add-Ons of the ticket.

      Required nested attributes (3)
      • Name
        productId
        Type
        string
        Description
      • Name
        productVariantId
        Type
        string
        Description
      • Name
        name
        Type
        string
        Description
    • Name
      capabilities
      Type
      array<oneOf>
      Description

      The capabilities of the ticket.

      One of Only one of the following types

      Required attributes

      • Name
        type
        Type
        enum(self_service_return)
        Description
      • Name
        settings
        Type
        object
        Description
        Required nested attributes (1)
        • Name
          phases
          Type
          array<object>
          Description
          Required nested attributes (2)
          • Name
            condition
            Type
            object
            Description
            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
            refundPercentage
            Type
            number float
            Description
        Optional nested attributes (1)
        • Name
          returnRelatedItems
          Type
          boolean
          Description
    • Name
      taxInfo
      Type
      object
      Description

      The tax info details.

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

        The ID of the service type.

      • Name
        exceptionId
        Type
        string
        Description

        The ID of the exception.

      • Name
        proceedsAccountId
        Type
        string
        Description

        The ID of the proceeds account.

      • Name
        proceedsAccountCode
        Type
        string
        Description

        The code of the proceeds account.

      • Name
        taxItems
        Type
        array<object>
        Description

        The array of tax items.

        Required nested attributes (3)
        • Name
          rate
          Type
          number float
          Description
        • Name
          perUnit
          Type
          number float
          Description
        • Name
          total
          Type
          number float
          Description
        Optional nested attributes (6)
        • Name
          name
          Type
          string
          Description
        • Name
          taxTypeId
          Type
          string
          Description
        • Name
          netTotal
          Type
          number float
          Description
        • Name
          netPerUnit
          Type
          number float
          Description
        • Name
          taxPayableAccountId
          Type
          string
          Description
        • Name
          taxPayableAccountCode
          Type
          string
          Description
    • Name
      planVariantId
      Type
      string
      Description

      The plan variant ID of the item

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 date-time
        Description

        An ISO timestamp indicating when the billing start is

      • Name
        end
        Type
        string date-time
        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 date-time
        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 date-time
      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 date-time
      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 float
        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 date-time
        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 date-time
          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 date-time
        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 date-time
      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 date-time
      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 date-time
    Description

    An ISO timestamp indicating when the subscription starts

  • Name
    cancelAt
    Type
    string date-time
    Description

    An ISO timestamp indicating when the subscription cancels

  • Name
    canceledAt
    Type
    string date-time
    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 email
    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 date-time
    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": [
    {
      "amount": 1,
      "price": 10.5,
      "ticketTypeId": "507f191e810c19729de860ea",
      "ticketId": "507f191e810c19729de860ea",
      "type": "ticket",
      "_id": "507f191e810c19729de860ea",
      "name": "Some fancy Name",
      "netPrice": 10.5,
      "taxRate": 10.5,
      "triggeredBy": "string",
      "bundleInfo": {
        "bundleId": "507f191e810c19729de860ea",
        "componentId": "507f191e810c19729de860ea",
        "optionId": "507f191e810c19729de860ea"
      },
      "categoryRef": "string",
      "seatingInfo": {
        "_type": 6,
        "statusId": "507f191e810c19729de860ea",
        "_id": "507f191e810c19729de860ea",
        "categoryId": "507f191e810c19729de860ea",
        "name": "Some fancy Name",
        "seatType": "handicapped",
        "sectionName": "string",
        "groupName": "string",
        "rowName": "string",
        "seatName": "string",
        "gate": "string"
      },
      "slotInfo": {
        "slotId": "507f191e810c19729de860ea",
        "slotStartTime": "string"
      },
      "asHardTicket": true,
      "listingId": "507f191e810c19729de860ea",
      "listingItemId": "507f191e810c19729de860ea",
      "triggeredAutomations": true,
      "meta": {},
      "addOns": [
        {
          "productId": "507f191e810c19729de860ea",
          "productVariantId": "507f191e810c19729de860ea",
          "name": "Some fancy Name"
        }
      ],
      "capabilities": [
        {
          "type": "self_service_return",
          "settings": {
            "phases": [
              {
                "condition": {
                  "unit": "hours",
                  "offset": 1,
                  "target": "string"
                },
                "refundPercentage": 10.5
              }
            ],
            "returnRelatedItems": true
          }
        }
      ],
      "taxInfo": {
        "serviceTypeId": "507f191e810c19729de860ea",
        "exceptionId": "507f191e810c19729de860ea",
        "proceedsAccountId": "507f191e810c19729de860ea",
        "proceedsAccountCode": "string",
        "taxItems": [
          {
            "rate": 10.5,
            "perUnit": 10.5,
            "total": 10.5,
            "name": "Some fancy Name",
            "taxTypeId": "507f191e810c19729de860ea",
            "netTotal": 10.5,
            "netPerUnit": 10.5,
            "taxPayableAccountId": "507f191e810c19729de860ea",
            "taxPayableAccountCode": "string"
          }
        ]
      },
      "planVariantId": "507f191e810c19729de860ea"
    }
  ],
  "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": [
      {
        "status": "SCHEDULED",
        "total": 10.5,
        "billingCycleId": "507f191e810c19729de860ea",
        "due": "2030-01-23T23:00:00.123Z",
        "paymentId": "507f191e810c19729de860ea",
        "paymentRequestId": "507f191e810c19729de860ea",
        "attempts": [
          {
            "_id": "507f191e810c19729de860ea",
            "date": "2030-01-23T23:00:00.123Z",
            "status": "SCHEDULED",
            "paymentRequestId": "507f191e810c19729de860ea",
            "paymentMethodId": "507f191e810c19729de860ea"
          }
        ],
        "nextAttempt": "2030-01-23T23:00:00.123Z"
      }
    ]
  },
  "cycles": [
    {
      "cycleId": "507f191e810c19729de860ea",
      "appliedAt": "2030-01-23T23:00:00.123Z"
    }
  ],
  "history": [
    {
      "type": "subscription.created",
      "date": "2030-01-23T23:00:00.123Z",
      "userId": "507f191e810c19729de860ea",
      "data": {}
    }
  ],
  "transactionId": "507f191e810c19729de860ea",
  "startAt": "2030-01-23T23:00:00.123Z",
  "cancelAt": "2030-01-23T23:00:00.123Z",
  "canceledAt": "2030-01-23T23:00:00.123Z",
  "company": "vivenu GmbH",
  "firstname": "string",
  "lastname": "Robot",
  "name": "Some fancy Name",
  "email": "random@mail.com",
  "phone": "string",
  "address": {
    "fullAddress": "string",
    "street": "Speditionsstr",
    "line2": "string",
    "postal": "40221",
    "city": "Düsseldorf",
    "country": "DE",
    "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": [
    {
      "amount": 1,
      "price": 10.5,
      "ticketTypeId": "507f191e810c19729de860ea",
      "ticketId": "507f191e810c19729de860ea",
      "type": "ticket",
      "_id": "507f191e810c19729de860ea",
      "name": "Some fancy Name",
      "netPrice": 10.5,
      "taxRate": 10.5,
      "triggeredBy": "string",
      "bundleInfo": {
        "bundleId": "507f191e810c19729de860ea",
        "componentId": "507f191e810c19729de860ea",
        "optionId": "507f191e810c19729de860ea"
      },
      "categoryRef": "string",
      "seatingInfo": {
        "_type": 6,
        "statusId": "507f191e810c19729de860ea",
        "_id": "507f191e810c19729de860ea",
        "categoryId": "507f191e810c19729de860ea",
        "name": "Some fancy Name",
        "seatType": "handicapped",
        "sectionName": "string",
        "groupName": "string",
        "rowName": "string",
        "seatName": "string",
        "gate": "string"
      },
      "slotInfo": {
        "slotId": "507f191e810c19729de860ea",
        "slotStartTime": "string"
      },
      "asHardTicket": true,
      "listingId": "507f191e810c19729de860ea",
      "listingItemId": "507f191e810c19729de860ea",
      "triggeredAutomations": true,
      "meta": {},
      "addOns": [
        {
          "productId": "507f191e810c19729de860ea",
          "productVariantId": "507f191e810c19729de860ea",
          "name": "Some fancy Name"
        }
      ],
      "capabilities": [
        {
          "type": "self_service_return",
          "settings": {
            "phases": [
              {
                "condition": {
                  "unit": "hours",
                  "offset": 1,
                  "target": "string"
                },
                "refundPercentage": 10.5
              }
            ],
            "returnRelatedItems": true
          }
        }
      ],
      "taxInfo": {
        "serviceTypeId": "507f191e810c19729de860ea",
        "exceptionId": "507f191e810c19729de860ea",
        "proceedsAccountId": "507f191e810c19729de860ea",
        "proceedsAccountCode": "string",
        "taxItems": [
          {
            "rate": 10.5,
            "perUnit": 10.5,
            "total": 10.5,
            "name": "Some fancy Name",
            "taxTypeId": "507f191e810c19729de860ea",
            "netTotal": 10.5,
            "netPerUnit": 10.5,
            "taxPayableAccountId": "507f191e810c19729de860ea",
            "taxPayableAccountCode": "string"
          }
        ]
      },
      "planVariantId": "507f191e810c19729de860ea"
    }
  ],
  "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": [
      {
        "status": "SCHEDULED",
        "total": 10.5,
        "billingCycleId": "507f191e810c19729de860ea",
        "due": "2030-01-23T23:00:00.123Z",
        "paymentId": "507f191e810c19729de860ea",
        "paymentRequestId": "507f191e810c19729de860ea",
        "attempts": [
          {
            "_id": "507f191e810c19729de860ea",
            "date": "2030-01-23T23:00:00.123Z",
            "status": "SCHEDULED",
            "paymentRequestId": "507f191e810c19729de860ea",
            "paymentMethodId": "507f191e810c19729de860ea"
          }
        ],
        "nextAttempt": "2030-01-23T23:00:00.123Z"
      }
    ]
  },
  "cycles": [
    {
      "cycleId": "507f191e810c19729de860ea",
      "appliedAt": "2030-01-23T23:00:00.123Z"
    }
  ],
  "history": [
    {
      "type": "subscription.created",
      "date": "2030-01-23T23:00:00.123Z",
      "userId": "507f191e810c19729de860ea",
      "data": {}
    }
  ],
  "transactionId": "507f191e810c19729de860ea",
  "startAt": "2030-01-23T23:00:00.123Z",
  "cancelAt": "2030-01-23T23:00:00.123Z",
  "canceledAt": "2030-01-23T23:00:00.123Z",
  "company": "vivenu GmbH",
  "firstname": "string",
  "lastname": "Robot",
  "name": "Some fancy Name",
  "email": "random@mail.com",
  "phone": "string",
  "address": {
    "fullAddress": "string",
    "street": "Speditionsstr",
    "line2": "string",
    "postal": "40221",
    "city": "Düsseldorf",
    "country": "DE",
    "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 date-time
      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": "4b5fb736-45fd-4895-b497-124a2360c7e6",
    "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 float
    Description

    A limit on the number of objects to be returned. Can range between 1 and 1000.

  • Name
    skip
    Type
    number float
    Description

    The number of objects to skip for the requested result

  • 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
    Optional nested attributes (6)
    • Name
      $gt
      Type
      string date-time
      Description

      value is greater than

    • Name
      $gte
      Type
      string date-time
      Description

      value is greater than or equal

    • Name
      $lt
      Type
      string date-time
      Description

      value is less than

    • Name
      $lte
      Type
      string date-time
      Description

      value is less than or equal

    • Name
      $eq
      Type
      string date-time
      Description

      value is equal

    • Name
      $ne
      Type
      string date-time
      Description

      value is not equal

  • 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=value&status=value1%2Cvalue2', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

{
  "docs": [
    {
      "_id": "507f191e810c19729de860ea",
      "sellerId": "507f191e810c19729de860ea",
      "status": "DRAFT",
      "customerId": "507f191e810c19729de860ea",
      "planId": "507f191e810c19729de860ea",
      "currency": "EUR",
      "items": [
        {
          "amount": 1,
          "price": 10.5,
          "ticketTypeId": "507f191e810c19729de860ea",
          "ticketId": "507f191e810c19729de860ea",
          "type": "ticket",
          "_id": "507f191e810c19729de860ea",
          "name": "Some fancy Name",
          "netPrice": 10.5,
          "taxRate": 10.5,
          "triggeredBy": "string",
          "bundleInfo": {
            "bundleId": "507f191e810c19729de860ea",
            "componentId": "507f191e810c19729de860ea",
            "optionId": "507f191e810c19729de860ea"
          },
          "categoryRef": "string",
          "seatingInfo": {
            "_type": 6,
            "statusId": "507f191e810c19729de860ea",
            "_id": "507f191e810c19729de860ea",
            "categoryId": "507f191e810c19729de860ea",
            "name": "Some fancy Name",
            "seatType": "handicapped",
            "sectionName": "string",
            "groupName": "string",
            "rowName": "string",
            "seatName": "string",
            "gate": "string"
          },
          "slotInfo": {
            "slotId": "507f191e810c19729de860ea",
            "slotStartTime": "string"
          },
          "asHardTicket": true,
          "listingId": "507f191e810c19729de860ea",
          "listingItemId": "507f191e810c19729de860ea",
          "triggeredAutomations": true,
          "meta": {},
          "addOns": [
            {
              "productId": "507f191e810c19729de860ea",
              "productVariantId": "507f191e810c19729de860ea",
              "name": "Some fancy Name"
            }
          ],
          "capabilities": [
            {
              "type": "self_service_return",
              "settings": {
                "phases": [
                  {
                    "condition": {
                      "unit": "hours",
                      "offset": 1,
                      "target": "string"
                    },
                    "refundPercentage": 10.5
                  }
                ],
                "returnRelatedItems": true
              }
            }
          ],
          "taxInfo": {
            "serviceTypeId": "507f191e810c19729de860ea",
            "exceptionId": "507f191e810c19729de860ea",
            "proceedsAccountId": "507f191e810c19729de860ea",
            "proceedsAccountCode": "string",
            "taxItems": [
              {
                "rate": 10.5,
                "perUnit": 10.5,
                "total": 10.5,
                "name": "Some fancy Name",
                "taxTypeId": "507f191e810c19729de860ea",
                "netTotal": 10.5,
                "netPerUnit": 10.5,
                "taxPayableAccountId": "507f191e810c19729de860ea",
                "taxPayableAccountCode": "string"
              }
            ]
          },
          "planVariantId": "507f191e810c19729de860ea"
        }
      ],
      "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": [
          {
            "status": "SCHEDULED",
            "total": 10.5,
            "billingCycleId": "507f191e810c19729de860ea",
            "due": "2030-01-23T23:00:00.123Z",
            "paymentId": "507f191e810c19729de860ea",
            "paymentRequestId": "507f191e810c19729de860ea",
            "attempts": [
              {
                "_id": "507f191e810c19729de860ea",
                "date": "2030-01-23T23:00:00.123Z",
                "status": "SCHEDULED",
                "paymentRequestId": "507f191e810c19729de860ea",
                "paymentMethodId": "507f191e810c19729de860ea"
              }
            ],
            "nextAttempt": "2030-01-23T23:00:00.123Z"
          }
        ]
      },
      "cycles": [
        {
          "cycleId": "507f191e810c19729de860ea",
          "appliedAt": "2030-01-23T23:00:00.123Z"
        }
      ],
      "history": [
        {
          "type": "subscription.created",
          "date": "2030-01-23T23:00:00.123Z",
          "userId": "507f191e810c19729de860ea",
          "data": {}
        }
      ],
      "transactionId": "507f191e810c19729de860ea",
      "startAt": "2030-01-23T23:00:00.123Z",
      "cancelAt": "2030-01-23T23:00:00.123Z",
      "canceledAt": "2030-01-23T23:00:00.123Z",
      "company": "vivenu GmbH",
      "firstname": "string",
      "lastname": "Robot",
      "name": "Some fancy Name",
      "email": "random@mail.com",
      "phone": "string",
      "address": {
        "fullAddress": "string",
        "street": "Speditionsstr",
        "line2": "string",
        "postal": "40221",
        "city": "Düsseldorf",
        "country": "DE",
        "state": "string"
      },
      "secret": "2030-01-23T23:00:00.123Z",
      "attributes": {}
    }
  ],
  "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
    SubscriptionItemResource
    Description
    Required nested attributes (4)
    • Name
      amount
      Type
      integer
      Description

      The amount of the cart item.

    • Name
      price
      Type
      number float
      Description

      The single piece price of the cart item.

    • Name
      ticketTypeId
      Type
      string
      Description

      The ID of the ticket type of the cart item.

    • Name
      ticketId
      Type
      string
      Description

      The ticket ID of the item

    Optional nested attributes (19)
    • Name
      type
      Type
      enum(ticket)
      Description

      The type of the cart item.

    • Name
      _id
      Type
      string
      Description

      Unique identifier for the cart item. If omitted, the system will automatically generate one.

    • Name
      name
      Type
      string
      Description

      The name of the cart item.

    • Name
      netPrice
      Type
      number float
      Description

      The single piece net price of the cart item.

    • Name
      taxRate
      Type
      number float
      Description

      The tax rate to be applied to this cart item. If not present the tax rate of the transaction is taken.

    • Name
      triggeredBy
      Type
      oneOf
      Description

      An ID or an array of IDs of other cart items which triggered the buy action of the cart item.

      One of Only one of the following types

      An ID of another cart item which triggered the buy action of the cart item.

    • Name
      bundleInfo
      Type
      object
      Description
      Optional nested attributes (3)
      • Name
        bundleId
        Type
        string
        Description
      • Name
        componentId
        Type
        string
        Description
      • Name
        optionId
        Type
        string
        Description
    • Name
      categoryRef
      Type
      string
      Description

      The category reference of the ticket type.

    • Name
      seatingInfo
      Type
      object
      Description

      The associated seating object.

      Required nested attributes (2)
      • Name
        _type
        Type
        enum(6, 7) float
        Description

        Indicates the type of seating object. Seat = 6, General Admission = 7.

      • Name
        statusId
        Type
        string
        Description

        The ID of a container holding information about the seating status of the seating object.

      Optional nested attributes (9)
      • Name
        _id
        Type
        string
        Description

        The ID of the seating object.

      • Name
        categoryId
        Type
        string
        Description

        The ID of the category containing the seating object.

      • Name
        name
        Type
        string
        Description

        If _type == 7. The name of the general admission.

      • Name
        seatType
        Type
        enum(handicapped, limitedView, foldable)
        Description

        If _type == 6. The type of the seat. null = normal.

      • Name
        sectionName
        Type
        string
        Description

        If _type == 6. The name of the section where the seat is located.

      • Name
        groupName
        Type
        string
        Description

        If _type == 6. The name of the row group where the seat is located.

      • Name
        rowName
        Type
        string
        Description

        If _type == 6. The name of the row where the seat is located.

      • Name
        seatName
        Type
        string
        Description

        If _type == 6. The seat name.

      • Name
        gate
        Type
        string
        Description

        The entry gate associated with the seating object.

    • Name
      slotInfo
      Type
      object
      Description

      The associated time slot object.

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

        The ID of the time slot.

      • Name
        slotStartTime
        Type
        string
        Description

        The start time of the time slot.

    • Name
      asHardTicket
      Type
      boolean
      Description

      Whether this ticket is a hard ticket.

    • Name
      listingId
      Type
      string
      Description

      Listing in secondary market.

    • Name
      listingItemId
      Type
      string
      Description

      The ID of the listing item in the secondary market.

    • Name
      triggeredAutomations
      Type
      boolean
      Description

      Whether the cart item triggered automations.

    • Name
      meta
      Type
      object
      Description

      Meta data which is propagated to the ticket.

    • Name
      addOns
      Type
      array<object>
      Description

      A list of Add-Ons of the ticket.

      Required nested attributes (3)
      • Name
        productId
        Type
        string
        Description
      • Name
        productVariantId
        Type
        string
        Description
      • Name
        name
        Type
        string
        Description
    • Name
      capabilities
      Type
      array<oneOf>
      Description

      The capabilities of the ticket.

      One of Only one of the following types

      Required attributes

      • Name
        type
        Type
        enum(self_service_return)
        Description
      • Name
        settings
        Type
        object
        Description
        Required nested attributes (1)
        • Name
          phases
          Type
          array<object>
          Description
          Required nested attributes (2)
          • Name
            condition
            Type
            object
            Description
            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
            refundPercentage
            Type
            number float
            Description
        Optional nested attributes (1)
        • Name
          returnRelatedItems
          Type
          boolean
          Description
    • Name
      taxInfo
      Type
      object
      Description

      The tax info details.

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

        The ID of the service type.

      • Name
        exceptionId
        Type
        string
        Description

        The ID of the exception.

      • Name
        proceedsAccountId
        Type
        string
        Description

        The ID of the proceeds account.

      • Name
        proceedsAccountCode
        Type
        string
        Description

        The code of the proceeds account.

      • Name
        taxItems
        Type
        array<object>
        Description

        The array of tax items.

        Required nested attributes (3)
        • Name
          rate
          Type
          number float
          Description
        • Name
          perUnit
          Type
          number float
          Description
        • Name
          total
          Type
          number float
          Description
        Optional nested attributes (6)
        • Name
          name
          Type
          string
          Description
        • Name
          taxTypeId
          Type
          string
          Description
        • Name
          netTotal
          Type
          number float
          Description
        • Name
          netPerUnit
          Type
          number float
          Description
        • Name
          taxPayableAccountId
          Type
          string
          Description
        • Name
          taxPayableAccountCode
          Type
          string
          Description
    • Name
      planVariantId
      Type
      string
      Description

      The plan variant ID of the item

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": "4b5fb736-45fd-4895-b497-124a2360c7e6",
    "seatingReservationToken": "string",
    "item": {
      "amount": 1,
      "price": 10.5,
      "ticketTypeId": "507f191e810c19729de860ea",
      "ticketId": "507f191e810c19729de860ea",
      "type": "ticket",
      "_id": "507f191e810c19729de860ea",
      "name": "Some fancy Name",
      "netPrice": 10.5,
      "taxRate": 10.5,
      "triggeredBy": "string",
      "bundleInfo": {
        "bundleId": "507f191e810c19729de860ea",
        "componentId": "507f191e810c19729de860ea",
        "optionId": "507f191e810c19729de860ea"
      },
      "categoryRef": "string",
      "seatingInfo": {
        "_type": 6,
        "statusId": "507f191e810c19729de860ea",
        "_id": "507f191e810c19729de860ea",
        "categoryId": "507f191e810c19729de860ea",
        "name": "Some fancy Name",
        "seatType": "handicapped",
        "sectionName": "string",
        "groupName": "string",
        "rowName": "string",
        "seatName": "string",
        "gate": "string"
      },
      "slotInfo": {
        "slotId": "507f191e810c19729de860ea",
        "slotStartTime": "string"
      },
      "asHardTicket": true,
      "listingId": "507f191e810c19729de860ea",
      "listingItemId": "507f191e810c19729de860ea",
      "triggeredAutomations": true,
      "meta": {},
      "addOns": [
        {
          "productId": "507f191e810c19729de860ea",
          "productVariantId": "507f191e810c19729de860ea",
          "name": "Some fancy Name"
        }
      ],
      "capabilities": [
        {
          "type": "self_service_return",
          "settings": {
            "phases": [
              {
                "condition": {
                  "unit": "hours",
                  "offset": 1,
                  "target": "string"
                },
                "refundPercentage": 10.5
              }
            ],
            "returnRelatedItems": true
          }
        }
      ],
      "taxInfo": {
        "serviceTypeId": "507f191e810c19729de860ea",
        "exceptionId": "507f191e810c19729de860ea",
        "proceedsAccountId": "507f191e810c19729de860ea",
        "proceedsAccountCode": "string",
        "taxItems": [
          {
            "rate": 10.5,
            "perUnit": 10.5,
            "total": 10.5,
            "name": "Some fancy Name",
            "taxTypeId": "507f191e810c19729de860ea",
            "netTotal": 10.5,
            "netPerUnit": 10.5,
            "taxPayableAccountId": "507f191e810c19729de860ea",
            "taxPayableAccountCode": "string"
          }
        ]
      },
      "planVariantId": "507f191e810c19729de860ea"
    }
  }),
})

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 float
      Description

      The recurrence of the billing cycle

    • Name
      minimumIntervals
      Type
      number float
      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 float
      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 date-time
      Description

      An ISO timestamp indicating when the changes period starts

    • Name
      changesPeriodEnd
      Type
      string date-time
      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 date-time
      Description

      An ISO timestamp indicating when the confirmation period starts

    • Name
      confirmationPeriodEnd
      Type
      string date-time
      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": "Some fancy Name",
  "sellerId": "507f191e810c19729de860ea",
  "pricingPolicy": "fixed",
  "variants": [
    {
      "_id": "507f191e810c19729de860ea",
      "name": "Some fancy Name",
      "canChangeVariant": true,
      "allowedVariants": [
        "string"
      ]
    }
  ],
  "billingCycle": {
    "scheme": "one-off",
    "interval": "DAY",
    "every": 10.5,
    "minimumIntervals": 10.5,
    "renewalOptions": {
      "periodStart": {
        "unit": "hours",
        "offset": 1,
        "target": "string"
      }
    }
  },
  "paymentSchedules": [
    {}
  ],
  "renewalPolicy": {
    "changesPeriodStart": "2030-01-23T23:00:00.123Z",
    "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
    "allowedChanges": {
      "ticketType": true,
      "seat": true
    },
    "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
    "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
  },
  "paymentPolicy": {
    "interaction": "customerPaymentMethod",
    "allowedPaymentGateways": [
      "string"
    ],
    "changePaymentMethodPolicy": "always",
    "allowedChangePaymentMethodGateways": [
      "string"
    ]
  },
  "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 float
      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 float
      Description

      The recurrence of the billing cycle

    • Name
      minimumIntervals
      Type
      number float
      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 date-time
      Description

      An ISO timestamp indicating when the changes period starts

    • Name
      changesPeriodEnd
      Type
      string date-time
      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 date-time
      Description

      An ISO timestamp indicating when the confirmation period starts

    • Name
      confirmationPeriodEnd
      Type
      string date-time
      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": "Some fancy Name",
    "pricingPolicy": "fixed",
    "variants": [
      {
        "_id": "507f191e810c19729de860ea",
        "name": "Some fancy Name",
        "canChangeVariant": true,
        "allowedVariants": [
          "string"
        ]
      }
    ],
    "paymentSchedules": [
      {}
    ],
    "billingCycle": {
      "scheme": "one-off",
      "interval": "DAY",
      "every": 10.5,
      "minimumIntervals": 10.5,
      "renewalOptions": {
        "periodStart": {
          "unit": "hours",
          "offset": 1,
          "target": "string"
        }
      }
    },
    "renewalPolicy": {
      "changesPeriodStart": "2030-01-23T23:00:00.123Z",
      "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
      "allowedChanges": {
        "ticketType": true,
        "seat": true
      },
      "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
      "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
    },
    "paymentPolicy": {
      "interaction": "customerPaymentMethod",
      "allowedPaymentGateways": [
        "string"
      ],
      "changePaymentMethodPolicy": "always",
      "allowedChangePaymentMethodGateways": [
        "string"
      ]
    },
    "requestedConsents": [
      {
        "type": "autorenewal",
        "description": "string",
        "default": true
      }
    ]
  }),
})

const data = await response.json()

Response (201)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Some fancy Name",
  "sellerId": "507f191e810c19729de860ea",
  "pricingPolicy": "fixed",
  "variants": [
    {
      "_id": "507f191e810c19729de860ea",
      "name": "Some fancy Name",
      "canChangeVariant": true,
      "allowedVariants": [
        "string"
      ]
    }
  ],
  "billingCycle": {
    "scheme": "one-off",
    "interval": "DAY",
    "every": 10.5,
    "minimumIntervals": 10.5,
    "renewalOptions": {
      "periodStart": {
        "unit": "hours",
        "offset": 1,
        "target": "string"
      }
    }
  },
  "paymentSchedules": [
    {}
  ],
  "renewalPolicy": {
    "changesPeriodStart": "2030-01-23T23:00:00.123Z",
    "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
    "allowedChanges": {
      "ticketType": true,
      "seat": true
    },
    "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
    "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
  },
  "paymentPolicy": {
    "interaction": "customerPaymentMethod",
    "allowedPaymentGateways": [
      "string"
    ],
    "changePaymentMethodPolicy": "always",
    "allowedChangePaymentMethodGateways": [
      "string"
    ]
  },
  "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": "Some fancy Name",
  "sellerId": "507f191e810c19729de860ea",
  "pricingPolicy": "fixed",
  "variants": [
    {
      "_id": "507f191e810c19729de860ea",
      "name": "Some fancy Name",
      "canChangeVariant": true,
      "allowedVariants": [
        "string"
      ]
    }
  ],
  "billingCycle": {
    "scheme": "one-off",
    "interval": "DAY",
    "every": 10.5,
    "minimumIntervals": 10.5,
    "renewalOptions": {
      "periodStart": {
        "unit": "hours",
        "offset": 1,
        "target": "string"
      }
    }
  },
  "paymentSchedules": [
    {}
  ],
  "renewalPolicy": {
    "changesPeriodStart": "2030-01-23T23:00:00.123Z",
    "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
    "allowedChanges": {
      "ticketType": true,
      "seat": true
    },
    "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
    "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
  },
  "paymentPolicy": {
    "interaction": "customerPaymentMethod",
    "allowedPaymentGateways": [
      "string"
    ],
    "changePaymentMethodPolicy": "always",
    "allowedChangePaymentMethodGateways": [
      "string"
    ]
  },
  "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 float
      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 float
      Description

      The recurrence of the billing cycle

    • Name
      minimumIntervals
      Type
      number float
      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 date-time
      Description

      An ISO timestamp indicating when the changes period starts

    • Name
      changesPeriodEnd
      Type
      string date-time
      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 date-time
      Description

      An ISO timestamp indicating when the confirmation period starts

    • Name
      confirmationPeriodEnd
      Type
      string date-time
      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": "Some fancy Name",
    "pricingPolicy": "fixed",
    "variants": [
      {
        "_id": "507f191e810c19729de860ea",
        "name": "Some fancy Name",
        "canChangeVariant": true,
        "allowedVariants": [
          "string"
        ]
      }
    ],
    "paymentSchedules": [
      {}
    ],
    "billingCycle": {
      "scheme": "one-off",
      "interval": "DAY",
      "every": 10.5,
      "minimumIntervals": 10.5,
      "renewalOptions": {
        "periodStart": {
          "unit": "hours",
          "offset": 1,
          "target": "string"
        }
      }
    },
    "renewalPolicy": {
      "changesPeriodStart": "2030-01-23T23:00:00.123Z",
      "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
      "allowedChanges": {
        "ticketType": true,
        "seat": true
      },
      "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
      "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
    },
    "paymentPolicy": {
      "interaction": "customerPaymentMethod",
      "allowedPaymentGateways": [
        "string"
      ],
      "changePaymentMethodPolicy": "always",
      "allowedChangePaymentMethodGateways": [
        "string"
      ]
    },
    "requestedConsents": [
      {
        "type": "autorenewal",
        "description": "string",
        "default": true
      }
    ]
  }),
})

const data = await response.json()

Response (200)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Some fancy Name",
  "sellerId": "507f191e810c19729de860ea",
  "pricingPolicy": "fixed",
  "variants": [
    {
      "_id": "507f191e810c19729de860ea",
      "name": "Some fancy Name",
      "canChangeVariant": true,
      "allowedVariants": [
        "string"
      ]
    }
  ],
  "billingCycle": {
    "scheme": "one-off",
    "interval": "DAY",
    "every": 10.5,
    "minimumIntervals": 10.5,
    "renewalOptions": {
      "periodStart": {
        "unit": "hours",
        "offset": 1,
        "target": "string"
      }
    }
  },
  "paymentSchedules": [
    {}
  ],
  "renewalPolicy": {
    "changesPeriodStart": "2030-01-23T23:00:00.123Z",
    "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
    "allowedChanges": {
      "ticketType": true,
      "seat": true
    },
    "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
    "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
  },
  "paymentPolicy": {
    "interaction": "customerPaymentMethod",
    "allowedPaymentGateways": [
      "string"
    ],
    "changePaymentMethodPolicy": "always",
    "allowedChangePaymentMethodGateways": [
      "string"
    ]
  },
  "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 float
    Description

    A limit on the number of objects to be returned. Can range between 1 and 1000.

  • Name
    skip
    Type
    number float
    Description

    The number of objects to skip for the requested result

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": [
    {
      "_id": "507f191e810c19729de860ea",
      "name": "Some fancy Name",
      "sellerId": "507f191e810c19729de860ea",
      "pricingPolicy": "fixed",
      "variants": [
        {
          "_id": "507f191e810c19729de860ea",
          "name": "Some fancy Name",
          "canChangeVariant": true,
          "allowedVariants": [
            "string"
          ]
        }
      ],
      "billingCycle": {
        "scheme": "one-off",
        "interval": "DAY",
        "every": 10.5,
        "minimumIntervals": 10.5,
        "renewalOptions": {
          "periodStart": {
            "unit": "hours",
            "offset": 1,
            "target": "string"
          }
        }
      },
      "paymentSchedules": [
        {}
      ],
      "renewalPolicy": {
        "changesPeriodStart": "2030-01-23T23:00:00.123Z",
        "changesPeriodEnd": "2030-01-23T23:00:00.123Z",
        "allowedChanges": {
          "ticketType": true,
          "seat": true
        },
        "confirmationPeriodStart": "2030-01-23T23:00:00.123Z",
        "confirmationPeriodEnd": "2030-01-23T23:00:00.123Z"
      },
      "paymentPolicy": {
        "interaction": "customerPaymentMethod",
        "allowedPaymentGateways": [
          "string"
        ],
        "changePaymentMethodPolicy": "always",
        "allowedChangePaymentMethodGateways": [
          "string"
        ]
      },
      "requestedConsents": [
        {
          "type": "autorenewal",
          "description": "string",
          "default": true
        }
      ]
    }
  ],
  "total": 1
}

Was this page helpful?