Coupons

By issuing coupons you can allow ticket buyers to receive a discount on their transaction by applying a randomly generated or custom-defined code to their cart.

The Coupon Object

No attributes defined.


POST/api/coupon

Create a Coupon

Create a Coupon

Request

POST
/api/coupon
const response = await fetch('https://vivenu.com/api/coupon', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "couponType": "couponSeries",
    "couponSeriesId": "507f191e810c19729de860ea",
    "code": "string",
    "customer": "string"
  }),
})

const data = await response.json()

GET/api/coupon/:id

Get a Coupon

Get a Coupon

Request

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

const data = await response.json()

PUT/api/coupon/:id

Update a Coupon

Update a Coupon

Request

PUT
/api/coupon/:id
const response = await fetch('https://vivenu.com/api/coupon/507f191e810c19729de860ea', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "couponType": "couponSeries",
    "couponSeriesId": "507f191e810c19729de860ea",
    "code": "string",
    "customer": "string"
  }),
})

const data = await response.json()

GET/api/coupon/rich

Get all Coupons

Get all Coupons

Query parameters

Optional query parameters

  • Name
    top
    Type
    integer
    Description
  • Name
    skip
    Type
    integer
    Description
  • Name
    name
    Type
    string
    Description
  • Name
    code
    Type
    string
    Description
  • Name
    eventId
    Type
    string
    Description
  • Name
    couponSeriesId
    Type
    string
    Description
  • Name
    active
    Type
    boolean
    Description

Request

