Charge subscriber’s account

This POST operation charges a subscriber’s account based on the supplied rating parameters in the JSON payload. If successful, you receive a returnCode or 0 in the JSON response.

POST /crs-api/processRating + JSON request payload


HEADER INFO

authorisation: HTTP Basic Auth

tenant: <tenantName>

content-type: application/JSON

accept: application/JSON

By default, accept is XML. You must explicitly set accept in your header to application/JSON to receive a JSON response.

JSON request payload

The request payload should contain several important items including the subscriber’s msisdn, ratingParams, the database lookup parameters, and any preRating information.

The preRating information is not required.
{
    "msisdn": "08712345",
    "ratingParams": {
        "msisdn": "08712345",
        "operationId": "JG123456",
        "contentId": "001",
        "contentDescription": "PortalSRS",
    "lookup": {
        "providerId": "6010",
        "applicationId": "50000029",
        "serviceId": "30000020",
        "originId": "9"
        "bundleId": "1234"
    },
    "preRating": {
        "totalPrice": "0.2",
        "retailPrice": "0.1",
        "calculatedTax": "0.0",
        "calculatedPromo": "0",
        "downloadFeeWot": "0.1"
        }
    }
}

JSON response

The JSON response contains the return code which is 0 if successful. See the return codes section below for more codes.

{
    "returnCode": 0
}

CRS REST API data type descriptions

CRS API return codes

0

success

The transaction was completed successfully.

1000

insufficient funds

The user did not have enough credit available.

This is applicable to prepaid customers only.

2000

invalid number

The number is invalid or inactive.

2001

invalid parameter

A parameter such as providerId or applicationId was sent incorrectly or does not exist in the system.

2002

general LDAP error

A general LDAP server error not associated with a timeout.

3001

no rating match

The parameters used to describe the rating that charges the user do not correspond to any of the ratings defined in the CRS.

3002

rating error

The rating system experienced an error or unexpected exception. Further detail may be available in the relevant log file.

4000

charging error

The CRS was unable to communicate with the charging/billing system.

4001

unknown error

The CRS encountered an unknown error.

4002

internal timeout

The CRS did not respond within the configured timeout.

4003

LDAP timeout

The SPR did not respond to a request within the configured timeout.

6000

invalid exter parameter string

The Extra Parameter String that was sent is incorrect according to the Extra Parameter XML Definition.

6001

invalid totalPrice parameter

The string parameter totalPrice does not represent a numeric value or is less than 0.

6002

invalid retailPrice parameter

The string parameter retailPrice does not represent a numeric value or is less than 0.

6003

invalid calculatedTax parameter

The string parameter calculatedTax does not represent a numeric value or is less than 0 and not -1.

6004

invalid calculatedPromo parameter

The string parameter calculatedPromo does not represent a numeric value or is less than 0.

6005

invalid downloadFee parameter

The string parameter downloadFee does not represent a numeric value or is less than 0.

6006

invalid region parameter

The string parameter region does not represent a numeric value or is an unexpected value.

6007

invalid profile parameter

The string parameter profile does not represent a numeric value or is an unexpected value.

6008

totalPrice invalid

The string parameter “totalPrice” is not equal to the sum of values.

totalPrice = retailPricecalculatedPromo + calculatedTax + downloadFee (or downloadFeeWot).

6009

missing transport rating ID

Occurs when a Pre‐rated Rating Request with a downloadFee greater than zero does not have a corresponding Transport Rating.

6010

download fee in refund

The “downloadFee” or downloadFeeWot was included in the refund.

6011

refund failed

The attempt to refund the subscriber failed.