Reply
Member
Posts: 1
Registered: ‎08-15-2017

Email not being added to customer transactions

When I post a transaction the customers email is not captured in the detail. Then the customer does not recieve a transactiopn email.  All othr values in the billing record do go through.

 

Here is my code

 

public static ANetApiResponse Run(
            String _cardNumber,
            String _expirationDate,
            String _cardCode,
            String _email,
            String _firstName,
            String _lastName,
            String _address,
            String _city,
            String _zip,          
            decimal _amount
            )
        {
            String ApiTransactionKey = "XXXXXXXXXXXXXX";
            String ApiLoginID = "ZZZZZZZZZZZZ";

            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
            ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.PRODUCTION;
            ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
            {
                name = ApiLoginID,
                ItemElementName = ItemChoiceType.transactionKey,
                Item = ApiTransactionKey,
            };   

            var creditCard = new creditCardType
            {
                cardNumber = _cardNumber,
                expirationDate = _expirationDate,
                cardCode = _cardCode
            };

            var customerInfo = new Customer
            {
                Email = _email
            };

            var billingAddress = new customerAddressType
            {
                firstName = _firstName,
                lastName = _lastName,           
                address = _address,            
                city = _city,
                zip = _zip,
                email = _email
            };

            //standard api call to retrieve response

            var paymentType = new paymentType { Item = creditCard };

            // Add line Items
            var lineItems = new lineItemType[2];
            lineItems[0] = new lineItemType {description= "", itemId = "1", name = "ZZZZZZZZZZZZZ", quantity = 1, unitPrice = _amount };
            
            var transactionRequest = new transactionRequestType
            {
                transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),    // charge the card
                amount = _amount,
                payment = paymentType,
                billTo = billingAddress,
                lineItems = lineItems        

            };
            
            var request = new createTransactionRequest { transactionRequest = transactionRequest };

            // instantiate the contoller that will call the service

            var controller = new createTransactionController(request);
            controller.Execute();

            // get the response from the service (errors contained if any)

            var response = controller.GetApiResponse();

 

 

Posts: 491
Topics: 0
Kudos: 96
Blog Posts: 0
Ideas: 0
Solutions: 41
Registered: ‎04-28-2017

Re: Email not being added to customer transactions

Try ...

 var customerInfo = new customerDataType
            {
                email = _email
            };
 var transactionRequest = new transactionRequestType
            {
                transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),    // charge the card
                customer = customerInfo,
                amount = amount,
                payment = paymentType,
                billTo = billingAddress,
                lineItems = lineItems
            };
Powered by NexWebSites.com -
Certified Authorize.net developers