Hello,
I’m having a hard time trying to develop a payment tool for PagSeguro, one of the leading payment platforms in Brazil.
Their documentation says the app should POST to a specific endpoint with some parameters. That can be done with HTTPSecureSocket. Problem is the response I get is:
[code]HTTP Status 406 - No match for accept header
type Status report
message No match for accept header
description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request “accept” headers (No match for accept header).[/code]
I believe the Header settings of the request seems to be ok.
Is there something I’m missing in my code below?
Public Sub Get_Sale_ID()
Dim mylink As String = "https://ws.sandbox.pagseguro.uol.com.br/v2/sessions"
Dim dadosform As New Dictionary
dadosform.Value("appID") = "zepipayer"
dadosform.Value("appKey") = "5863542E0A0A90B77499EF9E6F80CACD"
Dim buscador As New HTTPSecureSocket
buscador.requestHeaders.DeleteAllHeaders
buscador.requestHeaders.AppendHeader("Content-Type", "application/json;charset=ISO-8859-1")
buscador.requestHeaders.AppendHeader("Accept", "application/vnd.pagseguro.com.br.v3+json;charset=ISO-8859-1")
buscador.requestHeaders.AppendHeader("Accept-Language", "utf-8, iso-8859-1;q=0.5, *;q=0.1")
buscador.requestHeaders.AppendHeader("Accept-Charset", "iso-8859-1")
buscador.SetFormData(dadosform)
buscador.Secure = True
buscador.ConnectionType = HTTPSecureSocket.TLSv1
AddHandler buscador.PageReceived, WeakAddressOf Recebido_Secure
buscador.Post(mylink)
End Sub
This is their documentation page:
https://devs.pagseguro.uol.com.br/docs/pagamento-recorrente-endpoints-da-api
This is what I have for receiving data from the webpage:
Public Sub Recebido_Secure(sender As HTTPSecureSocket, s1 As String, i1 As Integer, ih As InternetHeaders, s2 As String)
dim dt As New Date
TextArea1.Text = ""
TextArea1.AppendText "RECEIVED " + dt.SQLDateTime + " " + EndOfLine
TextArea1.AppendText Str(sender.ErrorCode) + EndOfLine
TextArea1.AppendText s1 + EndOfLine
TextArea1.AppendText str(i1) + EndOfLine
HTMLViewer1.LoadPage(s2)
End Sub
Thanks in advance! Any help is welcome…