Solved

Cannot submit requestpay api

  • 12 October 2023
  • 9 replies
  • 95 views

Getting a 400 bad request while doing a request payment in sandbox. with no further message and not sure why or what is wrong.

icon

Best answer by crankluga 14 October 2023, 08:26

View original

9 replies

Userlevel 1

Getting a 400 bad request while doing a request payment in sandbox. with no further message and not sure why or what is wrong.

Hi, Bad Request basically means there something wrong with your request, could be an issue on the header values your sending or request body. It would help if you could share the details of your request i.e request headers and request body

Userlevel 2

Remove the callback URL field and try again.

Here is the body and headers

 

Headers: {
    "Ocp-Apim-Subscription-Key": "xxxx",
    "X-Reference-Id": "xxxx",
    "Authorization": "xxxx",
    "X-Target-Environment": "sandbox"
}

 

body:

 

{'amount': '200.0', 'externalId': '550e8400-e29b-41d4-a716-446655440000', 'payerMessage': 'This is a test for payment', 'payeeNote': 'This is test  note for the payment', 'payer': {'partyIdType': 'MSISDN', 'partyId': '56733123453'}}

Userlevel 2

You forgot to add the Currency whose value is EUR

i tried XAF since i am planing on operating in Cameroon but no luck. or sandbox only accept EUR?

I have just tried this

{'amount': '200.0', 'currency': 'EUR', 'externalId': '550e8400-e29b-41d4-a716-446655440000', 'payerMessage': 'This is a test for payment', 'payeeNote': 'This is test  note for the payment', 'payer': {'partyIdType': 'MSISDN', 'partyId': '56733123453'}}

 

still getting a 400

Userlevel 2

Kindly follow the sandbox requirements, you are using the wrong sandbox test numbers.
Visist the testnumbers section under the documentation menu n the momo developer platform or on the momo develeoper community, scroll down and follow the how to videos.
_remember to vote the answer when you get one so other developers facing the same challange as you easily find the answer

@crankluga i am still getting 400. sorry here is the payload

 

```

{
   "amount": "200.0",
   "currency": "EUR",
   "payerMessage": "This is a test for payment",
   "payeeNote": "This is test  note for the payment",
   "payer": {
      "partyIdType": "MSISDN",
      "partyId": "46733123451"
   }
}
Request failed with status code: 400
Response content:

```

Userlevel 2

@cranklugai am still getting 400. sorry here is the payload

 

```

{
   "amount": "200.0",
   "currency": "EUR",
   "payerMessage": "This is a test for payment",
   "payeeNote": "This is test  note for the payment",
   "payer": {
      "partyIdType": "MSISDN",
      "partyId": "46733123451"
   }
}
Request failed with status code: 400
Response content:

```

No need to include a period on the figures. eg 200.0, let it just be 200

Reply