GET
/api/coupon/rich
const response = await fetch('https://vivenu.com/api/coupon/rich?top=1&skip=1&name=Example+Name&code=value&eventId=507f191e810c19729de860ea&couponSeriesId=507f191e810c19729de860ea&active=true', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

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

GETPUBLIC/api/coupon/:code/info

Get Coupon or Voucher by code

Get Coupon or Voucher by code

This endpoint provides information on both coupons and vouchers. To receive a coupon, you need to pass an eventId, even if the coupon can be used across all events. If there is a coupon and a voucher with the same code, and you pass an eventId, the coupon will be preferred. Without passing an eventId, only vouchers will be considered.

Query parameters

Required query parameters

  • Name
    sellerId
    Type
    string
    Description

Optional query parameters

  • Name
    eventId
    Type
    string
    Description

Request

GET
/api/coupon/:code/info
const response = await fetch('https://vivenu.com/api/coupon/code/info?sellerId=507f191e810c19729de860ea&eventId=507f191e810c19729de860ea', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

{
  "message": "notYetValid",
  "coupon": {
    "code": "string",
    "couponId": "507f191e810c19729de860ea",
    "name": "Example Name",
    "canBeCombined": true,
    "discountType": "fix",
    "discountValue": 10.5,
    "discountMaxValue": 10.5,
    "allowAllTickets": true,
    "allowedTickets": [
      "string"
    ],
    "allowAllEvents": true,
    "limitMaxTicketsInCart": true,
    "maxTicketsInCart": 10.5,
    "minTicketsInCart": 10.5,
    "maxTickets": 10.5,
    "revealAllowedTickets": true
  },
  "voucher": {
    "_id": "507f191e810c19729de860ea",
    "code": "string",
    "balance": 10.5
  },
  "type": "voucher"
}

The Coupon Series Object

Required attributes

  • Name
    name
    Type
    string
    Description

    The Name for the coupon. Visible to public.

  • Name
    _id
    Type
    string
    Description

    The ID of the coupon series.

  • Name
    sellerId
    Type
    string
    Description

    The ID of the seller.

Optional attributes

  • Name
    singleUsage
    Type
    boolean
    Description

    Whether this coupon can only be used once

  • Name
    active
    Type
    boolean
    Description

    Whether the coupon can be used

  • Name
    maxUsage
    Type
    number
    Description

    The max amount of usages. A usage is counted as a completed transaction that used the coupon.

  • Name
    maxUsagePerEvent
    Type
    number
    Description

    The max amount of usages per event. A usage is counted as a completed transaction that used the coupon.

  • Name
    maxTickets
    Type
    number
    Description

    The number of tickets that can be purchased with this coupon

  • Name
    canBeCombined
    Type
    boolean
    Description

    Whether this coupon can be combined with others within one transaction.

  • Name
    discountType
    Type
    enum(fix, var, fixPerItem, waiveFees)
    Description
  • Name
    discountValue
    Type
    number
    Description

    The amount of the discount in seller's currency. eg. 50.0 -> 50 EUR

  • Name
    discountMaxValue
    Type
    number
    Description

    When discountType is VAR the max amount of the discount in seller's currency

  • Name
    allowAllEvents
    Type
    boolean
    Description

    Whether the coupon can be used across all events

  • Name
    allowedEvents
    Type
    array<string>
    Description

    The ID's of events where the coupon can be used

  • Name
    allowAllTickets
    Type
    boolean
    Description

    Whether the coupon can be used across all tickets within the events

  • Name
    allowedTickets
    Type
    array<string>
    Description

    The ID's of the ticket types on which the coupon should be applied

  • Name
    taggingEnabled
    Type
    boolean
    Description

    Whether this coupon tags customers

  • Name
    tags
    Type
    array<string>
    Description

    Which tags to add to customers which bought with this coupon

  • Name
    validFrom
    Type
    string
    Description

    The date from which this coupon can be redeemed.

  • Name
    validUntil
    Type
    string
    Description

    The date until this coupon can be redeemed.

  • Name
    limitMaxTicketsInCart
    Type
    boolean
    Description

    Whether this coupon limits the max tickets in cart.

  • Name
    maxTicketsInCart
    Type
    number
    Description

    If limitMaxTicketsInCart is true, the amount of the max allowed tickets.

  • Name
    minTicketsInCart
    Type
    number
    Description

    The minimum number of tickets that need to be purchased with this coupon

  • Name
    note
    Type
    string
    Description

    The Note for this coupon.

  • Name
    revealAllowedTickets
    Type
    boolean
    Description

    Whether this coupon reveals the allowed tickets.

  • Name
    unlocks
    Type
    array<oneOf>
    Description

    The array of the resources unlocked by undershop.

  • Name
    createdAt
    Type
    string
    Description

    The date the coupon was created.

  • Name
    updatedAt
    Type
    string
    Description

    The date the coupon was last updated.

Example

{
  "name": "Example Name",
  "_id": "507f191e810c19729de860ea",
  "sellerId": "507f191e810c19729de860ea",
  "singleUsage": true,
  "active": true,
  "maxUsage": 1,
  "maxUsagePerEvent": 10.5,
  "maxTickets": 10.5,
  "canBeCombined": true,
  "discountType": "fix",
  "discountValue": 10.5,
  "discountMaxValue": 10.5,
  "allowAllEvents": true,
  "allowedEvents": [
    "string"
  ],
  "allowAllTickets": true,
  "allowedTickets": [
    "string"
  ],
  "taggingEnabled": true,
  "tags": [
    "string"
  ],
  "validFrom": "2030-01-23T23:00:00.123Z",
  "validUntil": "2030-01-23T23:00:00.123Z",
  "limitMaxTicketsInCart": true,
  "maxTicketsInCart": 10.5,
  "minTicketsInCart": 10.5,
  "note": "string",
  "revealAllowedTickets": true,
  "unlocks": [
    {
      "target": "underShop",
      "eventId": "507f191e810c19729de860ea",
      "underShopId": "507f191e810c19729de860ea"
    }
  ],
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z"
}

POST/api/coupon/series

Create coupon series

Create coupon series

Payload

Required attributes

  • Name
    name
    Type
    string
    Description

    The Name for the coupon. Visible to public.

Optional attributes

  • Name
    singleUsage
    Type
    boolean
    Description

    Whether this coupon can only be used once

  • Name
    active
    Type
    boolean
    Description

    Whether the coupon can be used

  • Name
    maxUsage
    Type
    number
    Description

    The max amount of usages. A usage is counted as a completed transaction that used the coupon.

  • Name
    maxUsagePerEvent
    Type
    number
    Description

    The max amount of usages per event. A usage is counted as a completed transaction that used the coupon.

  • Name
    maxTickets
    Type
    number
    Description

    The number of tickets that can be purchased with this coupon

  • Name
    canBeCombined
    Type
    boolean
    Description

    Whether this coupon can be combined with others within one transaction.

  • Name
    discountType
    Type
    enum(fix, var, fixPerItem, waiveFees)
    Description
  • Name
    discountValue
    Type
    number
    Description

    The amount of the discount in seller's currency. eg. 50.0 -> 50 EUR

  • Name
    discountMaxValue
    Type
    number
    Description

    When discountType is VAR the max amount of the discount in seller's currency

  • Name
    allowAllEvents
    Type
    boolean
    Description

    Whether the coupon can be used across all events

  • Name
    allowedEvents
    Type
    array<string>
    Description

    The ID's of events where the coupon can be used

  • Name
    allowAllTickets
    Type
    boolean
    Description

    Whether the coupon can be used across all tickets within the events

  • Name
    allowedTickets
    Type
    array<string>
    Description

    The ID's of the ticket types on which the coupon should be applied

  • Name
    taggingEnabled
    Type
    boolean
    Description

    Whether this coupon tags customers

  • Name
    tags
    Type
    array<string>
    Description

    Which tags to add to customers which bought with this coupon

  • Name
    validFrom
    Type
    string
    Description

    The date from which this coupon can be redeemed.

  • Name
    validUntil
    Type
    string
    Description

    The date until this coupon can be redeemed.

  • Name
    limitMaxTicketsInCart
    Type
    boolean
    Description

    Whether this coupon limits the max tickets in cart.

  • Name
    maxTicketsInCart
    Type
    number
    Description

    If limitMaxTicketsInCart is true, the amount of the max allowed tickets.

  • Name
    minTicketsInCart
    Type
    number
    Description

    The minimum number of tickets that need to be purchased with this coupon

  • Name
    note
    Type
    string
    Description

    The Note for this coupon.

  • Name
    revealAllowedTickets
    Type
    boolean
    Description

    Whether this coupon reveals the allowed tickets.

  • Name
    unlocks
    Type
    array<oneOf>
    Description

    The array of the resources unlocked by undershop.

Request

POST
/api/coupon/series
const response = await fetch('https://vivenu.com/api/coupon/series', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "name": "Example Name",
    "singleUsage": true,
    "active": true,
    "maxUsage": 1,
    "maxUsagePerEvent": 10.5,
    "maxTickets": 10.5,
    "canBeCombined": true,
    "discountType": "fix",
    "discountValue": 10.5,
    "discountMaxValue": 10.5,
    "allowAllEvents": true,
    "allowedEvents": [
      "string"
    ],
    "allowAllTickets": true,
    "allowedTickets": [
      "string"
    ],
    "taggingEnabled": true,
    "tags": [
      "string"
    ],
    "validFrom": "2030-01-23T23:00:00.123Z",
    "validUntil": "2030-01-23T23:00:00.123Z",
    "limitMaxTicketsInCart": true,
    "maxTicketsInCart": 10.5,
    "minTicketsInCart": 10.5,
    "note": "string",
    "revealAllowedTickets": true,
    "unlocks": [
      {
        "target": "underShop",
        "eventId": "507f191e810c19729de860ea",
        "underShopId": "507f191e810c19729de860ea"
      }
    ]
  }),
})

