A couple of things:
1. please post B4J code, transpiled code is pretty useless.
2. besides the issue, but you are passing the wrong property 'orderid' while it should be 'order_id'
3. Remove those var_dumps in your php, they mess up everything as they are returned to the fetch and hence can not be processed because they are not valid json
4. You are returning an array, not a map in your json so you will have to change the PostString method accordingly (I changed it so it should be able to handle both now):
Public Sub PostString(url As String, data As String)
mError = ""
mString = ""
Dim fetch As BANanoFetch
Dim fetchOptions As BANanoFetchOptions
Dim fetchResponse As BANanoFetchResponse
Dim jsonObj As Object ' <-----------------------
Dim Error As String
fetchOptions.Initialize
fetchOptions.Method = "POST"
fetchOptions.Body = data
fetchOptions.Headers = CreateMap("Content-type": "application/json; charset=UTF-8")
fetch.Initialize(url, fetchOptions)
Try
' wait for the response
fetchResponse = BANano.Await(fetch)
' wait for the json part of the response
jsonObj = BANano.Await(fetchResponse.Json) ' <----------------------- this will still crash if you use e.g. var_dumpor anything that returns invalid json
' overkill as we already have the json parsed here, but for demo's sake so we can do a GetString later
Dim json As JSONGenerator
If BANano.IsArray(jsonObj) Then ' <-----------------------
json.Initialize2(jsonObj)
Else
If BANano.IsMap(jsonObj) Then
json.Initialize(jsonObj)
End If
End If
mString = json.ToString
Success = True
Catch(Error)
Log("Error: " & Error)
mError = Error
End Try
End Sub
Alwaysbusy