Skip to content

Commit 52b0db5

Browse files
Subscription API + upcoming Entitlement migration (discord#7109)
* Add Subscription resource * WIP monetization docs * Monetization docs * Update links * Update changelogs * Monetization docs updates * update subscription object table * apply review suggestions Co-authored-by: shay <swdewael@gmail.com> * updates from review * ⚡ * Clarify subscription statuses in current period --------- Co-authored-by: shay <swdewael@gmail.com>
1 parent 0f992d4 commit 52b0db5

22 files changed

+842
-539
lines changed

docs/change_log/2023-09-26-premium-app-subscriptions-available-in-the-us.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Starting today, eligible US-based developers can monetize their verified apps wi
1010
* Manage subscription SKUs in the Developer Portal
1111
* View monetization analytics in the Developer Portal
1212
* Team owners can setup and manage payouts in Developer Portal
13-
* New endpoints for working with [SKUs](#DOCS_MONETIZATION_SKUS) and [Entitlements](#DOCS_MONETIZATION_ENTITLEMENTS):
14-
* [List SKUs](#DOCS_MONETIZATION_SKUS/list-skus) `GET /applications/<application.id>/skus`
15-
* [List Entitlements](#DOCS_MONETIZATION_ENTITLEMENTS/list-entitlements) `GET /applications/<application.id>/entitlements`
16-
* [Create Test Entitlement](#DOCS_MONETIZATION_ENTITLEMENTS/create-test-entitlement) `POST /applications/<application.id>/entitlements`
17-
* [Delete Test Entitlement](#DOCS_MONETIZATION_ENTITLEMENTS/delete-test-entitlement) `DELETE /applications/<application.id>/entitlements/<entitlement.id>`
18-
* [Gateway Events](#DOCS_MONETIZATION_ENTITLEMENTS/gateway-events) for working with entitlements: `ENTITLEMENT_CREATE`, `ENTITLEMENT_UPDATE`, `ENTITLEMENT_DELETE`
19-
* New [`PREMIUM_REQUIRED (10)` interaction response type](#DOCS_MONETIZATION_ENTITLEMENTS/premiumrequired-interaction-response) is available to prompt users to upgrade
20-
* New `entitlements` field, which is an array of [entitlement](#DOCS_MONETIZATION_ENTITLEMENTS/) objects, available in interaction data payloads when [receiving and responding to interactions](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-interaction-structure)
13+
* New endpoints for working with [SKUs](#DOCS_RESOURCES_SKU) and [Entitlements](#DOCS_RESOURCES_ENTITLEMENT):
14+
* [List SKUs](#DOCS_RESOURCES_SKU/list-skus) `GET /applications/<application.id>/skus`
15+
* [List Entitlements](#DOCS_RESOURCES_ENTITLEMENT/list-entitlements) `GET /applications/<application.id>/entitlements`
16+
* [Create Test Entitlement](#DOCS_RESOURCES_ENTITLEMENT/create-test-entitlement) `POST /applications/<application.id>/entitlements`
17+
* [Delete Test Entitlement](#DOCS_RESOURCES_ENTITLEMENT/delete-test-entitlement) `DELETE /applications/<application.id>/entitlements/<entitlement.id>`
18+
* [Gateway Events](#DOCS_TOPICS_GATEWAY_EVENTS/entitlements) for working with entitlements: `ENTITLEMENT_CREATE`, `ENTITLEMENT_UPDATE`, `ENTITLEMENT_DELETE`
19+
* New [`PREMIUM_REQUIRED (10)` interaction response type](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-response-object-interaction-callback-type) is available to prompt users to upgrade
20+
* New `entitlements` field, which is an array of [entitlement](#DOCS_RESOURCES_ENTITLEMENT/) objects, available in interaction data payloads when [receiving and responding to interactions](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-interaction-structure)
2121

2222
To learn more about eligibility details and how to enable monetization for your app, check out the [Monetization Overview](#DOCS_MONETIZATION_OVERVIEW).

docs/change_log/2023-11-29-premium-app-subscriptions-new-ways-for-testing-app-subscriptions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ topics:
88
Following feedback on Premium App Subscriptions, we've made it easier for developers to test their app subscriptions. The goal is to provide you with flexibility during testing and prevent you from having to use live payment methods.
99

1010
* Team members will automatically receive a 100% discount on a subscription for your app, allowing you to test the end-to-end payment flow
11-
* Developers can create and delete [test entitlements](#DOCS_MONETIZATION_ENTITLEMENTS/create-test-entitlement) to toggle access to an application's premium features
11+
* Developers can create and delete [test entitlements](#DOCS_RESOURCES_ENTITLEMENT/create-test-entitlement) to toggle access to an application's premium features
1212

13-
Read more about [Testing your App Subscriptions Implementation](#DOCS_MONETIZATION_APP_SUBSCRIPTIONS/testing-your-implementation) for details.
13+
Read more about [Testing your App Subscriptions Implementation](#DOCS_MONETIZATION_IMPLEMENTING_APP_SUBSCRIPTIONS/testing-your-app-subscription-implementation) for details.

docs/change_log/2024-04-24-premium-apps-one-time-purchases-and-store.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Two new features are now available for Premium Apps: One-Time Purchases and Stor
1010
* **Durable Items**: A one-time purchase that is permanent and is not subject to either renewal or consumption, such as lifetime access to an app's premium features.
1111
* **Consumable Items**: A one-time, non-renewable purchase that provides access, such as a temporary power-up or boost in a game.
1212

13-
Learn more about implementing [One-Time Purchases](#DOCS_MONETIZATION_ONE-TIME_PURCHASES).
13+
Learn more about [Implementing One-Time Purchases](#DOCS_MONETIZATION_IMPLEMENTING_ONE-TIME_PURCHASES).
1414

1515
**A Store for Your Premium App**
1616

@@ -22,7 +22,7 @@ To explore these features, eligibility details, and how to enable monetization f
2222

2323
The following were added to our public Monetization documentation with this update:
2424

25-
* New [SKU Object Types](#DOCS_MONETIZATION_SKUS/sku-object-sku-types)
26-
* New [Entitlement Object Types](#DOCS_MONETIZATION_ENTITLEMENTS/entitlement-object-entitlement-types)
27-
* [Consume an Entitlement](#DOCS_MONETIZATION_ENTITLEMENTS/consume-an-entitlement) API endpoint
28-
* `consumed` field on the [Entitlement](#DOCS_MONETIZATION_ENTITLEMENTS) resource
25+
* New [SKU Object Types](#DOCS_RESOURCES_SKU/sku-object-sku-types)
26+
* New [Entitlement Object Types](#DOCS_RESOURCES_ENTITLEMENT/entitlement-object-entitlement-types)
27+
* [Consume an Entitlement](#DOCS_RESOURCES_ENTITLEMENT/consume-an-entitlement) API endpoint
28+
* `consumed` field on the [Entitlement](#DOCS_RESOURCES_ENTITLEMENT) resource

docs/change_log/2024-06-17-premium-apps-new-premium-button-style-deep-linking-url-schemes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: "2024-06-17"
55

66
**New Premium Button Style**
77

8-
Introduces a new `premium` [button style](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) to be used with a `sku_id` which points to an active [SKU](#DOCS_MONETIZATION_SKUS/sku-object). This allows developers to customize their premium experience by returning specific subscription or one-time purchase products.
8+
Introduces a new `premium` [button style](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) to be used with a `sku_id` which points to an active [SKU](#DOCS_RESOURCES_SKU/sku-object). This allows developers to customize their premium experience by returning specific subscription or one-time purchase products.
99

1010
Learn more about using [button components with interactions](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/buttons).
1111

@@ -14,11 +14,11 @@ Learn more about using [button components with interactions](#DOCS_INTERACTIONS_
1414
1515
The `PREMIUM_REQUIRED (10)` interaction response type is now deprecated in favor of using custom premium buttons. This will continue to function but may be eventually unsupported. It is recommended to migrate your bots to use the more flexible [premium button component](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles).
1616

17-
Learn more about [gating features with premium interactions](#DOCS_MONETIZATION_APP_SUBSCRIPTIONS/gating-premium-interactions).
17+
Learn more about [gating features with premium interactions](#DOCS_MONETIZATION_IMPLEMENTING_APP_SUBSCRIPTIONS/prompting-users-to-subscribe).
1818

1919
**Deep Linking URL Schemes for SKUs and Store**
2020

2121
Introduces two new url schemes for linking directly to the Application Directory. When these links are used in chat, they are rendered as rich embeds that users can interact with to launch an app's store or open a SKU detail modal.
2222

23-
* New [Store URL Scheme](#DOCS_MONETIZATION_MANAGING_YOUR_STORE/linking-to-your-store): `https://discord.com/application-directory/:appID/store`
24-
* New [SKU URL Scheme](#DOCS_MONETIZATION_SKUS/linking-to-your-skus): `https://discord.com/application-directory/:appID/store/:skuID`
23+
* New [Store URL Scheme](#DOCS_MONETIZATION_MANAGING_SKUS/linking-to-your-store): `https://discord.com/application-directory/:appID/store`
24+
* New [SKU URL Scheme](#DOCS_MONETIZATION_MANAGING_SKUS/linking-to-a-specific-sku): `https://discord.com/application-directory/:appID/store/:skuID`
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
title: "Premium Apps: Entitlement Migration and New Subscription API"
3+
date: "2024-08-28"
4+
topics:
5+
- "Premium Apps"
6+
breaking: true
7+
---
8+
9+
We are migrating our entitlement system to a new behavior where entitlements will not end until explicitly canceled, representing a breaking change for subscription management. We are introducing a [Subscription API](#DOCS_RESOURCES_SUBSCRIPTION) and [Subscription Events](#DOCS_TOPICS_GATEWAY_EVENTS/subscriptions) to allow handling subscription-related events.
10+
11+
> warn
12+
> This change will be rolled out to all existing applications that have entitlements for user and guild subscription SKUs, starting on October 1, 2024.
13+
14+
#### Entitlement Migration Details
15+
- `ENTITLEMENT_CREATE` events will now be triggered with a null `ends_at` value for all ongoing subscriptions, indicating an indefinite entitlement.
16+
- `ENTITLEMENT_UPDATE` events will occur only when a subscription is canceled, with the `ends_at` value indicating the end date.
17+
- Discord-managed Subscription entitlements will have an `type` value of `PURCHASE` (type `1`) instead of `APPLICATION_SUBSCRIPTION` (type `8`).
18+
19+
### Migration Plan & Guide:
20+
As of **October 1, 2024**, all existing entitlements that grant access to user-subscription and guild-subscription SKUs will automatically transfer to the new system on their renewal date. This means we will have a month-long migration window to allow all of your entitlements to migrate to the new system upon renewal.
21+
22+
Developers are advised to update their systems to handle the new `ENTITLEMENT_CREATE` and `ENTITLEMENT_UPDATE` events according to the following migration guide before the rollout date to avoid service disruptions.
23+
24+
### Introducing a New Subscription API
25+
With the new entitlement behavior, entitlements for subscription SKUs will no longer emit events at the start of a new subscription billing period. Instead, subscription lifecycle management can be handled through the new [Subscription API](#DOCS_MONETIZATION_IMPLEMENTING_APP_SUBSCRIPTIONS/using-the-subscription-api).
26+
Developers should refer to the [Subscription resource](#DOCS_RESOURCES_SUBSCRIPTION) for information on calling the Subscription API and responding to Subscription events. For in-depth implementation details, see our [Implementing App Subscriptions](#DOCS_MONETIZATION_IMPLEMENTING_APP_SUBSCRIPTIONS/using-the-subscription-api) guide. You can start using this API now.
27+
28+
### Monetization Documentation Updates
29+
As part of these changes, we've updated the documentation for Premium Apps.
30+
- Created a new [Enabling Monetization](#DOCS_MONETIZATION_ENABLING_MONETIZATION) page to cover setting up your team, managing payouts, and enabling monetization for your apps
31+
- Created a new [Managing SKUs](#DOCS_MONETIZATION_MANAGING_SKUS/creating-a-sku) page to document how to create, update, publish, and promote your SKUs
32+
- Moved and added [Entitlement](#DOCS_RESOURCES_ENTITLEMENT), [SKU](#DOCS_RESOURCES_SKU) and [Subscription](#DOCS_RESOURCES_SUBSCRIPTION) resources to the **Resources** section
33+
- Updated guides for [Implementing App Subscriptions](#DOCS_MONETIZATION_IMPLEMENTING_APP_SUBSCRIPTIONS) and [Implementing One-Time Purchases](#DOCS_MONETIZATION_IMPLEMENTING_ONE-TIME_PURCHASES)
34+
35+
### Subscription Entitlement Migration Guide
36+
37+
Starting on **October 1, 2024**, we will be migrating our existing entitlement system to a new behavior where **entitlements do not expire until explicitly canceled**. This migration guide outlines the changes and impacts of this migration on developers and guides how to manage these changes effectively.
38+
39+
> warn
40+
> With this update, entitlements for subscription SKUs will no longer emit events when a new subscription billing period begins. If you need to know when a subscription has been renewed, use the new [Subscription API](#DOCS_RESOURCES_SUBSCRIPTION) and related [Subscription Gateway Events](#DOCS_TOPICS_GATEWAY_EVENTS/subscriptions).
41+
42+
### Current System
43+
44+
Currently, entitlements for Subscription SKUs purchased through Discord have:
45+
- An `ends_at` date that corresponds to the subscription interval. This date is updated at each billing cycle.
46+
- A entitlement `type` value of `APPLICATION_SUBSCRIPTION` (type `8`).
47+
- An `ENTITLEMENT_UPDATE` event is triggered at the start of each new subscription period.
48+
49+
### New System
50+
51+
Post-migration, entitlements for Subscription SKUs purchased through Discord will:
52+
- No longer have an end date (`ends_at` will be `null`) until the user decides to cancel the subscription.
53+
- Now have an entitlement `type` value of `PURCHASE` (type `1`).
54+
- No `ENTITLEMENT_UPDATE` events will be triggered until the subscription is canceled.
55+
56+
### Migration Timeline
57+
58+
- **Migration Start Date:** October 1, 2024
59+
- **Migration End Date:** October 31, 2024
60+
61+
### Migration Impacts
62+
63+
### 1) Existing Entitlements Scheduled to Renew
64+
65+
- **During Migration Window:**
66+
- These will automatically transfer to the new system.
67+
- A new `ENTITLEMENT_CREATE` event will be triggered to indicate the migration. This does not indicate a net new entitlement.
68+
- No further events will be generated until cancellation, which will then trigger an `ENTITLEMENT_UPDATE` event.
69+
70+
### 2) Existing Entitlements Set to End
71+
72+
- **During Migration Window:**
73+
- These entitlements will naturally expire and not renew under the new system.
74+
- No new entitlement events will be generated for these cases.
75+
76+
### Developer Actions
77+
- **Pre-Migration:**
78+
- Review and understand the new entitlement event structure.
79+
- Adjust your system to handle `ends_at` being null, which now indicates an indefinite entitlement.
80+
- Adjust your system not to expect type `APPLICATION_SUBSCRIPTION` (type `8`) for Discord-managed subscription entitlements.
81+
- **Post-Migration:**
82+
- Monitor for `ENTITLEMENT_CREATE` and `ENTITLEMENT_UPDATE` events.
83+
- Update your handling of `ends_at` timestamps to manage cancellations effectively.
84+
85+
<Collapsible title="Entitlement Migration Example Scenario" description="Step-by-step example of an entitlement upgrading to the new entitlement system" icon="view" open>
86+
- The Entitlement Migration begins on October 1, 2024
87+
- You have an existing user subscription that has an existing `ends_at` timestamp for October 10, 2024.
88+
- If the subscription renews successfully, you will receive an `ENTITLEMENT_UPDATE` event on October 10, 2024, with an `ends_at` value of null
89+
- If you receive an `ENTITLEMENT_UPDATE` event with an `ends_at` timestamp, the entitlement for this subscription is expected to end at the timestamp value unless you receive subsequent `ENTITLEMENT_UPDATE` events between the cancellation and the `ends_at` value.
90+
</Collapsible>

docs/interactions/Message_Components.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ Buttons are interactive components that render in messages. They can be clicked
9090

9191
###### Button Structure
9292

93-
| Field | Type | Description |
94-
|------------|-----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
95-
| type | integer | `2` for a button |
96-
| style | integer | A [button style](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) |
97-
| label? | string | Text that appears on the button; max 80 characters |
98-
| emoji? | partial [emoji](#DOCS_RESOURCES_EMOJI/emoji-object) | `name`, `id`, and `animated` |
99-
| custom_id? | string | Developer-defined identifier for the button; max 100 characters |
100-
| sku_id? | snowflake | Identifier for a purchasable [SKU](#DOCS_MONETIZATION_SKUS/sku-object), only available when using premium-style buttons |
101-
| url? | string | URL for link-style buttons |
102-
| disabled? | boolean | Whether the button is disabled (defaults to `false`) |
93+
| Field | Type | Description |
94+
|------------|-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
95+
| type | integer | `2` for a button |
96+
| style | integer | A [button style](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/button-object-button-styles) |
97+
| label? | string | Text that appears on the button; max 80 characters |
98+
| emoji? | partial [emoji](#DOCS_RESOURCES_EMOJI/emoji-object) | `name`, `id`, and `animated` |
99+
| custom_id? | string | Developer-defined identifier for the button; max 100 characters |
100+
| sku_id? | snowflake | Identifier for a purchasable [SKU](#DOCS_RESOURCES_SKU/sku-object), only available when using premium-style buttons |
101+
| url? | string | URL for link-style buttons |
102+
| disabled? | boolean | Whether the button is disabled (defaults to `false`) |
103103

104104
Buttons come in a variety of styles to convey different types of actions. These styles also define what fields are valid for a button.
105105

0 commit comments

Comments
 (0)