The Credit Data API allows you to retrieve information about a site's word credits. When a Wix user installs the Wix Multilingual app on their site, the site receives a free word credit quota. These credits are consumed when the Machine Translation API translates text from one language to another, with each credit representing 1 word translated.
With the Credit Data API, you can:
It's important to note the following points before starting to code:
This article presents some possible use cases you can support. This can be a helpful jumping off point as you plan your implementation.
You can check whether a site has enough credits before initiating the machine translation process.
Calculate the total number of words that need to be translated.
Call Check Sufficient Credits and specify the word count to determine whether the site has enough credits for the translation.
If there are sufficient credits, use the Machine Translation API to translate the content. If not, the Wix user needs to purchase additional credits in the Translation Manager.
You can create a dashboard that displays the credit quota, usage, and remaining credits for multiple sites.
For each site, periodically call Get Credit Data to obtain the quota type, quota amount, and the number of credits used at a given time.
For sites with a limited quota, calculate the remaining credits by subtracting the used credits from the quota.
Display this data in your dashboard and a notification system to alert Wix users when their site's credit balance is running low.
Total number of word credits consumed by a site. For sites with an unlimited word credit quota, this property still reflects the number of credits used, even though no usage limit applies.
Quota type.
Limited word credit quota.
{
"creditData": {
"creditsUsed": 100,
"quotaType": "LIMITED",
"limitedQuota": {
"quota": 3000
}
}
}