Skip to main content

I am consuming the MTN Open API and most of the endpoints worked except for some specific endpoints which I would enlist below;

Kindly note that the response I receive from these are all BAD REQUEST so kindly help me out in determining what is the issue;

  1. Request to Pay

    POST https://sandbox.momodeveloper.mtn.com/collection/v1_0/requesttopay
    Headers:

    X-Target-Environment
    X-Callback-Url       
    X-Reference-Id
    Ocp-Apim-Subscription-Key

    Authorization

 

Request Body: 

{

"amount": "2.0",

"currency": "GH",

"externalId": "7916d515-ab40-4bba-bb67-b68bfb13b94c",

"payer": {

"partyIdType": "MSISDN",

"partyId": "23354****414"

},

"payerMessage": "Kindly accept for payment of TEST",

"payeeNote": "Thanks for paying for Test"

}

 

 

  1. Disbursement / Transfer

      POST: https://sandbox.momodeveloper.mtn.com/disbursement/v1_0/transfer

       Headers:

   X-Target-Environment
   X-Callback-Url       
   X-Reference-Id
   Ocp-Apim-Subscription-Key

   Authorization

 

Request Body:

 {

"amount": "2.0",

"currency": "GH",

"externalId": "e4f75ad1-83c7-44b2-937f-6c0849a94a48",

"payer": {

"partyIdType": "MSISDN",

"partyId": "233547013414"

},

"payerMessage": "Refund Payer Message",

"payeeNote": "Payee Note"

}

 

Response: Bad Request

 

 

  1.  Pre-Approval

POST https://sandbox.momodeveloper.mtn.com/collection/v2_0/preapproval

Headers:

   X-Target-Environment
   X-Callback-Url       
   X-Reference-Id
   Ocp-Apim-Subscription-Key
   Authorization

Request Body:

{

"payer": {

"partyIdType": "MSISDN",

"partyId": "233547013414"

},

"payerCurrency": "GH",

"payerMessage": "Kindly approve",

"validityTime": "2"

}

               

Response: Bad request

  • The currency should be EUR for sandbox.
  • Also ensure the x-reference-id is a valid UUID version 4, you can use online tools for this.
  • Ensure in the authorization you are using the Bearer keyword i.e Authorization: Bearer YourGeneratedAccessToken

  • The currency should be EUR for sandbox.
  • Also ensure the x-reference-id is a valid UUID version 4, you can use online tools for this.
  • Ensure in the authorization you are using the Bearer keyword i.e Authorization: Bearer YourGeneratedAccessToken

I am still getting a bad request response error!!


Hi, is your token still valid?


Hi, is your token still valid?

Yes!! I even tried deserializing it using jwt.io and the claims were very correct and the token hadn’t expired yet

 


Ok. It’s the hashtag in your payersMessage.. Seems it’s invalid character


Ok. It’s the hashtag in your payersMessage.. Seems it’s invalid character

 That’s a string value. I don’t think that’s the problem. Lemme try your solution though

 

 

 


Thats what the documentation sais…

But I just tried it with (400) and without (202)


Thats what the documentation sais…

But I just tried it with (400) and without (202)

Could you please send me images of your request so that I use that exact one, please


 


 

It has worked. Thank you.

 


Happy to help


Reply