Credits

Base URL: $CONSUMER_API

Get consumer account credit balance and active grants

Logs

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.

Parameters

account_idstring · query · optional

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

Returns

200 Account credit balance summary

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

Account credit balance summary

Redeem a promotional credit code

Logs

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.

Returns

201 Promotional credit granted

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

Promotional credit granted