> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# प्राधिकार अनुदान

> जब प्राधिकार अनुदान बनाए जाते हैं, वितरित होते हैं, असफल होते हैं, या निरस्त होते हैं, तो आपके वेबहुक अंत बिंदु पर भेजा जाने वाला पेलोड।

## प्राधिकार अनुदान वेबहुक घटनाएँ

जब भी किसी ग्राहक का प्राधिकार अनुदान स्थिति बदलता है, उदाहरण के लिए जब एक लाइसेंस कुंजी उत्पन्न होती है, एक Discord भूमिका आवंटित होती है, एक डाउनलोड लिंक प्रदान किया जाता है, या पहुंच निरस्त होती है, तो ये घटनाएँ चलती हैं। इन घटनाओं की सदस्यता लें ताकि आपका एप्लिकेशन इस बात के साथ तालमेल में रहे कि प्रत्येक ग्राहक को क्या पहुंच सकता है।

| इवेंट                         | विवरण                                                                                                                                                                               |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `entitlement_grant.created`   | एक नया ग्रांट रो बनाया गया। स्थिति तुरंत `delivered` होती है ऑटो-फुलफिल्ड लाइसेंस कीज़ के लिए, और मैन्युअल-फुलफिल्ड लाइसेंस कीज़ और अन्य सभी इंटीग्रेशन्स के लिए `pending` होती है। |
| `entitlement_grant.delivered` | ग्रांट डिलीवर्ड हो गया। ग्राहक को अब नियुक्त प्लेटफॉर्म, फ़ाइल, या लाइसेंस की तक पहुंच प्राप्त हो गई है।                                                                            |
| `entitlement_grant.failed`    | डिलीवरी विफल हो गई है और पुनः प्रयास नहीं किया जा रहा है। `error_code` और `error_message` की जाँच करें।                                                                             |
| `entitlement_grant.revoked`   | एक्सेस हटा दी गई। समझने के लिए `revocation_reason` की जाँच करें।                                                                                                                    |

सभी चार घटनाएँ नीचे दी गई स्कीमा में प्रलेखित समान `EntitlementGrantResponse` पेलोड साझा करती हैं।

***

## घटना ट्रिगर

### entitlement\_grant.created

एक अनुदान पंक्ति अभी-अभी डाली गई। इस बिंदु से अनुदान के पास हमेशा एक स्थिर `id` होता है, भले ही उसकी स्थिति बदल जाए। यह रिकॉर्ड करने के लिए इस घटना का उपयोग करें कि पूर्ति प्रगति पर है।

**ऑटो-फुलफिल्ड लाइसेंस कीज़** के लिए रो सीधे `status: "delivered"` और `delivered_at` के साथ डाला जाता है, इसलिए एकल `created` इवेंट के बाद कोई और स्थिति परिवर्तन नहीं होता है जब तक कि ग्रांट बाद में रद्द नहीं किया जाता।

