PT EN

Créditos

URL base: $CONSUMER_API

Obter o saldo de créditos

Registos

GET /credits

Returns the credit balance of an account linked to the caller, with its credit grants such as promotional credit. Returns 403 when the given account is not one the caller can access and 404 when the caller has no linked account.

Parâmetros

account_idstring · consulta · opcional

Account whose credit balance is returned; when omitted, the first account in the caller's scope is used.

Devolve

200 Account credit balance summary

curl -X GET "$CONSUMER_API/credits" \
  -H "Authorization: Bearer sk_test_..."
Resposta 200

Account credit balance summary

Usar um código promocional

Registos

POST /credits/redeem

Redeems a promotion code for an account linked to the caller, creating a credit grant from the campaign's amount, charge kinds and expiry and applying it to the account's open invoices. account_id and code are required. Returns 409 when the campaign is not active, has not started or has ended, or after 5 attempts per minute for the same account; returns 403 when the account is outside the caller's scope.

Devolve

201 Promotional credit granted

curl -X POST "$CONSUMER_API/credits/redeem" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{}'
Resposta 201

Promotional credit granted