Issue with '400 bad request'


Hi all,

I’m attempting to use the API poll method (option 3).
Now, this works 100% in my Android Java code.

But, in at least 4 different attempts using JavaScript, Ajax, Visual Basic posts I always encounter a
‘400: Bad Request’ error.

Using a cool api tester at
I can build example tests. Now, I KNOW the signature is correct as this site tells me if it’s not, and the JSON string is readable and is accepted, as this site does return
"Message:“payment not sent”

Which is exactly what i want.
Unfortunately both this site and all my VB/java/ajax methods return the 400 error first !
Preventing me from extracting this data.

Any ideas ???
Is this my issue, or an issue with the poll server ?
I’m now attempting to bypass the error in vb.

A video of my variables and attempt here:


Ok, this issue still exists. Still not sure whose problem it is.

Dirty hacked around it:

        Dim payload As New payload() With {.payment_id = saleidstring, .vendor_address = etnwallett}
        Dim signature As String = "" ' place holder for my hashed secret
        Dim serializer As New JavaScriptSerializer()
        serializedResult = JsonConvert.SerializeObject(payload)
        signature = Hashmac(serializedResult) 
' Calls a function below to HASH my signature against my key, works !
        Dim myWebRequest As HttpWebRequest
        myWebRequest = CType(WebRequest.Create(""), HttpWebRequest)
        myWebRequest.Method = "POST"
        myWebRequest.ContentType = "application/json"
        Dim byteArray = System.Text.Encoding.UTF8.GetBytes(serializedResult)  ' Convert to byes, is this wrong?!?
        myWebRequest.ContentLength = byteArray.Length
        myWebRequest.Headers.Add("ETN-SIGNATURE", signature) ' I know this is correct, otherwise it throws a gateway 502 error

        Dim dataStream As Stream = myWebRequest.GetRequestStream()
        dataStream.Write(byteArray, 0, byteArray.Length)

            Dim responsex = myWebRequest.GetResponse().GetResponseStream

            Dim reader As New IO.StreamReader(responsex)
            Dim result = reader.ReadToEnd()

        Catch ex As Net.WebException

            Dim exResponse = New StreamReader(ex.Response.GetResponseStream()).ReadToEnd

            Dim messagesplit = exResponse.Split(" ")
            Dim messagesplit2 As String = messagesplit(1)
            Dim status = Replace(Replace(messagesplit2, ",", " "), "", "")

            MsgBox("Current status = " + status)

        End Try




Thanks for the post. You’re correct, on a correct request (valid payload and correct signature) the response was a 400 if payment is not sent.

As the request is valid, the 400 response has been replaced with a 200. This is now live; hopefully this will make integration easier to follow and debug.

Thanks again :slight_smile:



Hi Egg,

Thank you !!
I’m impressed with what you’re doing.

It does mean I’ll have to undo my error catching work around :yum: