Skip to content

SKU

A premium offering for the application. Discord returns two rows for each subscription offering and the docs say to use the one with type 5 for integration and testing, so callers that list should usually filter on {@link SKU.isSubscription}. https://docs.discord.com/developers/resources/sku#sku-object

Signature

export interface SKU extends DiscordBase, ObjectToLower<APISKU>

Properties

get createdTimestamp(): number;

Create a timestamp for the current object.

get createdAt(): Date;

createdAt gets the creation Date instace of the current object.

Methods

subscriptions(query?: RESTGetAPISKUSubscriptionsQuery): Promise<SubscriptionStructure[]>;

Lists subscriptions containing this SKU. Discord requires user_id here except for OAuth queries, so the query stays optional and Discord rejects what it does not accept. https://docs.discord.com/developers/resources/subscription#list-sku-subscriptions

hasUser(userId: string): Promise<boolean>;

Checks whether a user currently holds access to this SKU. Uses entitlements for this since a subscription can stay active while Discord retries payment. Ended ones are skipped so only current access counts. Note this only sees user entitlements, guild-granted access needs a guild_id entitlement query instead.