Commet
  • Precios
Iniciar SesiónRegistrarse
Check usage availability POSTTrack usage event POST
DocumentaciónRecursosConstruir con AIAPI ReferenceWebhooks

Check usage availability

Check if a customer can consume a feature before actual consumption. Returns availability and cost estimates based on the plan's consumption model.

POST
/usage/check

Check if a customer can consume a feature before actual consumption. Returns availability and cost estimates based on the plan's consumption model.

Authorization

ApiKeyAuth
x-api-key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

customerId*string
featureCode*string
quantity*integer

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/usage/check" \  -H "Content-Type: application/json" \  -d '{    "customerId": "string",    "featureCode": "string",    "quantity": 1  }'
{  "success": true,  "data": {    "allowed": true,    "consumptionModel": "string",    "featureCode": "string",    "quantity": -9007199254740991,    "reason": "string",    "message": "string",    "current": 0,    "remaining": 0,    "unlimited": true,    "included": 0,    "overageEnabled": true,    "overageUnitPrice": 0,    "creditsPerUnit": -9007199254740991,    "estimatedCredits": -9007199254740991,    "planCredits": -9007199254740991,    "purchasedCredits": -9007199254740991,    "totalCredits": -9007199254740991,    "unitPrice": 0,    "estimatedAmount": 0,    "currentBalance": 0,    "blockOnExhaustion": true,    "currency": "string",    "object": "usage_check",    "livemode": true  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}

Retry transaction POST

Retry a failed payment transaction. Creates a new invoice and initiates a new payment attempt.

Track usage event POST

Track a usage event for a metered feature. Deducts from balance/credits if applicable.