प्राधिकार अनुदान
जब प्राधिकार अनुदान बनाए जाते हैं, वितरित होते हैं, असफल होते हैं, या निरस्त होते हैं, तो आपके वेबहुक अंत बिंदु पर भेजा जाने वाला पेलोड।
प्राधिकार अनुदान वेबहुक घटनाएँ
जब भी किसी ग्राहक का प्राधिकार अनुदान स्थिति बदलता है, उदाहरण के लिए जब एक लाइसेंस कुंजी उत्पन्न होती है, एक 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 करने तक grantPendingरहती है। - Platform-direct integrations (Telegram, Framer, Digital Files) केवल थोड़े समय के लिए
Pendingमें रहती हैं, जब तक platform call चलती है; इसके बाद वेDeliveredमें चली जाती हैं।
entitlement_grant.delivered
grantPending से 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.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 के लिए यह objectnullहोता है, जब तक कि आप grant fulfill न कर दें।digital_product_deliveryतब शामिल होता है जबintegration_type,digital_filesहो। इसमें presigned download URLs, optionalinstructionsऔर optionalexternal_urlशामिल होते हैं।featureतब शामिल होता है जबintegration_type,feature_flagहो। इसमें grant द्वारा प्रदान की गई capability काfeature_typeऔरfeature_idशामिल होता है।
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.succeededevent आपको बताता है कि payment clear हो गया है; यह नहीं बताता कि customer के पास अभी GitHub repo या Discord role है। Fulfillment के लिएdeliveredevent source of truth है। revocation_reasonको retention flows से map करें।subscription_on_holdrevoke का आमतौर पर अर्थ है कि customer का card fail हो गया और अगला renewal access फिर से grant करेगा।manualयाsubscription_cancelledrevoke जानबूझकर किया गया होता है। Customer messaging में इनके साथ अलग-अलग व्यवहार करें।- Grant के
idको अपनी idempotency key के रूप में उपयोग करें। एक grant अधिकतम एकcreatedevent, अधिकतम एक terminal event (deliveredयाfailed), और अधिकतम एकrevokedevent 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_deliverynested objects populated होते हैं; manually-fulfilled license-key grantintegration_type: "license_key"और एकnulllicense_keyके साथPendingमें रहती है, जब तक कि आप इसे fulfill न कर दें। - OAuth-based grants के लिए customer को
oauth_urlदिखाएँ। Discord, GitHub या Notion subscriber flows के लिएentitlement_grant.createdevent में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 this grant belongs to.
Identifier of the business that owns the grant.
Timestamp when the grant was created.
Identifier of the customer the grant was issued to.
Identifier of the entitlement this grant was issued from.
Unique identifier of the grant.
The integration type of the grant's entitlement (e.g. license_key).
discord, telegram, github, figma, framer, notion, digital_files, license_key, feature_flag Arbitrary key-value metadata recorded on the grant.
Lifecycle status of the grant.
Pending, Delivered, Failed, Revoked Timestamp when the grant was last modified.
Timestamp when the grant transitioned to delivered, when applicable.
Digital-product-delivery payload, present when the entitlement
integration is digital_files.
Machine-readable code reported when delivery failed, when applicable.
Human-readable message reported when delivery failed, when applicable.
Typed feature payload, present only when the entitlement integration is
feature_flag; null for every other integration type.
License-key delivery payload, present when the entitlement integration
is license_key.
Timestamp when oauth_url stops being valid, when applicable.
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.
Identifier of the payment that triggered this grant, when applicable.
Reason recorded when the grant was revoked, when applicable.
Timestamp when the grant transitioned to revoked, when applicable.
Identifier of the subscription that triggered this grant, when applicable.