Reply
Member
nosafrochu
Posts: 1
Registered: ‎02-22-2012

AIM Integration Issue, Using C# SDK

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;
        }

Expert
RaynorC1emen7
Posts: 3,485
Registered: ‎03-08-2010

Re: AIM Integration Issue, Using C# SDK

The PaymentGateway.TestMode is set to use either the test URL or the live URL.

Are you testing on a test account or a live account?

 

It not loading correctly probably because of the x_delim_char is different than the account setting. The SDKs hard code it a | (pipe char).

To make sure it use the correct char. Set

PaymentRequest.AddMerchantValue("x_delim_char", '|');

 

Can you see what in the PaymentRequest just before the PaymentGateway.Send()?