advanced_reports जैसा flag attach करें, और प्रत्येक paying customer को एक grant मिलता है जिसे आपका application API के माध्यम से check कर सकता है या webhooks के साथ sync में रख सकता है। किसी external platform, OAuth या delivery step की आवश्यकता नहीं है — grant स्वयं capability है।क्या deliver होता है
Dodo Payments से कुछ भी बाहर नहीं जाता — grant ही deliverable है:- खरीदारी पर grant बनाया जाता है और सीधे
Deliveredपर चला जाता है। कोईPendingचरण नहीं होता, customer की ओर से कोई कार्रवाई नहीं करनी पड़ती और delivery के विफल होने की कोई संभावना नहीं होती। - grant में typed
featurepayload होता है:{ "feature_type": "boolean", "feature_id": "advanced_reports" }। क्या unlock करना है, यह तय करने के लिए आपका applicationfeature_idपढ़ता है। - Cancellation, refund या manual revoke grant को
Revokedपर ले जाता है और आपका application flag के हटने को देखता है।
feature_id merchant द्वारा चुना गया identifier है और entitlements में unique नहीं होता। दो entitlements एक ही feature_id प्रदान कर सकते हैं — उदाहरण के लिए, monthly और yearly Pro plan दोनों advanced_reports प्रदान कर सकते हैं।Feature flag बनाएं
Open Entitlements
Name the flag

Creating a feature flag. The Feature ID is what your application checks; Meta Data attaches limits alongside the flag.
Optionally add metadata
Confirm

The created feature flag. The right pane tracks every customer grant issued from it.
Product से attach करें
किसी product को खोलें (या नया बनाएं), Entitlements card खोजें और मौजूदा entitlements attach करने के लिए + पर click करें। अपना feature flag चुनें और Done पर click करें।
Attaching the feature flag to a product. One product can deliver multiple entitlements.

The product now includes the feature flag. Every successful purchase or active subscription grants it.
आवश्यक configuration
API के माध्यम से बनाएं
Metadata के साथ limits attach करें
Boolean flag इस प्रश्न का उत्तर देता है: “क्या इस customer के पास feature है?” Metadata बताता है: “किस configuration के साथ?” Entitlement metadata string, integer, number और boolean values स्वीकार करता है, और प्रत्येक grant बनने के समय entitlement के metadata का एक frozen snapshot लेता है। यही snapshot behavior metadata को plan limits के लिए सुरक्षित बनाता है:- बाद में entitlement का metadata edit करने पर केवल future grants प्रभावित होते हैं। Customers अपने खरीदे गए limits के अनुसार बने रहते हैं।
- Snapshot प्रत्येक grant पर उसके
metadatafield के रूप में लौटाया जाता है, इसलिए एक API call से flag और उसकी configuration दोनों मिलती हैं।
advanced_reports flag के साथ { "tier": "pro", "monthly_report_limit": 100 } होने पर आपका application dashboard unlock करने के साथ 100-report quota भी enforce कर सकता है, बिना किसी दूसरे lookup के। यदि बाद में limit को 250 कर दिया जाए, तो मौजूदा customers 100 पर ही रहेंगे, जब तक उन्हें नया grant न मिले (उदाहरण के लिए, plan change के बाद)।
Customer के features check करें
Customer के delivered feature-flag grants की list बनाएं और enabled features का set तैयार करें। Endpoint सभी entitlements में प्रत्येक grant के लिए एक row लौटाता है, जिसेintegration_type और status से filter किया जा सकता है।
feature payload केवल feature_flag grants पर populated होता है; हर दूसरे integration type के लिए यह null होता है। पूर्ण response shape के लिए List Customer Grants API reference देखें।Lifecycle
Feature flag grants standard grant lifecycle का पालन करते हैं, जिसमें एक सरलीकरण है: delivery step नहीं होता, इसलिए grants कभी भीPending में नहीं रहते और न ही Failed पर जाते हैं।
Webhooks
Polling के बजाय flags को अपने database में mirror करने के लिएentitlement_grant.* events को subscribe करें:
entitlement_grant.created— यह पहले से हीDeliveredऔरfeaturepayload के साथ आता है। Feature enable करें।entitlement_grant.delivered— पहले revoked grant के restore होने पर fire होता है। Feature फिर से enable करें।entitlement_grant.revoked— access वापस ले लिया गया है। Feature disable करें और अपने messaging का निर्णय लेने के लिएrevocation_reasonजाँचें।
entitlement_grant.failed नहीं है — delivery पूरी तरह Dodo Payments के भीतर होती है और fail नहीं हो सकती।
उदाहरण: Pro plan से advanced reports unlock करना
- Flag बनाएँ।
feature_id: advanced_reportsको metadata{ "tier": "pro", "monthly_report_limit": 100 }के साथ बनाएँ। - इसे attach करें अपने Pro Plan subscription product से।
- Customer subscription लेता है। Dodo Payments एक
Deliveredgrant बनाता है औरentitlement_grant.createdfire करता है; आपका webhook handler customer के लिएadvanced_reportsको 100 की limit के साथ enable करता है। - आपका app feature को gate करता है। Dashboard load होने पर cached feature set जाँचें (या
listEntitlementGrantscall करें) और reports tab को तभी render करें जबadvanced_reportsमौजूद हो। - Customer cancel करता है। Dodo Payments grant revoke करता है और
entitlement_grant.revokedfire करता है; आपका handler feature disable करता है। यदि customer बाद में dunning के माध्यम से recover करता है, तोentitlement_grant.deliveredइसे restore कर देता है — code में किसी बदलाव की आवश्यकता नहीं।
Best practices
- Stable, snake_case feature ids का उपयोग करें। आपका application code इन strings की जाँच करता है; किसी id का नाम बदलना दोनों पक्षों पर breaking change है।
- प्रत्येक capability के लिए एक flag रखें। एकल
pro_bundleके बजायadvanced_reports+api_accessको दो entitlements के रूप में प्राथमिकता दें — revocation और plan mixes व्यवस्थित रहते हैं। - State को webhooks से संचालित करें और API से verify करें। Webhooks आपके database को current रखते हैं; list endpoint reconciliation jobs और cache misses के लिए source of truth है।
Revokedको immediate मानें। Revoked flag का अर्थ है कि customer अब feature के लिए भुगतान नहीं कर रहा है। अगली session पर नहीं, बल्कि अगली request पर gate करें।- Limits को code में नहीं, metadata में रखें। Quota बदलने के लिए केवल entitlement को edit करना पड़ेगा — नए customers इसे automatically अपना लेंगे, जबकि existing grants अपने purchased snapshot को बनाए रखेंगे।