Payment API test transaction -- failing

Dim paymentUrl As String = $"https://api.sky.blackbaud.com/payments/v1/transactions"


Dim payment = New PaymentAdd()

payment.amount = 1
payment.csc = "123"
payment.comment = "Recurring donation"
payment.card_token = cardToken
payment.direct_debit_account_token = "00000000-0000-0000-0000-000000000000"
payment.tokenize = False
payment.payment_configuration_id = paymentConfig
payment.transaction_category = "donation"
payment.donor_ip = "192.168.0.1"

Dim billing_contact = New billing_contact()

billing_contact.address = "2000 Daniel Island Drive"
billing_contact.city = "Charleston"
billing_contact.country = "US"
billing_contact.first_name = "Blackbaud"
billing_contact.post_code = "29442"
billing_contact.state = "SC"


Dim credit_card = New CardTokenAdd()

credit_card.card_type = "Visa"
credit_card.Number = "4111"
credit_card.Exp_month = 2
credit_card.Exp_year = 1985
credit_card.Name = "Blackbaud"
credit_card.valid_from_month = 1
credit_card.valid_from_year = 1980
'credit_card.issue_number = 443


payment.billing_contact = billing_contact
payment.credit_card = credit_card


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 json = Newtonsoft.Json.JsonConvert.SerializeObject(payment)
'Dim content = New Net.Http.StringContent(json)
Dim response = Await client.PostAsync(paymentUrl, New StringContent(json, Encoding.UTF8, "application/json"))


If response.IsSuccessStatusCode Then
Dim content1 = Await response.Content.ReadAsStringAsync()

'escardToken = Newtonsoft.Json.Linq.JObject.Parse(content1)
Return content1
' Read response content
'rescardToken = response.Content.ReadAsStringAsync().Result
Else
Console.WriteLine($"Error: {response.StatusCode} - {response.ReasonPhrase}")
End If

End Using

Getting Error while posting this payment api.

[{"message":"A validation error occurred. Validation error code: <UnknownCardType> Validation error message <Unknown credit card type.>","error_name":"TransactionValidationError","error_code":4,"raw_message":"A validation error occurred. Validation error code: <{0}> Validation error message <{1}>","error_args":["UnknownCardType","Unknown credit card type."]}]

Comments

  • Catherine Lu
    Catherine Lu Blackbaud Employee
    Sixth Anniversary Name Dropper Participant Facilitator 1

    @Sumathi Babu Reference to Payments API document, there is no card_type property under CreditCardAdd. Removing it should help you to pass this error message.


Categories