Request to Pay Endpoint Keeps Returning HTTP 400 Bad Request

Hi There, Running some tests on the sandbox, for some reason can't get past the required header authorization. Below is the request I am sending but keep getting back a HTTP 400 Bad request. My assumption was the format for the Authorization string would be "API-User:API-Key". Is there anything I'm missing? -------------------- POST https://ericssonbasicapi2.azure-api.net/colection/v1_0/requesttopay HTTP/1.1 Host: ericssonbasicapi2.azure-api.net X-Reference-Id: 49bd68d0-e86f-11e8-9f32-f2801f1b9fd1 X-Target-Environment: sandbox Content-Type: application/json Ocp-Apim-Subscription-Key: {my-subscription-key} Authorization: 49bd68d0-e86f-11e8-9f32-f2801f1b9fd1:7e756afbba244ff98f7382f3ebfd698a { "amount": "2000", "currency": "EUR", "externalId": "myMSISDN", "payer": { "partyIdType": "MSISDN", "partyId": "46733123453" }, "payerMessage": "hello world", "payeeNote": "here we are" }

Comments

  •  
    This is a great service from MTN for us Developers. I wanted to try out the API through the Sandbox and am also getting the same error.
    Posted by Hidden Sun, 18 Nov 2018 19:12:48 GMT
  •  
    The Developers have don't a great work but the need to show the steps out clearly such that developers can begin using the API with ease. It can be inform of code sample or a video. Thanks.
    Posted by Hidden Sun, 18 Nov 2018 19:15:24 GMT
  •  
    Figured it out - they're using Basic Authentication with API-User:API-Key string combination first encoded in base64.
    Posted by Hidden Tue, 20 Nov 2018 23:30:58 GMT
  •  
    The error message should be more specific, for example pointing out the right parameter/section with invalid data and NOT jsut "Bad request, e.g. invalid data was sent in the request."
    Posted by Hidden Wed, 21 Nov 2018 13:07:21 GMT
  •  
    For those who are still struggling use NSwagStudio to generate working codes (C#) with better exception handling and so On, Then get Token using Basic Authentication like authorization: Basic b64({API-User}:{API-Key}) and finally call other methods using the acquired Token like authorization: Bearer {access token} What you should avoid is passing empty params especially in the headers this is why you are getting Status 400
    Posted by Hidden Sun, 25 Nov 2018 14:46:20 GMT
  •  
    test
    Posted by Hidden Wed, 08 May 2019 13:19:55 GMT
  •  
    Hi, What exactly are is the X-Target-Environment and why is it compulsory in making the requests
    Posted by Hidden Mon, 02 Sep 2019 09:02:06 GMT
  •  
    Please help, I keep getting bad request (400) The Authorization here was generated as such: base64_encode(`${api_user}:${api_key}`) Please Help, this issue has been dealing with me severely POST https://sandbox.momodeveloper.mtn.com/collection/v1_0/requesttopay HTTP/1.1 Host: sandbox.momodeveloper.mtn.com Authorization: Basic ZWEzMmQxMjItNGRjMS00YjQyLWE2NTktNjI3MmJjMTQ2OWFjOjQwMjZmYTM1ZGU2NzQyMjQ5MTlkYzA5NDk1OTkyZmVk X-Reference-Id: 715d9d06-2abd-4240-b9af-fae724b3a7ae X-Target-Environment: sandbox Content-Type: application/json Ocp-Apim-Subscription-Key: •••••••••••••••••••••••••••••••• { "amount": "100", "currency": "EUR", "externalId": "12345", "payer": { "partyIdType": "MSISDN", "partyId": "237654440419" }, "payerMessage": "Testing MoMo", "payeeNote": "Platform" }
    Posted by Hidden Fri, 01 Nov 2019 13:05:42 GMT
  •  
    Please help, I keep getting bad request (400)
    The Authorization here was generated as such: base64_encode(`${api_user}:${api_key}`)
    Please Help, this issue has been dealing with me severely
    POST https://sandbox.momodeveloper.mtn.com/collection/v1_0/requesttopay HTTP/1.1
    Host: sandbox.momodeveloper.mtn.com
    Authorization: Basic ZWEzMmQxMjItNGRjMS00YjQyLWE2NTktNjI3MmJjMTQ2OWFjOjQwMjZmYTM1ZGU2NzQyMjQ5MTlkYzA5NDk1OTkyZmVk
    X-Reference-Id: 715d9d06-2abd-4240-b9af-fae724b3a7ae
    X-Target-Environment: sandbox
    Content-Type: application/json
    Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

    {

    "amount": "100",
    "currency": "EUR",
    "externalId": "12345",

    "payer": {

    "partyIdType": "MSISDN",

    "partyId": "237654440419"

    },

    "payerMessage": "Testing MoMo",

    "payeeNote": "Platform"

    }
    Posted by Hidden Fri, 01 Nov 2019 13:07:43 GMT
  •  
    Still facing this problem in 2020, what's the solution????
    Posted by Hidden Tue, 04 Aug 2020 19:49:22 GMT


You're not signed in. Please sign-in to report an issue or post a comment.