JSON Body not accepted by API connector

I’m trying to make a call to a payment gateway, but I can’t get the parameters right. The API connector responds as if the parameters were empty. This is the call:

 "amount": <amount>,
 "currency": "<currency>",
 "statement_descriptor": "<statement description>",
 "redirect": {
   "return_url": "<return url>",
   "post_url": "<post url>"
 "description": "<description>",
 "metadata": {
   "Order Number": "<order number>"
 "receipt_sms": "<sms number for receipt>",
 "receipt_email": "<email for receipt>"

The parameters are filled out:

Which results in this error:

Raw response for the API 
"{\"errors\":[{\"fieldname\":\"currency\",\"message\":\"Currency is Required\"},{\"fieldname\":\"currency\",\"message\":\"Currency Should be 3 character alphabet, e.g USD\"},{\"fieldname\":\"amount\",\"message\":\"Amount is Required\"},{\"fieldname\":\"amount\",\"message\":\"Amount should be number or decimal\"}]}"

Are there some obvious formatting mistakes here than might cause it? Or something else I’m doing wrong?

1 Like

Hey @petter. My hunch is that the problem lies more in the format of the call, than the parameters. Post up the entire call and let’s have a look.


Hey @mebeingken!

Thank’s for getting back to me. I’m afraid JSON is greek to me, so I’m not entirely sure how to reply :slight_smile:

Is there a way to display the entire raw call that the API Connector is sending?

Sorry, I wasn’t clear enough.:slight_smile:

Just thinking that the problem might lie in another part of the API connector, not the json. If you do a screenshot of the whole api call in the connector plugin, instead of just the parameters, somebody might spot any error that might exist there.

Ah, yes sure :slight_smile:

  • Other calls are working, so I know the authorization works.

  • However, I can’t get the other calls to work by posting the JSON body, only by setting up the parameters manually. However, with this call that doesn’t work, as I keep getting the error
    “”{"errors":[{"fieldname":"charges.redirect","message":"Invalid redirect url"}]}“”

  • When testing the API on this page, it works fine (Charges → Create charge)

Try adding in the Shared headers a key of Content-Type and a value of application/json


That solved it!! So simple and elegant, haha, thank you so much @mebeingken, this has been bothering me for hours :slight_smile:

1 Like

@petter @mebeingken - I am facing similar issue with the API call but my issue is still not resolved after adding shared header for Content-Type. Can you please help?

I am able to run this API with same credentials through postman.

For those who may stumble upon this thread, this solution worked for me for the problem I have mentioned above: