comecerodocs

Add prepaid credit

POST
/usage/entitlements/{entitlement_id}/credits

Adds credit to a credit entitlement. The same idempotency_key adds it once; with another amount it answers 409. Secret and trusted tokens may call it; a limited token may not (403).

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Path Parameters

entitlement_id*string

A credit entitlement id.

Request Body

The credit to add.

application/json
  1. body
amount*number

More than 0, at most 1,000,000,000, at most 6 decimals. In the agreement's currency.

idempotency_key*string

1 to 100 of A-Z a-z 0-9 _ . : -. The same key adds the credit once.

description?string

Up to 200 characters.

Response Body

Success.

application/json
  1. response
entitlement_id?string

The credit entitlement.

added?boolean

false when this key was already used for the same amount: nothing more was added.

balance?number

The balance after this request.

Example Request
curl -X POST 'https://api.comecero.com/api/v1/usage/entitlements/string/credits' \  -H 'Content-Type: application/json' \  -d '{  "amount": 50,  "idempotency_key": "welcome-credit-cust_8412",  "description": "Welcome credit"}'
Example Response
{  "entitlement_id": "credit_cust_8412",  "added": true,  "balance": 50}