Monetization Related
See also
More about app monetization
SKU (Stock Keeping Unit)
- class discord.SKU
Bases:
object
SKUs (stock-keeping units) in Discord represent premium offerings that can be made available to your application’s users or guilds.
Added in version 2.0.
SKUFlags
- class discord.SKUFlags
Bases:
BaseFlags
Wraps up the flags of a
SKU
.- x == y
Checks if two SKUFlags are equal.
- x != y
Checks if two SKUFlags are not equal.
- hash(x)
Return the flag’s hash.
- iter(x)
Returns an iterator of
(name, value)
pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.
- value
The raw value. This value is a bit array field of a 53-bit integer representing the currently available flags. You should query flags via the properties rather than using this raw value.
- Type:
- app_guild_subscription
A recurring SKU that can be purchased by a user and applied to a single server. Grants access to every user in that server.
- Type:
- app_user_subscription
Recurring SKU purchased by a user for themselves. Grants access to the purchasing user in every server.
- Type:
Entitlement
- asyncconsume
- class discord.Entitlement
Bases:
object
Entitlements represent that a user or guild has access to a premium offering in your application.
Added in version 2.0.
- user_id
app_user_subscription
only: The ID of the user that is granted access to the entitlement’s sku- Type:
Optional[
int
]
- guild_id
app_guild_subscription
only: The ID of the guild that is granted access to the entitlement’s sku- Type:
Optional[
int
]
- starts_at
Start date at which the entitlement is valid.
None
for test entitlements.- Type:
Optional[
datetime
]
- ends_at
Time at which the entitlement is no longer valid.
None
for test entitlements.- Type:
Optional[
datetime
]
- consumed
consumable
entitlements only: Indicates whether the entitlement has been consumedSee also
To consume an entitlement you can use either of those
consume()
from the Entitlement object directlydiscord.Client.consume_entitlement()
by using only the ID
- Type:
Optional[
bool
]
- await consume()
This function is a coroutine.
For one-time purchase
consumable
SKUs, marks a given entitlement for the user as consumed.consumed
will beFalse
for this entitlement when usingfetch_entitlements()
.Note
This can can also be done with just the ID using
consume_entitlement()
Subscription
- class discord.Subscription
Bases:
object
Subscriptions in Discord represent a user making recurring payments for at least one SKU over an ongoing period. Successful payments grant the user access to entitlements associated with the SKU.
Added in version 2.0.
- sku_ids
List of SKU IDs the user is subscribed to
- Type:
List[
int
]
- entitlement_ids
List of entitlements granted for this subscription
- Type:
List[
int
]
- canceled_at
Time at which the subscription was canceled
- Type:
Optional[
datetime
]
- country_code
The country code of the user.
ISO3166-1 alpha-2 country code of the payment source used to purchase the subscription. Missing unless queried with a private OAuth scope.
- Type:
Optional[
str
]