ChargeTokenMobile (V6)
Description
The ChargeTokenMobile request will be used for requesting a payment using mobile payment solutions, API will accept a phone number, MNO (Mobile Operator Name) - like safaricom and the MNO country name. Instructions for the payment process will then be returned, this should be displayed to the customer.
Upon the customer payment, the transaction status would be updated and should be checked in “verifyToken”
verifyToken will also display the status of the mobile request
URL: https://secure.3gdirectpay.com/API/v6/
Response
The method will return payment instructions from mobile operator.
Variables to send:
Parameter | Data type | Description | |
Request | Text | ChargeTokenMobile | Mandatory |
CompanyToken | Token | Token you got from 3G to operate this API | Mandatory |
TransactionToken | Token | Transaction token as accepted from the createToken. | Mandatory |
PhoneNumber | Text | Phone number to charge | Mandatory |
MNO | Text | Mobile Network Operator - According to your terminal settings in the system. Ask Directpay team. | Mandatory |
MNOcountry | Text | The country name of MNO - According to your terminal settings in the system. Ask Directpay team. | Mandatory |
Request example:
<?xml version="1.0" encoding="UTF-8"?> <API3G> <CompanyToken>68B90B5E-25F6-4146-8AB1-C7A3A0C41A7F</CompanyToken> <Request>ChargeTokenMobile</Request> <TransactionToken>9EF83250-B6A2-4FDD-A290-C4CE7EA6D447</TransactionToken> <PhoneNumber>25412345678</PhoneNumber> <MNO>mpesa</MNO> <MNOcountry>kenya</MNOcountry> </API3G>
Respond:
The server will respond for the ChargeTokenMobile request according to the following results:
Parameter | Data type | Description |
StatusCode | 3/4 digits code | A code will be sent with the result of the request |
ResultExplanation | Text | Free text of the result |
instructions | Text | Payment instructions |
RedirectOption | Boolean | If the value is 1 (true), then a redirection to the Mno url is necessary to complete the payment. You'll need to decode the url |
Respond codes:
Code | Explanation |
130 | New invoice |
801 | Request missing company token |
802 | Company token does not exist |
803 | No request or error in Request type name |
804 | Error in XML |
950 | Request missing transaction level mandatory fields |
951 | Data mismatch - Transaction Token |
952 | Request missing mandatory fields - MNO (Mobile Network Operator) |
953 | Request missing mandatory fields - MNOcountry (Mobile Network Operator country name) |
954 | Request missing mandatory fields - PhoneNumber (Phone number of the payer - MSISDN) |
955 | Phone number is invalid |
956 | Terminal not found |
Respond example:
<?xml version="1.0" encoding="utf-8"?> <API3G> <StatusCode>130</StatusCode> <ResultExplanation>New invoice</ResultExplanation> <instructions>Dear Customer, <br> Shortly you will receive an M-PESA prompt on your phone requesting you to enter your M-PESA PIN to complete your payment. Please ensure your phone is on and unlocked to enable you to complete the process. Thank you. <br> <br> You can also pay using Lipa na MPESA by using the following instructions: <br> 1.Go to the M-PESA menu <br> 2. Select Lipa na M-PESA <br> 3. Select the Paybill option <br> 4. Enter business number 927633 <br> 5. Enter your account number 2257FB0D1 <br> 6. Enter the amount 1 <br> 7. Enter PIN and press OK to send <br> 8. You will receive a confirmation SMS with your payment reference number. </instructions> <RedirectOption>0</RedirectOption> </API3G>