Unbilled Charges

Unbilled charge is that charge which is held by passing invoice later in the various operations including add charge, create subscription, update subscription, etc. The Unbilled Charge element separates the reation of subscription associated charges from the invoicing them. The creation of any automatic invoice like the activation, renewal, etc., will comprise the unbilled charges.

List Unbilled Charges

List Unbilled Charges limits the number of resources to be returned and allow you to fetch the next set of resources.

Sample Code / Result:
Language
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://apiv1.chargemonk.com/listSubscriptionUnbilledCharges", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array('api_token' => 'test_C8OsiR4B6ZlvSqIKrn3zMA2XwfWkEamH'), )); $response = curl_exec($curl); curl_close($curl); echo $response;
{ "status": "success", "data": [ { "unbilledCode": "ggx9fDhF", "subscriptionCode": "7GabLuca", "description": "September Unbilled Charge", "amount": "50.00", "created_at": 1602672598, "status": "pending", "quantity": 11 } }

List Unbilled attributes

Key R/O Description
api_token required Token generated by ChargeMonk.
string
limit optional Limits the number of records to be shown.
integer,  default=25
search_value optional Description
string
order_by optional Display records in ascending or descending order.
asc,desc,  default=desc
order_param optional You can sort createdAt or Updated alone as well as with order_by field.
eg : order_param = created_at, order_by = desc
created_at,amount,  default=created_at
subscription_code optional Subscription code of the merchant.
string
customer_phone required Phone number of the customer.
integer,  6 digits - 15 digits
created_at optional To filter based on Subscription Created at.
eg. filter[created_at][less_than] = [1589796315]
is,is_not,less_than,less_than_equal,greater_than,greater_than_equal,between
integer,  default=1
amount optional Total amount of the invoice.
eg. filter[amount][is] = 100
is,is_not,less_than,less_than_equal,greater_than,greater_than_equal,between
integer
filter[match] optional 'All' will take 'AND' whereas 'ANY' will take 'OR' as condition.
eg. filter[match]= ALL, filter[created_at][is] = 1589796315, filter[amount][is] = [22] Will be read as Filter if the filed has created_at like ""1589796315"" OR amount is [22].
ANY,ALL,  default=USD

Add Unbilled Charges

A charge can be added in the unbilled charge list through the Web Interface and API. As the configuration allows, a charge can be add as the unbilled charge via web interface by the steps including creating a subscription, updating subscription, re-activating a subscription, adding a one-time charge to a subscription and charging next billing. By the API a charge can be added in the unbilled charge by creating actual charge and estimating charge without creating them.

Sample Code / Result:
Language
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://apiv1.chargeMonk.com/addSubscriptionUnbilledCharges", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array('api_token' => 'test_C8OsiR4B6ZlvSqIKrn3zMA2XwfWkEamH','description' => 'September Ubilled Charge','subscription_code' => '7GabLuca','amount' => '50','quantity' => '11'), )); $response = curl_exec($curl); curl_close($curl); echo $response;
{ "status": "success", "message": "Added to unbilled charges." }

Add Unbilled attributes

Key R/O Description
api_token required Token generated by ChargeMonk.
string
amount required Total amount of the unbilled charges.
integer
description required Description of the unbilled charges.
string
subscription_code required Subscription code of the merchant.
string
quantity required Quantity of the unbilled charges.
integer

Delete Unbilled Charges

An unbilled charge can be deleted via API by specifying the id of the charge.

Sample Code / Result:
Language
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://apiv1.chargeMonk.com/deleteSubscriptionUnbilledCharges", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array('api_token' => 'test_C8OsiR4B6ZlvSqIKrn3zMA2XwfWkEamH','unbilledCode' => 'rXdeoU06'), )); $response = curl_exec($curl); curl_close($curl); echo $response;
{ "status": "success", "message": "Deleted unbilled charges." }

Delete Unbilled attributes

Key R/O Description
api_token required Token generated by ChargeMonk.
string
unbilledCode required Unbilled Code of the merchant.
string