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.
Header parameters
X-Mantle-App-Id
stringThe App Id when you create an API key in your Mantle dashboard.
X-Mantle-Customer-Api-Token
stringThe API token you receive from your POST request to the /identify endpoint.
Attributes
id
stringUnique identifier for the usage credit.
name
stringPublic name of the usage credit.
amount
decimalThe amount of the usage credit.
balance
decimalThe remaining balance of the usage credit.
currencyCode
stringThe currency code of the usage credit.
expiresAt
dateThe date the usage credit will expire.
createdAt
dateThe date the usage credit was created.
updatedAt
dateThe 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-Id
stringThe App Id when you create an API key in your Mantle dashboard.
X-Mantle-Customer-Api-Token
stringThe API token you receive from your POST request to the /identify endpoint.
Body parameters
name
stringPublic name of the usage credit.
description
stringA human-readable description of the usage credit.
amount
decimalThe amount of the usage credit.
expiresAt
dateThe 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.