kn9ts/project-mulla

No account number and sender name

ngethe opened this issue · 11 comments

Hi I am migrating from the M-Pesa IPN to the API
Where the account number(reference ID in Request Payment) and Sender Name are not provided
sample output.

{
  "response": {
    "msisdn": "254723001575",
    "amount": "450",
    "mpesa_trx_date": "2014-12-01 16:24:06",
    "mpesa_trx_id": "6jk45hsjdhjjky5hjk36wdsgha",
    "trx_status": "success",
    "return_code": "00",
    "description": "success",
    "merchant_transaction_id": "320903",
    "trx_id": "ds9d7f98asf809d8f9098sa098f9008f8"
  }
}

or am I missing something?

kn9ts commented

@ngethe Please explain what is wrong? What are you missing or what do you think is missing?

@kn9ts I don't get the name of the person that sent the money from the callback or the account number(provided as reference ID in Request Payment)

kn9ts commented

@ngethe If you want to get the name of the person you must request for it from the client and attach it to the POST request as one of the parameters. Any extra parameter attached to the POST request that is not part or mandatory to the payment request is always collected together into the enc_params property. You then get a response back like the following:

{
    "response": {
        "return_code": "00",
        "status_code": 200,
        "message": "Transaction carried successfully",
        "trx_id": "ab713bc0ca25564aec0ff28bec0ce396",
        "cust_msg": "to complete this transaction, enter your pin on your handset. if you don't have a pin, press 0 and follow the instructions.",
        "description": "success",
        "reference_id": "e11ef040-decf-426c-a88f-09a92abfd908",
        "merchant_transaction_id": "bc70c710-5fd1-11e6-bbdb-ddf6748b16e7",
        "amount_in_double_float": "10.00",
        "client_phone_number": "254723001575",
        "extra_payload": {
            "orderID": "555555",
            "items": "10",
            "location": "Nairobi",
            "clientName": "Eugene Mutai",
            "clientLocation": "Kilimani",
            "delivery": "false"
        },
        "time_stamp": "20160811144149",
        "callback_url": "http://project-mulla.herokuapp.com/api/v1/payment/success"
    }
}

enc_params in unserialized and sent back to you in the response as extra_payload in the response object

The account number is "client_phone_number": "254723001575"

Thanks @kn9ts
So unlike the Safaricom IPN the current Safaricom API Does not provide the M-Pesa Name of the person that sent the Money ?

What of the Account Name as used on the paybill is there a way to get this?

kn9ts commented

Yes! It does not provide the name of the payer neither the account name of the paybill number since they assume your paybill number is the one making these requests and you definitely know your paybill account name.

Thanks @kn9ts

Just got a new documentation that enable me to get the variable "PayBill Validation and Confirmation
Version 0.3" Just need to call C2BPaymenConfirmationRequest and all this info will be provided

kn9ts commented

@ngethe You're stating that this C2BPaymenConfirmationRequest is an endpoint to get all the meta data associated with a payment request made?

Yes that what I was informed by one of the safaricom Engineers will be testing this tonight

Sample of SOAP message:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:c2b="http://cps.huawei.com/cpsinterface/c2bpayment">
    <soapenv:Header/>
    <soapenv:Body>
        <c2b:C2BPaymentConfirmationRequest>
            <TransactionType>PayBill</TransactionType>
            <TransID>1234560000007031</TransID>
            <TransTime>20140227082020</TransTime>
            <TransAmount>123.00</TransAmount>
            <BusinessShortCode>12345</BusinessShortCode>
            <BillRefNumber>TX1001</BillRefNumber>
            <InvoiceNumber></InvoiceNumber>
            <OrgAccountBalance>12345.00</OrgAccountBalance>
            <ThirdPartyTransID></ThirdPartyTransID>
            <MSISDN>254722703614</MSISDN>
            <KYCInfo>
                <KYCName>[Personal Details][First Name]</KYCName>
                <KYCValue>Hoiyor</KYCValue>
            </KYCInfo>
            <KYCInfo>
                <KYCName>[Personal Details][Middle Name]</KYCName>
                <KYCValue>G</KYCValue>
            </KYCInfo>
            <KYCInfo>
                <KYCName>[Personal Details][Last Name]</KYCName>
                <KYCValue>Chen</KYCValue>
            </KYCInfo>
        </c2b:C2BPaymentConfirmationRequest>
    </soapenv:Body>
</soapenv:Envelope>
kn9ts commented

@ngethe Mmmh! I think I will do the same too. Would you know about the request SOAP body and what arguments it requires?