Hey,
I am having an integration error using the C# SDK. When testmode is enabled, my code works fine, and the developer confirmation email is sent appropriately. When I disable testmost, and update my API TransactionKey/Login I run into issues.
When I walk through the SDK sourcecode, I can see that my inputs all validate correctly. However, when I get the response, I have two issues.
1) The IGatewayResponse does not parse correctly. It comes over as one big string, so only the 'E' is loaded into the object.
2) When stepping through the source code I am returned this string: "E|000000|Credit card number is required.||". Clearly, in my example I am passing a credit card.
Any thoughts on what is going on? Any help is greatly appreciated.
The function I have written looks more or less like this:
protected void Charge(bool UseAddress)
{
string APILogin = ConfigurationManager.AppSettings["AuthorizeNETAPILogin"];
string TransactionKey = ConfigurationManager.AppSettings["AuthorizeNETTransactionKey"];
AuthorizationRequest PaymentRequest;
if (existingCCNumber.Checked)
{
PaymentRequest = new AuthorizationRequest(myCCNumber, CCMonth.Value + "/" + CCYear.Value, decimal.Parse(Total.Value), Description.Value);
}
else
{
PaymentRequest = new AuthorizationRequest(CCNumber.Value, CCMonth.Value + "/" + CCYear.Value, decimal.Parse(Total.Value), Description.Value);
}
if (UseAddress)
{
CCAddress.Update(myBillingAddress);
PaymentRequest.AddCustomer(
CustomerID,
firstName.Value,
lastName.Value,
myBillingAddress.Address1 + " " + myBillingAddress.Address2 + " " + myBillingAddress.Address3,
myBillingAddress.Region_,
myBillingAddress.PostalCode);
PaymentRequest.AddMerchantValue("x_city", myBillingAddress.City);
}
else
{
PaymentRequest.AddCustomer(
CustomerID,
firstName.Value,
lastName.Value,
"",
"",
"");
}
PaymentRequest.AddInvoice(InvoiceNumber.Value);
var PaymentGateway = new Gateway(APILogin, TransactionKey);
PaymentGateway.TestMode = TestMode;
try
{
IGatewayResponse PaymentResponse = PaymentGateway.Send(PaymentRequest);
if (int.Parse(PaymentResponse.ResponseCode) != 1)
{
message.InnerText = PaymentResponse.ResponseCode + ": " + PaymentResponse.Message;
message.Attributes["class"] = "error";
}
else
{
message.InnerText = "Payment Successful!";
message.Attributes["class"] = "success";
}
}
catch (Exception ex)
{
message.InnerText = ex.Message;
message.Attributes["class"] = "error";
}
message.Visible = true;
}