Crediting Developer Guide
Overview
This guide is intended for developers who wish to integrate the Charge to Account Gateway with an existing application to make one-off credits.
Crediting allows you to offer monetary credit to pre- and post-pay end users on any UK mobile network. The amount is added to a pre-pay end user's balance or applied to a contract end user's monthly bill.
The gateway allows you to make credits directly to mobile end user accounts in line with the guidelines of the Mobile Crediting scheme. If you are not familiar with Mobile Crediting, please refer to our introduction to the scheme.
In this guide, the term "end user" refers to the mobile phone user who is receiving a credit to their mobile account. The term "content provider" refers to an application which uses the Charge To Account Gateway to credit end users.
Contents
- Integration requirements
- Credit workflow
- Credit request that is immediately successful
- Credit request featuring separate 'Submitted' and 'Confirmed' notifications
- Credit request rejected by Charge to Account Gateway
- Credit request failed by Charge to Account Gateway
- Credit failed by network operator
- Example request
- Example notifications
- API reference
- Pre-paid balance enquiry
- Test accounts
Integration requirements
You can integrate an application with the Charge To Account Gateway using a simple HTTP interface.
The application tells the gateway to initiate a transaction using an HTTPS GET or POST request.
The application must also provide a URL for incoming notifications from the gateway about the status of charges and subscriptions, for example:
http://server.example.com/mxcredit
This URL is specified when your gateway account is set up.
Notifications are made as HTTP or HTTPS GET requests to this URL. The possible parameters are defined by the Notification API.
A URL which supports the API must answer incoming notifications with an HTTP 200 response. It should respond within ten seconds.
Mobile networks only support certain credit values. You must ensure that any credit you wish to make is supported by your account and that you have sufficient pre-paid funds. Contact your account manager for details.
Credit workflow
The diagrams below illustrate the sequence of events that take place during one off credit requests. The first two represent different types of successful requests, and the remainder how rejection and failures are handled.
In the event of a failure, the Charge To Account Gateway retries crediting the account and makes an HTTP retry notification to the content provider. It will retry at increasing intervals up to a total of 10 attempts representing a maximum duration of around 17 hours. The gateway will follow this up with a failure or success notification depending on the outcome of the retries.
Credit request that is immediately successful
The content provider decides to make a credit to an end user's account and makes an HTTPS GET or POST request to the Charge To Account Gateway at:
https://cta.mxtelecom.com/api/credit
The end user's mobile number and the amount to be credited are sent as parameters to the request. The content provider's identity is verified with a username and password, also passed as parameters.
This example shows the basic structure of a credit request:
https://cta.mxtelecom.com/api/credit?
username=yourname& password=yourpass& msisdn=447700900999& currency=GBP& amount=500 The Charge To Account Gateway checks the request for validity and against account credit limits, and if the checks pass, it returns a unique creditId in the API request response.
The Charge to Account Gateway submits a request to the network operator to credit the account. In this case, the network operator is able to immediately credit the end user's account, and confirms to the Charge To Account Gateway that the credit has been applied. The content provider may then decide to inform the end user that their account has been successfully credited. This is compulsory for some networks - please check with your account manager.
The Charge to Account Gateway makes an HTTP notification to the content provider indicating that the credit has been confirmed. Details of the notification can be found in Notification API. In this case the content provider receives a single notification with a creditState of confirmed; in other examples below, more than one notification with different creditState values may be sent.
Credit request featuring separate 'Submitted' and 'Confirmed' notifications
Some networks do not apply the credit immediately after submission. In this case MX Telecom will send two separate notifications to the content provider. The first is made when the credit request has been submitted and the second after the credit has been applied.
The content provider decides to make a credit to an end user's account and makes an HTTPS GET or POST request to the Charge To Account Gateway at:
https://cta.mxtelecom.com/api/credit
The end user's mobile number and the amount to be credited are sent as parameters to the request. The content provider's identity is verified with a username and password, also passed as parameters.
This example shows the basic structure of a credit request:
https://cta.mxtelecom.com/api/credit?
username=yourname& password=yourpass& msisdn=447700900999& currency=GBP& amount=500 The Charge To Account Gateway checks the request for validity and against account credit limits, and if the checks pass, it returns a unique creditId in the API request response.
-
The Charge to Account Gateway makes a request to the network operator to credit the end user's mobile account. In this case the request is asynchronous and has been accepted, but not yet applied, by the operator.
The Charge to Account Gateway notifies the content provider that the credit has been submitted to the network operator. At this point, the content provider can choose to inform the end user that their account will be credited.
When the network applies a credit to the account, they confirm this with the Charge to Account Gateway, which notifies the content provider that the credit has been confirmed. The content provider may then decide to inform the end user that their account has been successfully credited. This is compulsory for some networks - please check with your account manager. Details of the notification can be found in Notification API.
Credit request rejected by Charge to Account Gateway
The content provider makes an HTTPS crediting request to the Charge to Account Gateway, which checks the request for validity and against account-specific and fraud detection limits. The request is rejected due to a malformed request or for breaching one of these limits.
The Charge to Account Gateway returns details of the error in the HTTP response. For more information see Format of response from server.
Credit request failed by Charge to Account Gateway
The content provider makes an HTTPS crediting request to the Charge to Account Gateway, which checks the request for validity and against account-specific and fraud detection limits.
The Charge To Account Gateway returns a unique creditId in the response.
The Charge to Account Gateway uses the mobile phone number to identify the end user's network, and determines that it is unable to credit an account on that network.
The Charge to Account Gateway notifies the content provider that the credit has failed. Details of the notification can be found in Notification API. At this point, the content provider may wish to inform the end user that there was an issue crediting the bill.
Credit failed by network operator
The content provider makes an HTTPS crediting request to the Charge to Account Gateway. This is checked for correctness and against required credit limits.
The Charge To Account Gateway returns a unique creditId in the response.
The Charge to Account Gateway submits a request to the network operator to credit the end user's account, but as the mobile number is invalid or the account is otherwise uncreditable, the network operator rejects the request.
The Charge to Account Gateway makes an HTTP notification to the content provider, indicating that the credit has failed. Details of the notification can be found in Notification API.
Example request
This is a simple example request for a one-off credit:
https://cta.mxtelecom.com/api/credit?
This example only includes mandatory parameters, so in this case the gateway would assume default values for the optional parameters.
Example notifications
If the end user was successfully credited for the above example, the notification sent from the gateway to the content provider site would be structured like this:
http://server.example.com/mxpay?
Note that the creditId value in the notification will match the value returned in the original HTTP response. All notifications about a particular credit will be identified with the same creditId value.
The creditState value of confirmed means that the credit was successful.
If the credit is not successfully completed, a notification will be sent giving the reason.
In this example, the credit was not made because the network rejected the credit request:
http://server.example.com/mxpay?
In crediting rejecting notifications, requirefulfilmentUrl always has a value of no. For details, see the Notifications section of the Crediting API.
API reference
See the Crediting API for full details of request and notification parameters.
Pre-paid balance enquiry
In order to credit end users, you must hold sufficient pre-paid funds in an account with MX Telecom. The balance is reduced by the relevant amount whenever a credit is applied. See the Pre-paid credit balance enquiry section in the Crediting API for full details of how to query your current pre-paid credit balance.
Test accounts
In order to integrate with the Crediting API, MX Telecom can configure a test account that does not interact with the mobile networks and as such can be used without incurring crediting charges.
The API can be exercised by making crediting requests against the following dummy mobile numbers (MSISDNs), which will return a network value of TESTNETWORK rather than VODAFONEUK or similar.
The following table summarises the expected notification results for a given MSISDN. Querying a MSISDN not listed will result in a creditState of confirmed.
Note that when using a test account, where a second notification is specified it will arrive five minutes after the first. In a live situation this period will vary.
| MSISDN | Description | |
| Initial notification | Second notification | |
| 447700900000 | creditState=confirmed | |
| 447700900001 | creditState=confirmed, billingType=postpay | |
| 447700900002 | creditState=confirmed, billingType=prepay | |
| 447700900003 | creditState=confirmed, mvno=test | |
| 447700900004 | creditState=failure | |
| 447700900005 | creditState=failure, billingType=postpay | |
| 447700900006 | creditState=failure, billingType=prepay | |
| 447700900007 | creditState=failure, mvno=test | |
| 447700900008 | creditState=submitted | creditState=failure |
| 447700900009 | creditState=submitted, billingType=postpay | creditState=failure billingType=postpay |
| 447700900010 | creditState=submitted, billingType=prepay | creditState=failure billingType=prepay |
| 447700900011 | creditState=submitted, mvno=test | creditState=failure mvno=test |
| 447700900012 | creditState=retry | creditState=confirmed |
| 447700900013 | creditState=retry, billingType=postpay | creditState=confirmed billingType=postpay |
| 447700900014 | creditState=retry, billingType=prepay | creditState=confirmed billingType=prepay |
| 447700900015 | creditState=retry, mvno=test | creditState=confirmed mvno=test |
| 447700900016 | creditState=retry | creditState=failure |
| 447700900017 | creditState=retry, billingType=postpay | creditState=failure billingType=postpay |
| 447700900018 | creditState=retry, billingType=prepay | creditState=failure billingType=prepay |
| 447700900019 | creditState=retry, mvno=test | creditState=failure mvno=test |

