400.002.02Daraja API error

M-Pesa error 400.002.02: Bad Request — invalid amount or shortcode

This is a Daraja API error — Safaricom rejects the request itself, before any customer prompt, usually over authentication or payload validation.

What causes it

The synchronous request was rejected as malformed, commonly due to an invalid amount, an invalid BusinessShortCode, or the payload being sent as form data instead of JSON.

How to fix it

Send the body as JSON, and verify the amount (a positive whole-number KES) and BusinessShortCode are valid before sending.

How paylod handles this

paylod manages Daraja OAuth tokens, request signing, and payload formatting for you — the whole class of authentication and malformed-request errors is handled by the wrapper, so you send one clean REST call and get a typed response.

See the paylod M-Pesa API

Related M-Pesa error codes

Sources