const data = await response.json()

Response (200)

{
  "name": "Example Name",
  "_id": "507f191e810c19729de860ea",
  "sellerId": "507f191e810c19729de860ea",
  "singleUsage": true,
  "active": true,
  "maxUsage": 1,
  "maxUsagePerEvent": 10.5,
  "maxTickets": 10.5,
  "canBeCombined": true,
  "discountType": "fix",
  "discountValue": 10.5,
  "discountMaxValue": 10.5,
  "allowAllEvents": true,
  "allowedEvents": [
    "string"
  ],
  "allowAllTickets": true,
  "allowedTickets": [
    "string"
  ],
  "taggingEnabled": true,
  "tags": [
    "string"
  ],
  "validFrom": "2030-01-23T23:00:00.123Z",
  "validUntil": "2030-01-23T23:00:00.123Z",
  "limitMaxTicketsInCart": true,
  "maxTicketsInCart": 10.5,
  "minTicketsInCart": 10.5,
  "note": "string",
  "revealAllowedTickets": true,
  "unlocks": [
    {
      "target": "underShop",
      "eventId": "507f191e810c19729de860ea",
      "underShopId": "507f191e810c19729de860ea"
    }
  ],
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z"
}

GET/api/coupon/series

Get all coupon series

Get all coupon series

