Charge Token Mobile

Request a mobile payment for a transaction token using ChargeTokenMobile in DPO Pay API v6 or v7.

Charge Token Mobile

Request a mobile payment for a transaction created by createToken and display the returned operator instructions to the customer.

The ChargeTokenMobile request accepts a phone number, an MNO (Mobile Network Operator) name such as safaricom or mpesa, and the MNO country name. DPO returns payment instructions from the mobile operator.

After the customer completes payment, the transaction status is updated and should be checked with verifyToken. verifyToken also displays the status of the mobile request.


Version endpoints

POST https://secure.3gdirectpay.com/API/v6/

Send requests using XML in the request body.

Content-Type: application/xml; charset=utf-8
Accept: application/xml

Request parameters

The request parameters are the same for API v6 and API v7.

ParameterData typeDescriptionRequired
RequestTextMust be ChargeTokenMobile.Mandatory
CompanyTokenTokenToken you received from 3G to operate this API.Mandatory
TransactionTokenTokenTransaction token received from createToken.Mandatory
PhoneNumberTextPhone number to charge.Mandatory
MNOTextMobile Network Operator name according to your terminal settings in the system. Ask the Directpay team for the accepted value.Mandatory
MNOcountryTextMNO country name according to your terminal settings in the system. Ask the Directpay team for the accepted value.Mandatory
📱

If you are unsure which MNO or MNOcountry values are valid for your tenant, call GetMobilePaymentOptions first. Use the returned provider and country values according to your terminal configuration.

For more guidance about mobile network operator requirements, supported countries, and approval flows, see the MNO Advisory.


Request examples

<?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>

Response fields

The method returns payment instructions from the mobile operator.

ParameterData typeDescription
StatusCode3/4 digit codeCode sent with the result of the request.
ResultExplanationTextFree text result explanation.
instructionsTextPayment instructions to display to the customer.
RedirectOptionBooleanIf the value is 1 (true), redirecting to the MNO URL is necessary to complete the payment. You need to decode the URL.
📘

Display the returned instructions exactly as provided because they are customer-facing and may include transaction-specific business numbers, account references, STK prompts, or USSD guidance.


Response codes

CodeExplanation
130New invoice.
801Request missing company token.
802Company token does not exist.
803No request or error in request type name.
804Error in XML.
950Request missing transaction-level mandatory fields.
951Data mismatch: TransactionToken.
952Request missing mandatory field: MNO (Mobile Network Operator).
953Request missing mandatory field: MNOcountry (Mobile Network Operator country name).
954Request missing mandatory field: PhoneNumber (phone number of the payer / MSISDN).
955Phone number is invalid.
956Terminal not found.

Response examples

<?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>

Recommended flow

sequenceDiagram
  participant M as Merchant Server
  participant D as DPO API
  participant U as Customer
  participant O as Mobile Operator

  M->>D: createToken → TransactionToken
  M->>D: GetMobilePaymentOptions for valid MNO values
  M->>D: ChargeTokenMobile with phone, MNO, and MNOcountry
  D-->>M: Payment instructions and RedirectOption
  M-->>U: Display instructions or redirect if required
  O-->>U: Mobile prompt or payment instructions
  U->>O: Completes mobile payment
  M->>D: verifyToken to check mobile request status

Usage notes

  • Validate the phone number before sending it. Format and length can vary by country and mobile operator.
  • Confirm MNO and MNOcountry values with the Directpay team or by using GetMobilePaymentOptions.
  • Show the customer a pending state while waiting for the mobile operator prompt or payment confirmation.
  • Use verifyToken after the customer completes payment to confirm the final transaction status and mobile request status.
  • If RedirectOption is 1, decode and open the MNO URL required to complete the payment.