What is Credit Deduction?
If you have a credits management system on your website and want your users to buy credits to use AtomChat's features, you can use our Credit Deduction feature!
We basically deduct credits when your users use a particular feature. If a user runs out of credits, then they will no longer be able to use that feature (until they add more credits).
This feature is ideal when you would like to charge for using certain features. Credit Deduction can be configured for text chat, audio calling and audio+video calling.
The Credits APIs will facilitate you to check credits, deduct credits and update credits.
Let's dive in!
Update Credits
POST - https://api.cometondemand.net/api/v2/updateCredits
curl --request POST \ --url https://api.cometondemand.net/api/v2/updateCredits \ --header 'Accept: application/json' \ --header 'Content-Type: application/x-www-form-urlencoded'
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.cometondemand.net/api/v2/updateCredits", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => [ "Accept: application/json", "Content-Type: application/x-www-form-urlencoded" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Get Credits
GET - https://api.cometondemand.net/api/v2/getCredits
curl --request POST \ --url https://api.cometondemand.net/api/v2/getCredits \ --header 'Accept: application/json' \ --header 'Content-Type: application/x-www-form-urlencoded'
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.cometondemand.net/api/v2/getCredits", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => [ "Accept: application/json", "Content-Type: application/x-www-form-urlencoded" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Get Deduction History
GET - https://api.cometondemand.net/api/v2/getCreditDeductionHistory
curl --request POST \ --url https://api.cometondemand.net/api/v2/getCreditDeductionHistory \ --header 'Accept: application/json' \ --header 'Content-Type: application/x-www-form-urlencoded'
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.cometondemand.net/api/v2/getCreditDeductionHistory", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => [ "Accept: application/json", "Content-Type: application/x-www-form-urlencoded" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article