advanced_reports जैसे flag को किसी product से attach करें, और हर paying customer को एक grant मिलता है जिसे आपका application API के ज़रिए check करता है या webhooks के साथ sync रखता है। किसी external platform, OAuth step या delivery step की आवश्यकता नहीं है: grant स्वयं capability है।क्या deliver होता है
Dodo Payments से कुछ भी बाहर नहीं जाता। Grant ही deliverable है:- Purchase पर, Dodo Payments सीधे
Deliveredमें grant बनाता है। यह कभीPendingमें नहीं जाता, customer की किसी action की आवश्यकता नहीं होती और ऐसा कोई delivery step नहीं होता जो fail हो सके। - Grant में typed
featurepayload होता है:{ "feature_type": "boolean", "feature_id": "advanced_reports" }। आपका applicationfeature_idको पढ़कर तय करता है कि क्या unlock करना है। - Cancellation, refund या manual revoke grant को
Revokedमें ले जाता है और customer के delivered grants से flag हट जाता है।
feature_id एक identifier है जिसे आप चुनते हैं, और यह entitlements के बीच unique नहीं होता। दो entitlements एक ही feature_id दे सकते हैं, जैसे monthly और yearly Pro plan, जो दोनों advanced_reports grant करते हैं।Feature Flag बनाएं
Open Entitlements
Name the Flag
api_access बन जाता है), और आप इसे edit कर सकते हैं। इसमें spaces नहीं हो सकते।
Creating a feature flag. The Feature ID is what your application checks; Meta Data attaches limits alongside the flag.
Add Metadata (Optional)
Confirm

The created feature flag. The right pane tracks every customer grant issued from it.
Product से attach करें
किसी product को खोलें या नया product बनाएं और Entitlements card खोजें। Existing 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 में grant बनाए जाने के समय entitlement के metadata का एक frozen snapshot होता है। यह snapshot metadata को plan limits के लिए सुरक्षित बनाता है:- बाद में entitlement का metadata edit करने से केवल future grants प्रभावित होते हैं। Customers के पास वही limits रहती हैं जिनके अंतर्गत उन्होंने purchase किया था।
- हर grant अपना snapshot
metadatafield में लौटाता है, इसलिए एक API call से आपको flag और उसका configuration दोनों मिल जाते हैं।
{ "tier": "pro", "monthly_report_limit": 100 } के साथ advanced_reports flag आपके application को dashboard unlock करने और 100-report quota लागू करने देता है, बिना किसी दूसरी lookup के। यदि आप बाद में limit बढ़ाकर 250 कर देते हैं, तो existing customers 100 पर ही रहते हैं, जब तक उन्हें नया grant न मिले, जैसे plan change के बाद।
Customer के Features check करें
किसी customer के पास मौजूद features का set बनाने के लिए, उसके delivered feature flag grants की list बनाएं। Endpoint सभी entitlements में प्रत्येक grant के लिए एक row लौटाता है, और आप इसेintegration_type और status से filter कर सकते हैं। इन examples में Create via API का client उपयोग किया गया है।
feature payload केवल feature_flag grants पर populated होता है। हर दूसरे integration type के लिए यह null होता है। पूर्ण response shape के लिए List Customer Grants API reference देखें।Lifecycle
Feature flag grants standard grant lifecycle का पालन करते हैं, एक simplification के साथ: कोई delivery step नहीं है, इसलिए grants कभीPending में नहीं रुकते और कभी Failed में नहीं जाते।
Webhooks
Polling के बजाय अपने database में flags mirror करने के लिए,entitlement_grant.* events को subscribe करें:
entitlement_grant.createdपहले से हीDeliveredमें आता है और इसमेंfeaturepayload होता है। Feature enable करें।entitlement_grant.deliveredतब fire होता है जब पहले revoked grant restore किया जाता है। Feature को फिर से enable करें।entitlement_grant.revokedका अर्थ है कि access वापस ले लिया गया है। Feature disable करें और अपना messaging चुनने के लिएrevocation_reasoncheck करें।
entitlement_grant.failed fire नहीं करते, क्योंकि delivery पूरी तरह Dodo Payments के अंदर होती है।
Example: Pro Plan से Advanced Reports Unlock करना
- Flag बनाएं।
feature_id: advanced_reportsको metadata{ "tier": "pro", "monthly_report_limit": 100 }के साथ set करें। - इसे attach करें अपने Pro Plan subscription product से।
- एक customer subscribe करता है। Dodo Payments
Deliveredgrant बनाता है औरentitlement_grant.createdfire करता है। आपका webhook handler customer के लिएadvanced_reportsenable करता है, जिसकी limit 100 है। - आपका app feature को gate करता है। Dashboard load होने पर cached feature set check करें (या
listEntitlementGrantscall करें) और reports tab को तभी render करें जबadvanced_reportsमौजूद हो। - Customer cancel करता है। Dodo Payments grant revoke करता है और
entitlement_grant.revokedfire करता है, और आपका handler feature disable कर देता है। यदि subscription बाद में dunning के ज़रिए recover होती है, तोentitlement_grant.deliveredबिना किसी code changes के feature restore करता है।
Best Practices
snake_caseमें stable feature IDs का उपयोग करें। आपका application code इन strings को check करता है, इसलिए किसी एक का नाम बदलना दोनों sides पर breaking change है।- हर capability के लिए एक flag का उपयोग करें। एक single
pro_bundleके बजायadvanced_reportsऔरapi_accessको दो entitlements के रूप में रखना बेहतर है, ताकि revocation और plan combinations साफ रहें। - State को webhooks से drive करें और API से verify करें। Webhooks आपके database को current रखते हैं। List endpoint reconciliation jobs और cache misses के लिए source of truth है।
Revokedको immediate मानें। Revoked flag का अर्थ है कि customer अब feature के लिए pay नहीं करता। अगली request पर gate करें, अगली session पर नहीं।- Limits को code में नहीं, metadata में रखें। Quota बदलने के लिए केवल entitlement edit करना होगा। नए customers को नई value मिलेगी और existing grants अपना purchased snapshot बनाए रखेंगे।