advanced_reports जैसा flag attach करें, और प्रत्येक paying customer को एक grant मिलता है जिसे आपका application API के माध्यम से check कर सकता है या webhooks के साथ sync में रख सकता है। किसी external platform, OAuth या delivery step की आवश्यकता नहीं है — grant स्वयं capability है।क्या deliver होता है
Dodo Payments से कुछ भी बाहर नहीं जाता — grant ही deliverable है:- Purchase पर grant बनाया जाता है और सीधे
deliveredमें चला जाता है। कोईpendingphase, customer action या delivery के fail होने की संभावना नहीं होती। - Grant में typed
featurepayload होता है:{ "feature_type": "boolean", "feature_id": "advanced_reports" }। आपका applicationfeature_idपढ़कर तय करता है कि क्या unlock करना है। - 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 का पालन करते हैं, एक simplification के साथ: कोई 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_reasoncheck करें।
entitlement_grant.failed नहीं है — delivery पूरी तरह Dodo Payments के भीतर होती है और fail नहीं हो सकती।
उदाहरण: Pro plan से advanced reports unlock करना
- Flag बनाएं।
feature_id: advanced_reportsको metadata{ "tier": "pro", "monthly_report_limit": 100 }के साथ बनाएं। - इसे अपने Pro Plan subscription product से attach करें।
- Customer subscribe करता है। Dodo Payments एक
deliveredgrant बनाता है औरentitlement_grant.createdfire करता है; आपका webhook handler customer के लिए 100 की limit के साथadvanced_reportsenable करता है। - आपका 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 कर देता है। यदि customer बाद में dunning के माध्यम से recover करता है, तोentitlement_grant.deliveredइसे restore कर देता है — किसी code change की आवश्यकता नहीं।
Best practices
- Stable, snake_case feature ids का उपयोग करें। आपका application code इन strings को check करता है; किसी एक का नाम बदलना दोनों sides पर breaking change है।
- प्रत्येक capability के लिए एक flag रखें। एकल
pro_bundleके बजायadvanced_reports+api_accessको दो entitlements के रूप में रखना बेहतर है — revocation और plan mixes साफ रहते हैं। - State को webhooks से drive करें और API से verify करें। Webhooks आपके database को current रखते हैं; list endpoint reconciliation jobs और cache misses के लिए source of truth है।
revokedको immediate मानें। Revoked flag का अर्थ है कि customer अब feature के लिए pay नहीं कर रहा है। अगले session पर नहीं, अगली request पर gate करें।- Limits को code में नहीं, metadata में रखें। Quota बदलने के लिए केवल entitlement edit करना होगा — नए customers इसे अपने-आप प्राप्त करेंगे, जबकि मौजूदा grants अपना purchased snapshot बनाए रखेंगे।