Subscriptions

The subscriptions API provides a way for you to manage subscription renewal and notification settings for your subscribers.


GET/v1/subscription

List all subscriptions

This endpoint allows you to retrieve a list of all your subscriptions for this subscriber.

Request

GET
/v1/subscription
curl -G https://dubclub.win/api/v1/subscription \
  -H "Authorization: Bearer {token}"

Response

[
  {
    "id": 1,
    "price": { ... }, // See below for details
    "paid_until": "2022-12-23T15:24:36",
    "do_not_renew": false,
    "notify_via_sms": true,
    "notify_via_email": true,
    "notify_via_push": false,
    "notify_via_telegram": true,
    "notify_via_discord": false
  },
  {
    "id": "2"
    // ...
  }
]

GET/v1/subscription/:id

Retrieve a subscription

This endpoint allows you to retrieve an individual subscription's details.

Subscription

  • Name
    id
    Type
    integer
    Description

    Unique identifier for the subscription.

  • Name
    price
    Type
    Price
    Description

    Price model that the subscription is based on. (Read-only.)

  • Name
    paid_until
    Type
    timestamp
    Description

    Timestamp of when the subscription is paid up to. (Read-only.)

  • Name
    do_not_renew
    Type
    boolean
    Description

    Whether this subscription should terminate at its paid_until date.

  • Name
    notify_via_sms
    Type
    boolean
    Description

    Whether to send notifications via SMS.

  • Name
    notify_via_email
    Type
    boolean
    Description

    Whether to send notifications over email.

  • Name
    notify_via_push
    Type
    boolean
    Description

    Whether to send push notifications.

  • Name
    notify_via_telegram
    Type
    boolean
    Description

    Whether to send notifications through Telegram.

  • Name
    notify_via_discord
    Type
    boolean
    Description

    Whether to send notifications through Discord.

Price

  • Name
    id
    Type
    integer
    Description

    Unique identifier for the price.

  • Name
    product
    Type
    Product
    Description

    Product model that the price is based on.

  • Name
    interval
    Type
    string enum
    Description

    One of year, month, week, or day.

  • Name
    interval_count
    Type
    integer
    Description

    How many of interval this price consists of.

  • Name
    amount_in_cents
    Type
    integer
    Description

    The price amount in cents.

Product

  • Name
    id
    Type
    integer
    Description

    Unique identifier for the product.

  • Name
    name
    Type
    string
    Description

    Name of the product.

  • Name
    is_all_access
    Type
    boolean
    Description

    Whether the product is "all access".

  • Name
    capper
    Type
    User
    Description

    The capper that this product belongs to.

  • Name
    description
    Type
    string
    Description

    Description of the product.

User

  • Name
    id
    Type
    integer
    Description

    Unique identifier for the user.

  • Name
    username
    Type
    string
    Description

    Username identifier.

Request

GET
/v1/subscription/1
curl -G https://dubclub.win/api/v1/subscription/1 \
  -H "Authorization: Bearer {token}"

Response

{
  "id": 1,
  "price": {
    "id": 9,
    "product": {
      "id": 81,
      "name": "AlphaDogBets's Play Recaps",
      "is_all_access": false,
      "capper": {
        "id": 729,
        "username": "AlphaDogBets"
      },
      "description": "Complete checkout to get my plays texted to you now!"
    },
    "interval": "week",
    "interval_count": 4,
    "amount_in_cents": 2999
  },
  "paid_until": "2022-12-23T15:24:36",
  "do_not_renew": false,
  "notify_via_sms": true,
  "notify_via_email": true,
  "notify_via_push": false,
  "notify_via_telegram": true,
  "notify_via_discord": false
}

PATCH/v1/subscription/:id

Update a subscription

This endpoint allows you to update an individual subscription's settings. The following properties can be updated:

  • Name
    do_not_renew
    Type
    boolean
    Description

    Whether this subscription should terminate at its paid_until date.

  • Name
    notify_via_sms
    Type
    boolean
    Description

    Whether to send notifications via SMS.

  • Name
    notify_via_email
    Type
    boolean
    Description

    Whether to send notifications over email.

  • Name
    notify_via_push
    Type
    boolean
    Description

    Whether to send push notifications.

  • Name
    notify_via_telegram
    Type
    boolean
    Description

    Whether to send notifications through Telegram.

  • Name
    notify_via_discord
    Type
    boolean
    Description

    Whether to send notifications through Discord.

Request

PATCH
/v1/subscription/1
curl -X PATCH https://dubclub.win/api/v1/subscription/1 \
  -H "Authorization: Bearer {token}" \
  -d notify_via_email=true

Response

200 OK