Check & Deduct Credits
Checkout & Credits
Check & Deduct Credits
POST
Check & Deduct Credits
Atomically check if a customer has sufficient credit balance and deduct in a single database transaction. Uses row-level locking to prevent race conditions under concurrent requests.
Auth:
sk_ only
External customer ID
Feature being consumed
Number of credits to deduct (must be positive)
Whether sufficient balance existed to fulfill the deduction
Credit balance after deduction (or unchanged balance if denied)
When
allowed is false, no credits are deducted. The remaining field returns the current balance as-is.