Skip to main content

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

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

घटना ट्रिगर

entitlement_grant.created

एक अनुदान पंक्ति अभी-अभी डाली गई। इस बिंदु से अनुदान के पास हमेशा एक स्थिर id होता है, भले ही उसकी स्थिति बदल जाए। यह रिकॉर्ड करने के लिए इस घटना का उपयोग करें कि पूर्ति प्रगति पर है। auto-fulfilled license keys के लिए row सीधे status: "Delivered" और delivered_at को populated करके insert की जाती है, इसलिए एकल created event के बाद कोई और state change नहीं होता, जब तक कि बाद में grant revoke न कर दी जाए। manually-fulfilled license keys (fulfillment_mode: manual वाली entitlements) के लिए row status: "Pending" के साथ आती है और इसमें कोई license_key object नहीं होता — अभी कोई key उपलब्ध नहीं है। यह event आपका संकेत है कि एक key fulfillment की प्रतीक्षा कर रही है; इसे POST /grants/{grant_id}/license-key के माध्यम से supply करें, जिसके बाद entitlement_grant.delivered fire होता है। Manual Fulfillment देखें। हर दूसरे integration के लिए row status: "Pending" के साथ आती है। Delivery पूरी होने के बाद delivered या failed event आता है:
  • OAuth-based integrations (Discord, GitHub, Notion) में एक oauth_url शामिल होता है, जिसे customer को consent पूरा करने के लिए visit करना होगा। Customer के authorize करने तक grant Pending रहती है।
  • Platform-direct integrations (Telegram, Framer, Digital Files) केवल थोड़े समय के लिए Pending में रहती हैं, जब तक platform call चलती है; इसके बाद वे Delivered में चली जाती हैं।

entitlement_grant.delivered

grant Pending से Delivered में transition हो गई। अब customer के पास entitlement में बताए गए access का अधिकार है। अपने systems में dependent features को unlock करने के लिए इस event का उपयोग करें, जैसे workspace provision करना, custom welcome email भेजना या “fulfilled” flag को mark करना। Payload का delivered_at field यह दर्ज करता है कि delivery कब पूरी हुई। Creation के समय Delivered पर आई grants के लिए आपको created और delivered events लगातार प्राप्त होंगे।

entitlement_grant.failed

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

entitlement_grant.revoked

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

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

data field हमेशा एक EntitlementGrantResponse object होता है। Payload में एक integration_type field होता है (उदाहरण के लिए license_key, digital_files, discord), ताकि आप grant type को सीधे पहचान सकें। तीन integration types अतिरिक्त nested objects भी attach करते हैं:
  • license_key तब शामिल होता है जब integration_type, license_key हो और एक key जारी की गई हो। इसमें generated key, expiry और activation usage शामिल होते हैं। अभी भी Pending में मौजूद manually-fulfilled grant के लिए यह object null होता है, जब तक कि आप grant fulfill न कर दें।
  • digital_product_delivery तब शामिल होता है जब integration_type, digital_files हो। इसमें presigned download URLs, optional instructions और optional external_url शामिल होते हैं।
  • feature तब शामिल होता है जब integration_type, feature_flag हो। इसमें grant द्वारा प्रदान की गई capability का feature_type और feature_id शामिल होता है।
अन्य सभी integration types (Discord, GitHub, Telegram, Figma, Framer, Notion) के लिए ये nested fields null होते हैं; संबंधित configuration entitlement में capture की जाती है, grant में नहीं।

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

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

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

