Docs API reference Usage credits

Usage credits

Apply usage credits to your customer’s account so they can leverage metered billing without incurring additional costs.

POST   https://appapi.heymantle.com/v1/usage_credits

The Usage Credit object

Leverage usage credits to reward loyal customers or to help prevent churn.

Attributes

idstring

Unique identifier for the usage credit.

namestring

Public name of the usage credit.

amountdecimal

The amount of the usage credit.

balancedecimal

The remaining balance of the usage credit.

currencyCodestring

The currency code of the usage credit.

expiresAtdate

The date the usage credit will expire.

createdAtdate

The date the usage credit was created.

updatedAtdate

The date the usage credit was last updated.

{
  "usageCredit": {
    "id": "d290f1ee-6c54-4b01-90e6-d701748f0123",
    "name": "Loyalty reward",
    "description": "A loyalty reward for being a customer for over 5 years.",
    "amount": 100.00,
    "balance": 80.00,
    "currencyCode": "USD",
    "expiresAt": "2024-12-31T23:59:59Z",
    "createdAt": "2024-12-31T23:59:59Z",
    "updatedAt": "2024-12-31T23:59:59Z"
  }
}


POST /v1/usage_credits

Create a Usage Credit for a customer.

Header parameters

X-Mantle-App-Idstring

The App Id when you create an API key in your Mantle dashboard.

X-Mantle-Customer-Api-Tokenstring

The API token you receive from your POST request to the /identify endpoint.

Body parameters

namestring

Public name of the usage credit.

descriptionstring

A human-readable description of the usage credit.

amountdecimal

The amount of the usage credit.

expiresAtdate

The date the usage credit will expire.

curl --request POST \
  --url https://appapi.heymantle.com/v1/usage_credits \
  --header 'X-Mantle-App-Id: string' \
  --header 'X-Mantle-Customer-Api-Token: string' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Loyalty reward",
  "description": "A loyalty reward for being a customer for over 5 years.",
  "amount": 100.00,
  "expiresAt": "2024-12-31T23:59:59Z"
}
'

Returns the created Usage Credit object.