Async Function GetTokenPayment(accessToken As String, skey As String) As Task(Of Boolean)
Dim paymentUrl As String = $"https://api.sky.blackbaud.com/payments/v1/cardtokens"
Dim jsonData As String = "{
""card_number"": ""4111111111111111"",
""expiration_date"": ""12/24"",
""cvv"": ""123"",
""cardholder_name"": ""John Doe"",
""billing_address"": {
""line1"": ""123 Main St"",
""city"": ""Anytown"",
""state"": ""NY"",
""postal_code"": ""12345"",
""country"": ""US""
}
}"
'Dim jsonObject As Newtonsoft.Json.Linq.JObject = Newtonsoft.Json.Linq.JObject.Parse(jsonData)
Using client As New HttpClient()
client.DefaultRequestHeaders.Authorization = New System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken)
'client.DefaultRequestHeaders.Add("Bb-Api-Subscription-Key", skey)
Dim response = Await client.PostAsync(paymentUrl, New StringContent(
New JavaScriptSerializer().Serialize(jsonData), Encoding.UTF8, "application/json"))
'Dim response1 = Await client.PostAsync(paymentUrl, New FormUrlEncodedContent(jsonObject))
Return response.IsSuccessStatusCode
End Using
End Function
We are not getting proper response for the above card token api call , not sure whether the json file which are sending as parameter for this api is invalid or any other authorization header information is missing , Subcritpion key and access token are fine, we have tested those keys in payment configuration .
Please give us the correct json format file for card token and payment api