I need some help on the following
I am sending the following JSON to a web API that i use in Windows
Code: Select all
Dim jsonString As String = "{""transactionType"":""SALE"",""amount"":""" & transAmount & """,""currency"":""GBP""}"
could someone show me how I can send the JSON to the API correctly
this is the code I am using to send to the API
Code: Select all
Dim hClient As HttpClient
Dim sBuffer As String
Dim jsonString As String = "{" "transactionType" ":" "SALE" "," "amount" ":" "" & transAmount & "" "," "currency" ":" "GBP" "}"
message(JSON.Encode(jsonString))
hClient = New HttpClient As "hClient"
With hClient
.URL = global.PS_URL & "/terminals/" & global.terminalIDNumber & "/transactions"
.Auth = 1
.User = Global.PS_USER
.Password = Global.PS_PASS
' .Headers.Add("Software-House-ID :SD45T92")
' .Headers.Add("Installer-Id: " & Global.InstallerID)
.Async = False
.Timeout = 60
.Post("application/connect.v2+json", JSON.Encode(jsonString))
End With
global.showResult("POST", hClient)