**मैन्युअल-फुलफिल्ड लाइसेंस कीज़** (`fulfillment_mode: manual` के साथ एंटाइटलमेंट्स) के लिए रो `status: "pending"` के साथ और कोई `license_key` ऑब्जेक्ट के बिना आती है — अभी कोई की मौजूद नहीं है। यह इवेंट आपका संकेत है कि एक की फुलफिलमेंट का इंतजार कर रही है; इसे [`POST /grants/{grant_id}/license-key`](/api-reference/entitlements/fulfill-license-key) के माध्यम से प्रदान करें, जो बाद में `entitlement_grant.delivered` को ट्रिगर करता है। [मैन्युअल फुलफिलमेंट](/features/license-keys#manual-fulfillment) देखें।

**हर अन्य इंटीग्रेशन** के लिए रो `status: "pending"` के साथ आती है। एक `delivered` या `failed` इवेंट तब होता है जब डिलीवरी समाप्त हो जाती है:

* **OAuth-आधारित इंटीग्रेशन** (Discord, GitHub, Notion) में एक `oauth_url` शामिल होता है, जिसे ग्राहक को सहमति पूरी करने के लिए जाना चाहिए। ग्रांट `pending` रहता है जब तक कि ग्राहक अधिकृत न करें।
* **प्लेटफॉर्म-डायरेक्ट इंटीग्रेशन** (Telegram, Framer, Digital Files) केवल थोड़ी देर के लिए `pending` में रहती है जबकि प्लेटफ़ॉर्म काल चल रही होती है, फिर `delivered` में चली जाती है।

### entitlement\_grant.delivered

ग्रांट `pending` से `delivered` में ट्रांजिशन हो गया। ग्राहक को अब एंटाइटलमेंट द्वारा वर्णित एक्सेस प्राप्त है। इस इवेंट का उपयोग अपने सिस्टम में निर्भर फीचर्स को अनलॉक करने के लिए करें, उदाहरण के लिए एक वर्कस्पेस प्रोविजनिंग करने के लिए, एक कस्टम स्वागत ईमेल भेजने के लिए, या एक "fulfilled" फ़्लैग मार्क करने के लिए।

पेलोड का `delivered_at` फ़ील्ड कैप्चर करता है जब डिलीवरी पूरी हो जाती है। उन ग्रांट्स के लिए जो क्रिएशन पर `delivered` पर आए, आपको `created` और `delivered` इवेंट्स लगातार मिलेंगे।

### entitlement\_grant.failed

डिलीवरी का प्रयास किया गया और यह एक गैर-पुनः प्रयोज्य त्रुटि के साथ विफल रही। `error_code` और `error_message` फील्ड्स विफलता की व्याख्या करते हैं। सामान्य कारणों में एक रद्द किया हुआ OAuth टोकन, एक अस्वीकार की गई प्लेटफॉर्म अनुमति, या एक गायब लक्ष्य (जैसे, एक हटाया गया Discord गिल्ड) शामिल है।

<Tip>
  `entitlement_grant.failed` को कार्यात्मक माना जाता है। ग्राहक ने भुगतान किया लेकिन उसे एक्सेस नहीं मिला। अपनी समर्थन टीम को विफलताएँ बताएं या एक बार मूल समस्या हल हो जाने पर फिर से ग्रांट ट्रिगर करें।
</Tip>

### entitlement\_grant.revoked

प्लेटफ़ॉर्म स्तर पर एक्सेस हटा दी गई: Discord भूमिका हटा दी गई, GitHub कोलैबोरेटर हटा दिया गया, लाइसेंस की अक्षम कर दी गई, फाइल डाउनलोड URLs अब जारी नहीं की गईं। `revocation_reason` फील्ड ट्रिगर रिकॉर्ड करता है।

| `revocation_reason`      | ट्रिगर                                                                                                                                                                                                                                                                        |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `subscription_cancelled` | ग्राहक की सब्सक्रिप्शन रद्द कर दी गई (`subscription.cancelled` इवेंट)।                                                                                                                                                                                                        |
| `subscription_on_hold`   | सब्सक्रिप्शन नवीकरण में विफल होने के कारण होल्ड पर है (`subscription.on_hold`)। पुनः प्राप्त: एक सफल पुनः प्रयास एक पुनः-ग्रांट उत्पन्न करता है।                                                                                                                              |
| `subscription_expired`   | सब्सक्रिप्शन ने अपनी अवधि के अंत तक पहुंच गया (`subscription.expired`)।                                                                                                                                                                                                       |
| `plan_changed`           | योजना बदल गई; पुरानी ग्रांट्स नए जारी करने से पहले रद्द कर दी जाती हैं (`subscription.plan_changed`)।                                                                                                                                                                         |
| `refund`                 | मूल एकल बार के भुगतान के लिए एक वापसी की गई थी (`refund.succeeded`)।                                                                                                                                                                                                          |
| `manual`                 | व्यापारी ने API या डैशबोर्ड के माध्यम से ग्रांट वापस ले लिया। मैन्युअल रद्द नहीं की गई ग्रांट्स सब्सक्रिप्शन नवीकरण पर पुनः-ग्रांट नहीं की जाती हैं।                                                                                                                          |
| `license_key_disabled`   | लाइसेंस-की ग्रांट के पीछे की लाइसेंस की अक्षम कर दी गई थी। यदि की को फिर से सक्षम किया जाता है तो ग्रांट को स्वचालित रूप से पुनः सक्रिय किया जाता है।                                                                                                                         |
| `platform_external`      | इंटीग्रेशन का प्लेटफ़ॉर्म साइड सिंक से बाहर हो गया (उदाहरण के लिए, एक Discord भूमिका को मैन्युअल रूप से हटा दिया गया, GitHub ऐप का रिपॉजिटरी एक्सेस खो गया, या एक सुलह पास ने एक गायब लक्ष्य पाया)। समस्या हल न होने तक सब्सक्रिप्शन रिन्यूअल पर ग्रांट ऑटो-ग्रांट नहीं होती। |

***

## पेलोड वेरिएंट्स

`data` फील्ड हमेशा एक `EntitlementGrantResponse` ऑब्जेक्ट होता है। पेलोड एक `integration_type` फ़ील्ड (उदाहरण के लिए `license_key`, `digital_files`, `discord`) कैरी करता है ताकि आप सीधे ग्रांट प्रकार को पहचान सकें। दो इंटीग्रेशन प्रकार अतिरिक्त नेस्टेड ऑब्जेक्ट्स भी संलग्न करते हैं:

* **`license_key`** तब शामिल होता है जब `integration_type``license_key` होता है **और एक की जारी की गई है**। इसमें जनरेट की गई की, समाप्ति, और सक्रियण उपयोग शामिल होते हैं। एक मैन्युअल-फुलफिल्ड ग्रांट के लिए जो अभी भी `pending` में है, यह ऑब्जेक्ट `null` रहता है जब तक आप ग्रांट को फुलफिल नहीं कर देते।
* **`digital_product_delivery`** तब शामिल होता है जब `integration_type` `digital_files` होता है। इसमें प्रीसाइनड डाउनलोड URLs, वैकल्पिक `instructions` और वैकल्पिक `external_url` शामिल होते हैं।

बाकी सभी इंटीग्रेशन प्रकारों के लिए (Discord, GitHub, Telegram, Framer, Notion) दोनों नेस्टेड फील्ड्स `null` होते हैं; सम्बन्धित कॉन्फ़िगरेशन एंटाइटलमेंट में कैप्चर की जाती है, ग्रांट में नहीं।

***

## सैंपल पेलोड्स

### लाइसेंस की डिलीवर्ड (`entitlement_grant.delivered`)

```json theme={null} theme={null}
{
  "business_id": "bus_H4ekzPSlcg",
  "type": "entitlement_grant.delivered",
  "timestamp": "2026-05-01T10:25:33.000000Z",
  "data": {
    "id": "grant_8VbC6JDZzPEqfBPUdpj0K",
    "business_id": "bus_H4ekzPSlcg",
    "entitlement_id": "ent_9xY2bKwQn5MjRpL8d",
    "customer_id": "cus_abc123",
    "external_id": "lk_AAA111BBB222",
    "payment_id": "pay_a1b2c3d4",
    "subscription_id": null,
    "status": "delivered",
    "integration_type": "license_key",
    "license_key": {
      "key": "PRO-AAAA-BBBB-CCCC-DDDD",
      "expires_at": "2027-05-01T00:00:00Z",
      "activations_used": 0,
      "activations_limit": 5
    },
    "digital_product_delivery": null,
    "delivered_at": "2026-05-01T10:25:33Z",
    "revoked_at": null,
    "revocation_reason": null,
    "error_code": null,
    "error_message": null,
    "oauth_url": null,
    "oauth_expires_at": null,
    "metadata": null,
    "created_at": "2026-05-01T10:25:33Z",
    "updated_at": "2026-05-01T10:25:33Z"
  }
}
```

### लाइसेंस की मैन्युअल फुलफिलमेंट की प्रतीक्षा में (`entitlement_grant.created`)

जब ग्राहक एक उत्पाद खरीदता है जिसका लाइसेंस की एंटाइटलमेंट `fulfillment_mode: manual` का उपयोग करता है, तब फ़ायर होता है। ग्रांट `pending` है और कोई `license_key` ऑब्जेक्ट नहीं है — व्यापारी को की प्रदान करनी होगी।

```json theme={null} theme={null}
{
  "business_id": "bus_H4ekzPSlcg",
  "type": "entitlement_grant.created",
  "timestamp": "2026-05-01T10:24:00.000000Z",
  "data": {
    "id": "grant_8VbC6JDZzPEqfBPUdpj0K",
    "business_id": "bus_H4ekzPSlcg",
    "entitlement_id": "ent_9xY2bKwQn5MjRpL8d",
    "customer_id": "cus_abc123",
    "external_id": null,
    "payment_id": "pay_a1b2c3d4",
    "subscription_id": null,
    "status": "pending",
    "integration_type": "license_key",
    "license_key": null,
    "digital_product_delivery": null,
    "delivered_at": null,
    "revoked_at": null,
    "revocation_reason": null,
    "error_code": null,
    "error_message": null,
    "oauth_url": null,
    "oauth_expires_at": null,
    "metadata": null,
    "created_at": "2026-05-01T10:24:00Z",
    "updated_at": "2026-05-01T10:24:00Z"
  }
}
```

### डिजिटल फाइलें डिलीवर्ड (`entitlement_grant.delivered`)

```json theme={null} theme={null}
{
  "business_id": "bus_H4ekzPSlcg",
  "type": "entitlement_grant.delivered",
  "timestamp": "2026-05-01T10:30:12.000000Z",
  "data": {
    "id": "grant_2P9rQwYvMxTnKoCb4",
    "business_id": "bus_H4ekzPSlcg",
    "entitlement_id": "ent_files_J3kLmN4oP5",
    "customer_id": "cus_abc123",
    "external_id": "pay_a1b2c3d4",
    "payment_id": "pay_a1b2c3d4",
    "subscription_id": null,
    "status": "delivered",
    "integration_type": "digital_files",
    "license_key": null,
    "digital_product_delivery": {
      "files": [
        {
          "file_id": "df_a4f6c1de",
          "download_url": "https://files.dodopayments.com/.../pro-bundle.zip?Signature=...",
          "filename": "pro-bundle.zip",
          "content_type": "application/zip",
          "file_size": 18742390,
          "expires_in": 900
        }
      ],
      "instructions": "Unzip and run setup.sh from the project root.",
      "external_url": null
    },
    "delivered_at": "2026-05-01T10:30:12Z",
    "revoked_at": null,
    "revocation_reason": null,
    "error_code": null,
    "error_message": null,
    "oauth_url": null,
    "oauth_expires_at": null,
    "metadata": null,
    "created_at": "2026-05-01T10:30:12Z",
    "updated_at": "2026-05-01T10:30:12Z"
  }
}
```

### Discord भूमिका बनाई गई और प्रतीक्षा में (`entitlement_grant.created`)

```json theme={null} theme={null}
{
  "business_id": "bus_H4ekzPSlcg",
  "type": "entitlement_grant.created",
  "timestamp": "2026-05-01T10:31:00.000000Z",
  "data": {
    "id": "grant_DiscordPending5L",
    "business_id": "bus_H4ekzPSlcg",
    "entitlement_id": "ent_discord_patrons",
    "customer_id": "cus_abc123",
    "external_id": "sub_pro_monthly_001",
    "payment_id": null,
    "subscription_id": "sub_pro_monthly_001",
    "status": "pending",
    "integration_type": "discord",
    "license_key": null,
    "digital_product_delivery": null,
    "delivered_at": null,
    "revoked_at": null,
    "revocation_reason": null,
    "error_code": null,
    "error_message": null,
    "oauth_url": "https://discord.com/oauth2/authorize?...",
    "oauth_expires_at": "2026-05-08T10:31:00Z",
    "metadata": null,
    "created_at": "2026-05-01T10:31:00Z",
    "updated_at": "2026-05-01T10:31:00Z"
  }
}
```

### सब्सक्रिप्शन रद्दीकरण पर ग्रांट रद्द (`entitlement_grant.revoked`)

```json theme={null} theme={null}
{
  "business_id": "bus_H4ekzPSlcg",
  "type": "entitlement_grant.revoked",
  "timestamp": "2026-06-15T08:12:44.000000Z",
  "data": {
    "id": "grant_8VbC6JDZzPEqfBPUdpj0K",
    "business_id": "bus_H4ekzPSlcg",
    "entitlement_id": "ent_9xY2bKwQn5MjRpL8d",
    "customer_id": "cus_abc123",
    "external_id": "sub_pro_monthly_001",
    "payment_id": null,
    "subscription_id": "sub_pro_monthly_001",
    "status": "revoked",
    "integration_type": "license_key",
    "revocation_reason": "subscription_cancelled",
    "license_key": {
      "key": "PRO-AAAA-BBBB-CCCC-DDDD",
      "expires_at": null,
      "activations_used": 1,
      "activations_limit": 5
    },
    "digital_product_delivery": null,
    "delivered_at": "2026-05-01T10:25:33Z",
    "revoked_at": "2026-06-15T08:12:44Z",
    "error_code": null,
    "error_message": null,
    "oauth_url": null,
    "oauth_expires_at": null,
    "metadata": null,
    "created_at": "2026-05-01T10:25:33Z",
    "updated_at": "2026-06-15T08:12:44Z"
  }
}
```

### डिलीवरी विफल (`entitlement_grant.failed`)

```json theme={null} theme={null}
{
  "business_id": "bus_H4ekzPSlcg",
  "type": "entitlement_grant.failed",
  "timestamp": "2026-05-01T10:36:21.000000Z",
  "data": {
    "id": "grant_GhFailed7Z",
    "business_id": "bus_H4ekzPSlcg",
    "entitlement_id": "ent_github_repo",
    "customer_id": "cus_abc123",
    "external_id": "pay_a1b2c3d4",
    "payment_id": "pay_a1b2c3d4",
    "subscription_id": null,
    "status": "failed",
    "integration_type": "github",
    "license_key": null,
    "digital_product_delivery": null,
    "delivered_at": null,
    "revoked_at": null,
    "revocation_reason": null,
    "error_code": "github_permission_denied",
    "error_message": "Repository access could not be granted: the GitHub App installation no longer has permission on this repository.",
    "oauth_url": null,
    "oauth_expires_at": null,
    "metadata": null,
    "created_at": "2026-05-01T10:36:00Z",
    "updated_at": "2026-05-01T10:36:21Z"
  }
}
```

***

## इंटीग्रेशन टिप्स

* **आश्रित फीचर्स को अनलॉक करने से पहले `entitlement_grant.delivered` का इंतजार करें।** एक `payment.succeeded` इवेंट आपको पैसे की पुष्टि करता है; यह आपको यह नहीं बताता कि ग्राहक के पास GitHub रिपॉजिटरी या Discord भूमिका है या नहीं। `delivered` इवेंट फुलफिलमेंट के लिए सत्य का स्रोत है।
* **`revocation_reason` को रिटेन्शन फ्लो में मैप करें।** एक `subscription_on_hold` रद्दीकरण आम तौर पर बताता है कि ग्राहक का कार्ड विफल हो गया और अगला नवीकरण एक्सेस को फिर से ग्रांट करेगा। एक `manual` या `subscription_cancelled` रद्दीकरण जानबूझकर होता है। ग्राहक संदेशों में उन्हें अलग तरीके से हैंडल करें।
* **अपने इडेम्पोटेंसी की के रूप में ग्रांट `id` का उपयोग करें।** एकल ग्रांट अधिकतम एक `created` इवेंट और अधिकतम एक अंतिम इवेंट (`delivered` या `failed`), और अधिकतम एक `revoked` इवेंट को उत्पन्न करती है। वेबहुक सिस्टम से पुनः डिलीवरी इवेंट्स को दोहरा सकती है; ग्रांट `id` और `type` पर डुप्लिकेट को दूर करें।
* **ग्रांट प्रकार की पहचान करने के लिए `integration_type` पढ़ें।** पेलोड `integration_type` को सीधे कैरी करता है (उदाहरण के लिए `license_key`, `digital_files`, `discord`)। `license_key` और `digital_product_delivery` नेस्टेड ऑब्जेक्ट्स उनके संबंधित ग्रांट्स की डिलीवरी के बाद आबाद होते हैं; एक मैन्युअल-फुलफिल्ड लाइसेंस की ग्रांट `pending`, `integration_type: "license_key"` और `null` `license_key` के साथ बनी रहती है जब तक आप इसे फुलफिल नहीं करते।
* **OAuth-आधारित ग्रांट्स के लिए, ग्राहक के सामने `oauth_url` पेश करें।** Discord, GitHub, या Notion सब्सक्राइबर फ्लोज़ के लिए `entitlement_grant.created` इवेंट में एक `oauth_url` और `oauth_expires_at` शामिल होते हैं। ग्राहक को इसे ईमेल करें या अपनी ऐप में प्रदर्शित करें ताकि डिलीवरी बाधित न हो।
