API reference
CaaS API
CaaS API allows to monetize your app with micro-payments. You can retrieve the account balance and other related information of a given subscriber, charge specific amount from a subscriber's account etc.
- Base URL
- https://api.mspace.lk
- Content type
- application/json;charset=utf-8
- Endpoints
- 3
OTP Generation
https://api.mspace.lk/caas/direct/debitThis service is used by the developer to initiate a one time charging for the subscriber on his/her mobile account. Upon the request, Applink will generate and send an OTP to the subscriber's MSISDN. This OTP must be entered by the subscriber into the mobile/web application to authorize the one time charge.
Request bodyapplication/json;charset=utf-8
applicationIdstringRequiredUsed to identify the application. This is a unique identifier generated while provisioning an application.
Only a single value can be sent per request.
Example:APP_000XXXpasswordstringRequiredThis API key will be sent to your registered email address on the platform upon application approval.
Example:a07118cda5215fc6d01db5b2ab848eddexternalTrxIdstringRequiredThis is the transaction ID generated by the application to map the request with the response. This is needed to provide information when there are inquiries related to a transaction.
Only a single value can be sent per request.
Example:256091232subscriberIdstringRequiredThis is the MSISDN of the subscriber to be charged. This is a unique identifier. Eg: tel: 8801975355595 Note: This can be a masked number depending on the type of the application.
Only a single value can be sent per request.
Example:tel:8801973579363paymentInstrumentNamestringRequiredThe name of the payment instrument.
Only a single value can be sent per request.
Enum:Mobile AccountExample:Mobile AccountamountstringRequiredAmount to be reserved for charging.
Only a single value can be sent per request.
Example:5.00CurrencystringRequiredCurrency unit of the amount.
Only a single value can be sent per request.
Only 'BDT' is allowed.
Example:BDTapplicationHashstringOptionalA unique hash value generated by the SP application to ensure request integrity and authenticity. This value shall be generated using a mutually agreed hashing algorithm (e.g., SHA-256) based on agreed request parameters.
Only a single value can be sent per request.
Example:a7f5f354
{
"applicationId": "APP_000XXX",
"password": "a07118cda5215fc6d01db5b2ab848edd",
"externalTrxId": "256091232",
"subscriberId": "tel:8801973579363",
"paymentInstrumentName": "Mobile Account",
"amount": "5.00",
"Currency": "BDT",
"applicationHash": "a7f5f354"
}Response200 successapplication/json;charset=utf-8
timeStampstringRequiredThe time that the request was sent
Example:2023-11-08T08:02:16.913ZexternalTrxIdstringRequiredThis is the transaction ID generated by the application to map the request with the response.
Only a single value can be sent per request.
Example:256091232statusDetailstringRequiredDetailed description explaining the status of the entire request
Example:Request successfully proceed. OTP will send to user.requestCorrelatorstringRequiredThe unique identifier used internally within the system to identify the transaction
Example:8801442233146169943053700500040internalTrxIdstringRequiredThe transaction ID generated by the service provider which can be used to track the transaction
Example:9110808020001876statusCodestringRequiredThis code will show the status of the request.
This code will show the status of the request. If the code is in the format for “E1xxx”
P1003: Successfully sent OTP to user.
E1300: Unknown/unclassified error
E1301: Requested ApplicationID is not allowed within the System for operator
E1302: Requested SP is not allowed within the System
E1303: IP address, which the request originates from, is not listed within the allowed-host-address list.
E1312: Invalid request
E1313: Authentication failure
E1315: NCS system unavailable
E1316: Connection to app refused
E1325: Format of the address is invalid
E1329: Charging amount too high
E1330: Charging amount too low
E1342: Your phone number is blacklisted to use this application
E1343: Non white listed mobile number accessing services of application cloud.
E1371: App does not accept payments from given Payment Instrument
E1601: An unexpected error has occurred
E1603: Temporary system error
E1604: Endpoint configuration missing
E1607: Unable to read application response
E1608: SLA configuration error
E1852: Maximum number of OTP attempts had reached
Enum:P1003E1300E1301E1302E1303E1312E1313E1315E1316E1325E1329E1330E1342E1343E1371E1601E1603E1604E1607E1608E1852Example:P1003
{
"timeStamp": "2023-11-08T08:02:16.913Z",
"externalTrxId": "256091232",
"statusDetail": "Request successfully proceed. OTP will send to user.",
"requestCorrelator": "8801442233146169943053700500040",
"internalTrxId": "9110808020001876",
"statusCode": "P1003"
}Code samples (Java, PHP, javaScript, .net): coming soon
OTP Verification
https://api.mspace.lk/caas/otp/verifyThis service is used by the developer to verify an OTP entered by a subscriber into the application. Upon a successful verification, one time charging will be deducted from the subscriber's mobile account.
Request bodyapplication/json;charset=utf-8
applicationIdstringRequiredUsed to identify the application. This is a unique identifier generated while provisioning an application.
Only a single value can be sent per request.
Example:APP_000XXXpasswordstringRequiredThis API key will be sent to your registered email address on the platform upon application approval.
Example:Your API KeyreferenceNostringRequiredThe value returned for parameter 'requestCorrelator' in the response of the CaaS OTP generation request must be used here as the reference of the transaction.
Example:8801442233146169943053700500040otpstringRequiredSpecify the OTP entered by the subscriber on the developer application.
Example:xxxxxxsourceAddressstringRequiredSource Address shows the MSISDN that requested the OTP.
Example:tel:8801973579363
{
"applicationId": "APP_000XXX",
"password": "Your API Key",
"referenceNo": "8801442233146169943053700500040",
"otp": "xxxxxx",
"sourceAddress": "tel:8801973579363"
}Response200 successapplication/json;charset=utf-8
statusCodestringRequiredThe status code shows the status of the request. If the code starts with a:
S1000: Request was successfully processed
E1850: Invalid OTP
E1852: Maximum number of OTP attempts had reached
E1854: Could not find OTP
E1855: Invalid OTP Reference Number
E1856: Invalid Request
E1337: Subscriber authentication failed
Enum:S1000E1850E1852E1854E1855E1856E1337Example:S1000statusDescriptionstringRequiredHuman-readable description of the outcome.
Example:Request was successfully processedstatusbooleanRequiredtrue if OTP was valid and charging proceeded; false otherwise.
Example:true
{
"applicationId": "APP_000XXX",
"password": "Your API Key",
"referenceNo": "8801442233146169943053700500040",
"otp": "xxxxxx",
"sourceAddress": "tel:8801973579363"
}Code samples (Java, PHP, javaScript, .net): coming soon
Charging Notification
https://api.mspace.lk/caas/charger/notification/callbackCharging notification is returned to the developer application upon a charging attempt. It will denote whether the charging is successful or not. Charging notification is returned to the endpoint you have configured under the 'charging notification URL' section in CaaS API when creating the application.
Request Body schema: application/json;charset=utf-8 There is no request to be triggered in order to obtain this charging notification. It will be automatically returned as a callback to the initial charging request once the transaction is completed within the system. (chargingNotificatio)
Response200 successapplication/json;charset=utf-8
timeStampstring <date-time>RequiredThe time which the request was sent.
Example:2025-10-02T14:59:00+05:30versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc. If version is specified in the request, same version must be sent in the response. If version is not specified in the request, the latest version will be specified in the response.
Example:1.0externalTrxIdstringRequiredThis is the transaction ID generated by the application to map the request with the response. This is needed to provide information when there are inquiries related to a transaction. Only a single value can be sent per request.
Example:256091234internalTrxIdstringRequiredThe unique identifier used to track the request at the developer application end.
Example:125100214570415referenceIdstringRequiredThe unique reference used to identify the transaction within the system
Example:12526currencystringRequiredCurrency unit of the amount. Only 'LKR' is allowed.
Example:LKRTotalAmountstringRequiredAmount deducted from the subscriber as the one time charge.
Example:5.00paidAmountstringRequiredThe amount that is paid by the subscriber.
Example:5.00balanceDuestringRequiredThe amount that is due will be displayed if there is any, if not it will show 0.
Example:0.00statusCodestringRequiredThis code will show the status of the request.
S1000: Request was Successfully processed, Due amount fully paid
E1404: Charging request failed
E1405: Charging request timed out, No payments done
E1852: Maximum number of OTP attempts had reached
E1854: Could not find OTP
E1855: Invalid OTP Reference Number
E1856: OTP Not Found
E1857: Invalid Reference Number
Enum:S1000E1404E1405E1852E1854E1855E1856E1857Example:S1000statusDetailstringRequiredDetailed description explaining the status of the entire request
Example:Request was Successfully processed, Due amount fully paid.
{
"timeStamp": "15-Nov-2026 11:55",
"TotalAmount": "5.00",
"externalTrxId": "256091234",
"balanceDue": "0",
"statusDetail": "Request was Successfully processed, Due amount fully paid.",
"currency": "LKR",
"version": "1.0",
"internalTrxId": "9111511550014764",
"paidAmount": "5.00",
"referenceId": "8801422222550170004932307900016",
"statusCode": "S1000"
}