Query parameters

Optional query parameters

  • Name
    top
    Type
    integer
    Description
  • Name
    skip
    Type
    integer
    Description
  • Name
    name
    Type
    string
    Description

Request

GET
/api/coupon/series
const response = await fetch('https://vivenu.com/api/coupon/series?top=1&skip=1&name=Example+Name', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

[]

GET/api/coupon/series/:id

Get a coupon series

Get a coupon series

Request

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

const data = await response.json()

Response (200)

{
  "name": "Example Name",
  "_id": "507f191e810c19729de860ea",
  "sellerId": "507f191e810c19729de860ea",
  "singleUsage": true,
  "active": true,
  "maxUsage": 1,
  "maxUsagePerEvent": 10.5,
  "maxTickets": 10.5,
  "canBeCombined": true,
  "discountType": "fix",
  "discountValue": 10.5,
  "discountMaxValue": 10.5,
  "allowAllEvents": true,
  "allowedEvents": [
    "string"
  ],
  "allowAllTickets": true,
  "allowedTickets": [
    "string"
  ],
  "taggingEnabled": true,
  "tags": [
    "string"
  ],
  "validFrom": "2030-01-23T23:00:00.123Z",
  "validUntil": "2030-01-23T23:00:00.123Z",
  "limitMaxTicketsInCart": true,
  "maxTicketsInCart": 10.5,
  "minTicketsInCart": 10.5,
  "note": "string",
  "revealAllowedTickets": true,
  "unlocks": [
    {
      "target": "underShop",
      "eventId": "507f191e810c19729de860ea",
      "underShopId": "507f191e810c19729de860ea"
    }
  ],
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z"
}

PUT/api/coupon/series/:id

Update coupon series

Update coupon series

Payload

Optional attributes

  • Name
    name
    Type
    string
    Description

    The Name for the coupon. Visible to public.

  • Name
    singleUsage
    Type
    boolean
    Description

    Whether this coupon can only be used once

  • Name
    active
    Type
    boolean
    Description

    Whether the coupon can be used

  • Name
    maxUsage
    Type
    number
    Description

    The max amount of usages. A usage is counted as a completed transaction that used the coupon.

  • Name
    maxUsagePerEvent
    Type
    number
    Description

    The max amount of usages per event. A usage is counted as a completed transaction that used the coupon.

  • Name
    maxTickets
    Type
    number
    Description

    The number of tickets that can be purchased with this coupon

  • Name
    canBeCombined
    Type
    boolean
    Description

    Whether this coupon can be combined with others within one transaction.

  • Name
    discountType
    Type
    enum(fix, var, fixPerItem, waiveFees)
    Description
  • Name
    discountValue
    Type
    number
    Description

    The amount of the discount in seller's currency. eg. 50.0 -> 50 EUR

  • Name
    discountMaxValue
    Type
    number
    Description

    When discountType is VAR the max amount of the discount in seller's currency

  • Name
    allowAllEvents
    Type
    boolean
    Description

    Whether the coupon can be used across all events

  • Name
    allowedEvents
    Type
    array<string>
    Description

    The ID's of events where the coupon can be used

  • Name
    allowAllTickets
    Type
    boolean
    Description

    Whether the coupon can be used across all tickets within the events

  • Name
    allowedTickets
    Type
    array<string>
    Description

    The ID's of the ticket types on which the coupon should be applied

  • Name
    taggingEnabled
    Type
    boolean
    Description

    Whether this coupon tags customers

  • Name
    tags
    Type
    array<string>
    Description

    Which tags to add to customers which bought with this coupon

  • Name
    validFrom
    Type
    string
    Description

    The date from which this coupon can be redeemed.

  • Name
    validUntil
    Type
    string
    Description

    The date until this coupon can be redeemed.

  • Name
    limitMaxTicketsInCart
    Type
    boolean
    Description

    Whether this coupon limits the max tickets in cart.

  • Name
    maxTicketsInCart
    Type
    number
    Description

    If limitMaxTicketsInCart is true, the amount of the max allowed tickets.

  • Name
    minTicketsInCart
    Type
    number
    Description

    The minimum number of tickets that need to be purchased with this coupon

  • Name
    note
    Type
    string
    Description

    The Note for this coupon.

  • Name
    revealAllowedTickets
    Type
    boolean
    Description

    Whether this coupon reveals the allowed tickets.

  • Name
    unlocks
    Type
    array<oneOf>
    Description

    The array of the resources unlocked by undershop.

Request

PUT
/api/coupon/series/:id
const response = await fetch('https://vivenu.com/api/coupon/series/507f191e810c19729de860ea', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "name": "Example Name",
    "singleUsage": true,
    "active": true,
    "maxUsage": 1,
    "maxUsagePerEvent": 10.5,
    "maxTickets": 10.5,
    "canBeCombined": true,
    "discountType": "fix",
    "discountValue": 10.5,
    "discountMaxValue": 10.5,
    "allowAllEvents": true,
    "allowedEvents": [
      "string"
    ],
    "allowAllTickets": true,
    "allowedTickets": [
      "string"
    ],
    "taggingEnabled": true,
    "tags": [
      "string"
    ],
    "validFrom": "2030-01-23T23:00:00.123Z",
    "validUntil": "2030-01-23T23:00:00.123Z",
    "limitMaxTicketsInCart": true,
    "maxTicketsInCart": 10.5,
    "minTicketsInCart": 10.5,
    "note": "string",
    "revealAllowedTickets": true,
    "unlocks": [
      {
        "target": "underShop",
        "eventId": "507f191e810c19729de860ea",
        "underShopId": "507f191e810c19729de860ea"
      }
    ]
  }),
})

const data = await response.json()

Response (200)

{
  "name": "Example Name",
  "_id": "507f191e810c19729de860ea",
  "sellerId": "507f191e810c19729de860ea",
  "singleUsage": true,
  "active": true,
  "maxUsage": 1,
  "maxUsagePerEvent": 10.5,
  "maxTickets": 10.5,
  "canBeCombined": true,
  "discountType": "fix",
  "discountValue": 10.5,
  "discountMaxValue": 10.5,
  "allowAllEvents": true,
  "allowedEvents": [
    "string"
  ],
  "allowAllTickets": true,
  "allowedTickets": [
    "string"
  ],
  "taggingEnabled": true,
  "tags": [
    "string"
  ],
  "validFrom": "2030-01-23T23:00:00.123Z",
  "validUntil": "2030-01-23T23:00:00.123Z",
  "limitMaxTicketsInCart": true,
  "maxTicketsInCart": 10.5,
  "minTicketsInCart": 10.5,
  "note": "string",
  "revealAllowedTickets": true,
  "unlocks": [
    {
      "target": "underShop",
      "eventId": "507f191e810c19729de860ea",
      "underShopId": "507f191e810c19729de860ea"
    }
  ],
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z"
}

Was this page helpful?