यह तब fire होता है जब कोई customer ऐसा product खरीदता है जिसकी License Key entitlement में fulfillment_mode: manual का उपयोग किया गया हो। grant Pending होती है और इसमें अभी कोई license_key object नहीं होता — merchant को key supply करनी होगी।

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

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

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

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


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

  • Dependent features को unlock करने से पहले entitlement_grant.delivered का इंतज़ार करें। payment.succeeded event आपको बताता है कि payment clear हो गया है; यह नहीं बताता कि customer के पास अभी GitHub repo या Discord role है। Fulfillment के लिए delivered event source of truth है।
  • revocation_reason को retention flows से map करें। subscription_on_hold revoke का आमतौर पर अर्थ है कि customer का card fail हो गया और अगला renewal access फिर से grant करेगा। manual या subscription_cancelled revoke जानबूझकर किया गया होता है। Customer messaging में इनके साथ अलग-अलग व्यवहार करें।
  • Grant के id को अपनी idempotency key के रूप में उपयोग करें। एक grant अधिकतम एक created event, अधिकतम एक terminal event (delivered या failed), और अधिकतम एक revoked event emit करती है। Webhook system से होने वाली re-deliveries events को दोहरा सकती हैं; grant के id और type के आधार पर dedupe करें।
  • Grant type पहचानने के लिए integration_type पढ़ें। Payload में integration_type सीधे मौजूद होता है (उदाहरण के लिए license_key, digital_files, discord)। संबंधित grants के deliver होने के बाद license_key और digital_product_delivery nested objects populated होते हैं; manually-fulfilled license-key grant integration_type: "license_key" और एक null license_key के साथ Pending में रहती है, जब तक कि आप इसे fulfill न कर दें।
  • OAuth-based grants के लिए customer को oauth_url दिखाएँ। Discord, GitHub या Notion subscriber flows के लिए entitlement_grant.created event में oauth_url और oauth_expires_at शामिल होते हैं। Delivery को unblock करने के लिए इसे customer को email करें या अपने app में दिखाएँ।

Detailed view of a single entitlement grant: who it's for, its lifecycle state, and any integration-specific delivery payload.

brand_id
string
आवश्यक

Brand id this grant belongs to.

business_id
string
आवश्यक

Identifier of the business that owns the grant.

created_at
string<date-time>
आवश्यक

Timestamp when the grant was created.

customer_id
string
आवश्यक

Identifier of the customer the grant was issued to.

entitlement_id
string
आवश्यक

Identifier of the entitlement this grant was issued from.

id
string
आवश्यक

Unique identifier of the grant.

integration_type
enum<string>
आवश्यक

The integration type of the grant's entitlement (e.g. license_key).

उपलब्ध विकल्प:
discord,
telegram,
github,
figma,
framer,
notion,
digital_files,
license_key,
feature_flag
metadata
Metadata · object
आवश्यक

Arbitrary key-value metadata recorded on the grant.

status
enum<string>
आवश्यक

Lifecycle status of the grant.

उपलब्ध विकल्प:
Pending,
Delivered,
Failed,
Revoked
updated_at
string<date-time>
आवश्यक

Timestamp when the grant was last modified.

delivered_at
string<date-time> | null

Timestamp when the grant transitioned to delivered, when applicable.

digital_product_delivery
null | Digital Product Delivery · object

Digital-product-delivery payload, present when the entitlement integration is digital_files.

error_code
string | null

Machine-readable code reported when delivery failed, when applicable.

error_message
string | null

Human-readable message reported when delivery failed, when applicable.

feature
null | object

Typed feature payload, present only when the entitlement integration is feature_flag; null for every other integration type.

license_key
null | object

License-key delivery payload, present when the entitlement integration is license_key.

oauth_expires_at
string<date-time> | null

Timestamp when oauth_url stops being valid, when applicable.

oauth_url
string | null

Customer-facing OAuth URL for OAuth-style integrations. Populated during the customer-portal accept flow; null until the customer completes that step, and on grants for non-OAuth integrations.

payment_id
string | null

Identifier of the payment that triggered this grant, when applicable.

revocation_reason
string | null

Reason recorded when the grant was revoked, when applicable.

revoked_at
string<date-time> | null

Timestamp when the grant transitioned to revoked, when applicable.

subscription_id
string | null

Identifier of the subscription that triggered this grant, when applicable.

अंतिम संशोधन 21 अगस्त 2026