प्राधिकार अनुदान
जब प्राधिकार अनुदान बनाए जाते हैं, वितरित होते हैं, असफल होते हैं, या निरस्त होते हैं, तो आपके वेबहुक अंत बिंदु पर भेजा जाने वाला पेलोड।
प्राधिकार अनुदान वेबहुक घटनाएँ
जब भी किसी ग्राहक का प्राधिकार अनुदान स्थिति बदलता है, उदाहरण के लिए जब एक लाइसेंस कुंजी उत्पन्न होती है, एक Discord भूमिका आवंटित होती है, एक डाउनलोड लिंक प्रदान किया जाता है, या पहुंच निरस्त होती है, तो ये घटनाएँ चलती हैं। इन घटनाओं की सदस्यता लें ताकि आपका एप्लिकेशन इस बात के साथ तालमेल में रहे कि प्रत्येक ग्राहक को क्या पहुंच सकता है।EntitlementGrantResponse पेलोड साझा करती हैं।
घटना ट्रिगर
entitlement_grant.created
एक grant row insert की गई। इस बिंदु के बाद grant में हमेशा एक स्थिरid होता है, भले ही इसका status बदल जाए। Fulfillment की प्रक्रिया जारी है, यह रिकॉर्ड करने के लिए इस event का उपयोग करें।
auto-fulfilled license keys और feature flags के लिए 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-आधारित integrations (Discord, GitHub, Notion) एक
oauth_urlका उपयोग करते हैं, जिसे consent पूरा करने के लिए customer को खोलना होता है। Dodo Payments grant बनने पर इसे बनाने का प्रयास करता है, इसलिएentitlement_grant.createdमें यह शामिल हो सकता है; यदि यहnullहै, तो customer के Customer Portal से accept flow शुरू करने पर इसे भरा जाता है। Customer द्वारा authorize किए जाने तक grantPendingरहता है। - Platform-direct integrations (Telegram, Framer, Digital Files) केवल थोड़े समय के लिए
Pendingमें रहते हैं, जब तक platform call चलती है, फिरDeliveredमें चले जाते हैं।
entitlement_grant.delivered
grant, सामान्यतःPending से Delivered में परिवर्तित हुई। अब customer के पास entitlement में वर्णित access है। अपने systems में dependent features को unlock करने के लिए इस event का उपयोग करें, जैसे workspace provision करना, custom welcome email भेजना या “fulfilled” flag को mark करना।
payload का delivered_at field यह दर्ज करता है कि delivery कब पूरी हुई। जब भी किसी मौजूदा grant का status बदलकर Delivered होता है, तब delivered fire होता है: Pending से, जब विफल OAuth grant बाद में सफल हो जाती है, या जब revoked grant restore की जाती है। Creation के समय ही Delivered status वाली grant, जैसे auto-fulfilled license key, केवल created fire करती है।
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 में नहीं।
सैंपल पेलोड्स
License Key Delivered (entitlement_grant.delivered)
License Key Pending Manual Fulfillment (entitlement_grant.created)
यह तब fire होता है जब कोई customer ऐसा product खरीदता है जिसकी License Key entitlement में fulfillment_mode: manual का उपयोग किया गया हो। grant Pending होती है और इसमें अभी कोई license_key object नहीं होता — merchant को key supply करनी होगी।
Digital Files Delivered (entitlement_grant.delivered)
Discord Role Created and Pending (entitlement_grant.created)
Grant Revoked on Subscription Cancellation (entitlement_grant.revoked)
Delivery Failed (entitlement_grant.failed)
इंटीग्रेशन टिप्स
- जब कोई grant
Deliveredतक पहुँच जाए, तो उस पर निर्भर features को unlock करें। एकpayment.succeededevent आपको बताता है कि payment clear हो गया है; यह नहीं बताता कि customer के पास अभी GitHub repo या Discord role है।entitlement_grant.deliveredको handle करें, और साथ हीentitlement_grant.createdकोstatus: "Delivered"के साथ handle करें, क्योंकि creation पर deliver होने वाला grant कोईdeliveredevent नहीं भेजता। revocation_reasonको retention flows से map करें।subscription_on_holdrevoke का आमतौर पर अर्थ है कि customer का card fail हो गया है और अगला renewal access को फिर से grant करेगा।manualयाsubscription_cancelledrevoke जानबूझकर किया गया है। Customer messaging में इनके साथ अलग-अलग व्यवहार करें।- Grant
idके बजायwebhook-idheader से duplicates का पता लगाएँ। एक grantcreatedकेवल एक बार emit करता है, लेकिनdeliveredऔरrevokedमें से प्रत्येक एक से अधिक बार fire हो सकता है, क्योंकि revoked grant को restore करके फिर से revoke किया जा सकता है।failedभी हमेशा अंतिम नहीं होता: failed OAuth grant को फिर भी deliver किया जा सकता है। Webhook system से होने वाली re-deliveries भी किसी event को दोहरा सकती हैं।webhook-idके आधार पर repeats को skip करें, और अपने grant records की key grantidपर रखें। - Grant type पहचानने के लिए
integration_typeपढ़ें। Payload मेंintegration_typeसीधे मौजूद होता है (उदाहरण के लिएlicense_key,digital_files,discord)।license_keyऔरdigital_product_deliverynested objects अपने-अपने grants deliver होने के बाद populate होते हैं; manually-fulfilled license-key grantPendingही रहता है, जिसमेंintegration_type: "license_key"और एकnulllicense_keyहोता है, जब तक आप उसे fulfill नहीं करते। - OAuth-आधारित grants के लिए
oauth_urlcustomer को दिखाएँ। Discord, GitHub या Notion subscriber flows के लिएentitlement_grant.createdevent मेंoauth_urlऔरoauth_expires_atशामिल हो सकते हैं। यदि यहnullहै, तो बाद के event की प्रतीक्षा करें या customer को Customer Portal पर भेजें। Delivery को unblock करने के लिए URL 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.