BillRun has real-time module (AKA OCS: Online Charging System), which enable triggering real-time events and response accordingly.
In order to use real-time events, need to first create a new input processor of type "API-based".
Real-time events can be used either for Prepaid or Postpaid cases.
Triggering real-time event is done by sending an HTTP request to the following URL:
http://[HOST]/realtime?file_type=[INPUT_PROCESSOR_NAME]&request=[REQUEST_JSON_DATA]
- INPUT_PROCESSOR_NAME - the name configured when creating the input processor
- REQUEST_JSON_DATA - a JSON with all fields configured when creating the input processor
Authentication for the request is required
Real-time response is configurable JSON object.
The default response contains the following fields:
- sid - subscriber's ID in the billing system
- returnCode - result code:
- 1 - success
- -1 - no balances found
- -2 - no customer found
- -3 - failed to find product
- -4 - failed to price
- sessionId - unique identifier of the current session (used in prepaid sessions)
- grantedVolume - granted volume given to the subscriber (useful in prepaid cases)
- requestNum - request number in the current session
- requestType - type of the request:
- 1 - initial request (prepaid)
- 2 - update request (prepaid)
- 3 - final request (prepaid)
- 4 - postpaid request