Collega il criterio al proxy API utilizzando l'interfaccia utente Apigee o l'API. Per informazioni sulla modifica di un proxy, consulta la sezione
Modifica di un proxy API.
Se non esiste un piano tariffario di monetizzazione per il prodotto API recuperato durante l'esecuzione della chiamata proxy,
il prodotto viene considerato non monetizzato, il criterio MonetizationLimitsCheck non recupera
ulteriori dati e non ha alcun effetto.
Se viene trovato un piano tariffario, ma non un abbonamento per lo sviluppatore API, il criterio
MonetizationLimitsCheck genera un errore e blocca la chiamata API.
Quando colleghi il criterio MonetizationLimitsCheck a un proxy API, le variabili di flusso
mint.limitscheck.* e mint.subscription_* vengono compilate,
come descritto in
Debug del criterio MonetizationLimitsCheck e nel riferimento alla variabile di flusso mint.
Applicare le quote di monetizzazione nei proxy API
Una quota definisce il numero di richieste consentite per un prodotto API in un determinato periodo di tempo. Per
applicare le quote per la monetizzazione, ti consigliamo di impostare il valore della quota durante la
creazione di un prodotto API.
La definizione di un valore di quota per un prodotto API non applica automaticamente restrizioni al numero di chiamate che possono essere effettuate tramite il prodotto API. Devi anche aggiungere criteri di quota ai proxy API a cui fa riferimento il prodotto API per garantire l'applicazione del valore della quota definito a livello di prodotto API.
Modifica i criteri per le quote per attivare l'elemento
<UseQuotaConfigInAPIProduct>
per utilizzare la configurazione delle quote definita a livello di prodotto API.
Quando colleghi la norma Quota a un proxy API, le variabili di flusso ratelimit.* vengono
compilate, come descritto in
Debug della norma Quota
e nel riferimento alle
variabili di flusso
della norma Quota.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-05 UTC."],[[["\u003cp\u003eThis documentation applies to both Apigee and Apigee hybrid platforms, focusing on enforcing monetization limits within these environments.\u003c/p\u003e\n"],["\u003cp\u003eMonetization in Apigee utilizes the VerifyAPIKey or VerifyAccessToken policies to identify if an incoming request is monetizable based on the active published rate plan.\u003c/p\u003e\n"],["\u003cp\u003eThe MonetizationLimitsCheck policy is used to enforce developer subscriptions to API products, triggering a fault and blocking API calls if a subscription is absent.\u003c/p\u003e\n"],["\u003cp\u003eQuota policies can be attached to API proxies to enforce request limits for API products, with the option to configure quotas at the API product level for greater control.\u003c/p\u003e\n"],["\u003cp\u003eThe Quota policy requires the \u003ccode\u003e<UseQuotaConfigInAPIProduct>\u003c/code\u003e element to utilize the defined API product quota configuration, which will take precedence over any other configured values in the Quota policy itself.\u003c/p\u003e\n"]]],[],null,["# Enforce monetization limits in API proxies\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\n\nThis page describes how to enforce monetization limits by attaching policies to API proxies in a\nmonetized API product.\n\nAdd an authentication policy\n----------------------------\n\n\nApigee monetization uses the\n[VerifyAPIKey\npolicy](/apigee/docs/api-platform/reference/policies/verify-api-key-policy) or the\n[VerifyAccessToken operation of the OAuth2 policy](/apigee/docs/api-platform/reference/policies/oauthv2-policy#verifyingaccesstokens) to\ndetermine if an incoming request is monetizable by checking for the active published rate plan.\n\n\nAttach the policy to the API proxy using the Apigee UI or the API. See\n[Editing an API proxy](/apigee/docs/api-platform/develop/ui-edit-proxy) for\ninformation on editing a proxy.\n\n\nSee also:\n\n- [Attaching a policy to a flow](/apigee/docs/api-platform/develop/attaching-and-configuring-policies-management-ui#attaching-a-policy-to-a-flow)\n- [Verifying access tokens](/apigee/docs/api-platform/security/oauth/using-access-tokens)\n- [Monitoring and debugging the authentication policy](/apigee/docs/api-platform/monetization/debug-trace#auth) using Debug\n\nEnforce developer subscriptions on API products\n-----------------------------------------------\n\n\nAttach the\n[MonetizationLimitsCheck policy](/apigee/docs/api-platform/reference/policies/monetization-limits-check-policy) to API proxies to enforce developer subscriptions on\nthe API product:\n\n- If no monetization rate plan exists for the API product fetched during the proxy call execution, the product is deemed non-monetized, the MonetizationLimitsCheck policy does not fetch any further data, and the policy has no effect.\n- If a rate plan is found but a subscription is not found for the API developer, the MonetizationLimitsCheck policy raises a fault and blocks the API call.\n\n\nWhen you attach the MonetizationLimitsCheck policy to an API proxy, the\n`mint.limitscheck.*` and `mint.subscription_*` flow variables are populated,\nas described in\n[Debugging the MonetizationLimitsCheck policy](/apigee/docs/api-platform/monetization/debug-trace#monetizationlimitscheck) and the [mint](/apigee/docs/api-platform/reference/variables-reference#mint) flow variable reference.\n| **Note** : To prevent specific transactions from getting billed, you can use the **transactionSuccess** monetization variable. For more information about using the **transactionSuccess** variable, see [Monetization variables](/apigee/docs/api-platform/reference/policies/data-capture-policy#mint-var).\n\n\nFor more information, see:\n\n- [Creating an API proxy](/apigee/docs/api-platform/develop/ui-create-proxy#apigee-ui)\n- [Editing an API proxy](/apigee/docs/api-platform/develop/ui-edit-proxy)\n- [Attaching a policy to a flow](/apigee/docs/api-platform/develop/attaching-and-configuring-policies-management-ui#attaching-a-policy-to-a-flow)\n- [Debugging the MonetizationLimitsCheck policy](/apigee/docs/api-platform/monetization/debug-trace#monetizationlimitscheck) using Debug\n- [MonetizationLimitsCheck policy](/apigee/docs/api-platform/reference/policies/monetization-limits-check-policy)\n\nEnforce monetization quotas in API proxies\n------------------------------------------\n\n| **Note:** If you add a quota after the API product has been in use, the quota calculation starts from the next monetized transaction.\n\n\nA quota defines the number of requests allowed for an API product over a given time period. To\nenforce quotas for monetization, it is recommended that you set the quota value when\n[creating an API product](/apigee/docs/api-platform/publish/create-api-products).\n\n\nDefining a quota value for an API product does not automatically enforce restrictions on the\nnumber of calls that can be made through the API product. You must also add Quota policies to the\nAPI proxies that are referenced by the API product to ensure the quota value defined at the\nAPI product-level is enforced.\n\n\nEdit the Quota policy to enable the\n[\\\u003cUseQuotaConfigInAPIProduct\\\u003e](/apigee/docs/api-platform/reference/policies/quota-policy#usequotaconfiginapiproduct)\nelement to use the quota configuration defined at the API product-level.\n\nFor example: \n\n```\n\u003cQuota continueOnError=\"false\" enabled=\"true\" name=\"impose-quota\"\u003e\n \u003cDisplayName\u003eImpose Quota\u003c/DisplayName\u003e\n \u003cUseQuotaConfigInAPIProduct stepName=\"verify-api-key\"\u003e\n \u003cDefaultConfig\u003e\n \u003cAllow\u003e10000\u003c/Allow\u003e\n \u003cInterval\u003e1\u003c/Interval\u003e\n \u003cTimeUnit\u003eweek\u003c/TimeUnit\u003e\n \u003c/DefaultConfig\u003e\n \u003c/UseQuotaConfigInAPIProduct\u003e\n \u003cDistributed\u003etrue\u003c/Distributed\u003e\n \u003cSynchronous\u003etrue\u003c/Synchronous\u003e\n \u003cStartTime\u003e2021-01-01 12:00:00\u003c/StartTime\u003e\n\u003c/Quota\u003e\n```\n| **Notes:**\n|\n| - You can define the default configuration `\u003cDefaultConfig\u003e` to use if the quota configuration is not defined in the API product, but the quota configuration defined at the API product-level takes precedence.\n| - When you add the `\u003cUseQuotaConfigInAPIProduct\u003e` element to the Quota policy, then Apigee ignores any `\u003cAllow\u003e`, `\u003cInterval\u003e`, and `\u003cTimeUnit\u003e` child elements of `\u003cQuota\u003e`.\n\n\nWhen you attach the Quota policy to an API proxy, the `ratelimit.*` flow variables are\npopulated, as described in\n[Debugging the Quota policy](/apigee/docs/api-platform/monetization/debug-trace#quota)\nand the Quota policy\n[flow variables](/apigee/docs/api-platform/reference/policies/quota-policy#variables)\nreference.\n\nFor more information, see:\n\n- [Editing an API proxy](/apigee/docs/api-platform/develop/ui-edit-proxy)\n- [Attaching a policy to a flow](/apigee/docs/api-platform/develop/attaching-and-configuring-policies-management-ui#attaching-a-policy-to-a-flow)\n- [Debugging the Quota policy](/apigee/docs/api-platform/monetization/debug-trace#quota) using Debug\n- [Quota policy](/apigee/docs/api-platform/reference/policies/quota-policy)"]]