1
Check the credit entitlement
Pass the expected cost as
requestedUsage. hasAccess is true when the remaining balance covers it, or when the currency has a soft limit.2
Deduct credits
Run the operation and calculate the number of credits it consumed, then deduct them. Use
consumeCredits for strict, real-time enforcement (when synchronous credit consumption is enabled, the response includes the optimistic balance in credit), or consumeCreditsAsync for high-volume, eventually consistent consumption.