cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Customer email missing in Sandbox environment

I am prototyping a payment solution for a site, which requires an email receipt to be sent to the customer after a successful transaction. I installed the Authorize.net package via NuGet to my MVC project, and initial transaction testing has been successful in the sandbox environment. I am getting a response back for both successful and unsuccessful transactions. I am also receiving a merchant email after the successful transaction.

 

However, the customer receipt is not being sent. I have gone through the documentation from this, but can't seem to get the customer receipt to send. With further digging, I realized that setting Gateway "TestMode" to true may be the culprit for this. But, as I explored this object, I realized that the constants being used for the gateway URL are not what I want to use for Sandbox development. I can't seem to find a way to modify the URL to point to the Sandbox environment.

 

Any help would be greatly appreciated.

 

Metadata code for from AuthorizeNet reference

namespace AuthorizeNet
{
    public class Gateway : IGateway
    {
        public const string LIVE_URL = "https://secure2.authorize.net/gateway/transact.dll";
        public const string TEST_URL = "https://test.authorize.net/gateway/transact.dll";

        public Gateway(string apiLogin, string transactionKey);
        public Gateway(string apiLogin, string transactionKey, bool testMode);

        public string ApiLogin { get; set; }
        public bool TestMode { get; set; }
        public string TransactionKey { get; set; }

        public IGatewayResponse DecideResponse(string[] rawResponse);
        protected void LoadAuthorization(IGatewayRequest request);
        public IGatewayResponse Send(IGatewayRequest request);
        public virtual IGatewayResponse Send(IGatewayRequest request, string description);
        protected string SendRequest(string serviceUrl, IGatewayRequest request);
    }
}

 

//Current code that I am using to process successful transactions.

 

var login = ConfigurationManager.AppSettings["AuthorizeApiLogin"];
var transactionKey = ConfigurationManager.AppSettings["AuthorizeTransactionKey"];

NameValueCollection nvc = new NameValueCollection();

nvc.Add(ApiFields.CreditCardNumber, pvm.CardNumber);
nvc.Add(ApiFields.CreditCardCode, pvm.CardVerificationCode);
nvc.Add(ApiFields.CreditCardExpiration, pvm.ExpMonth + "/" + pvm.ExpYear);
nvc.Add(ApiFields.Zip, pvm.BillingZipCode);
nvc.Add(ApiFields.Amount, pvm.PaymentAmount.ToString());
nvc.Add(ApiFields.Email, email);
nvc.Add(ApiFields.EmailCustomer, "TRUE");
nvc.Add(ApiFields.HeaderEmailReceipt, "DA Header");
nvc.Add(ApiFields.FooterEmailReceipt, "DA Footer");
nvc.Add("x_Custom_Message", "Custom message");

//this is set to test mode - Need to modify URL for Sandblx.
var gate = new Gateway(login, transactionKey, true);

pvm.GatewayRequest = new AuthorizationRequest(nvc);

//send to Auth.NET
pvm.GatewayResponse = gate.Send(pvm.GatewayRequest);

if (pvm.GatewayResponse.Approved)
{
	pvm.ResponseSuccess = true;
	pvm.ResponseError = false;
	pvm.ResponseMessage = pvm.GatewayResponse.Message;
	pvm.ResponseTransactionID = pvm.GatewayResponse.TransactionID;
}
else
{
	pvm.ResponseSuccess = false;
	pvm.ResponseError = true;
	pvm.ResponseErrorMessage = pvm.GatewayResponse.Message;
}
SpotOps
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Hmm... Looking at the transaction, I don't see an email address that posted.

 

So, that got me looking at supplying the transaction values directly to the Gateway AuthorizationRequest. When I did this, I got the customer email receipt.

 

Thanks for pointing me in the right direction, . Much appreciated.

 

Here is the code that was working for me. //Commented out old code.

 

var login = ConfigurationManager.AppSettings["AuthorizeApiLogin"];
var transactionKey = ConfigurationManager.AppSettings["AuthorizeTransactionKey"];

NameValueCollection nvc = new NameValueCollection();

//nvc.Add(ApiFields.CreditCardNumber, pvm.CardNumber);
//nvc.Add(ApiFields.CreditCardCode, pvm.CardVerificationCode);
//nvc.Add(ApiFields.CreditCardExpiration, pvm.ExpMonth + "/" + pvm.ExpYear);
//nvc.Add(ApiFields.Zip, pvm.BillingZipCode);
//nvc.Add(ApiFields.Amount, pvm.PaymentAmount.ToString());
//nvc.Add(ApiFields.Email, email);
//nvc.Add(ApiFields.EmailCustomer, "TRUE");
//nvc.Add(ApiFields.HeaderEmailReceipt, "DA Header");
//nvc.Add(ApiFields.FooterEmailReceipt, "DA Footer");

pvm.GatewayRequest = new AuthorizationRequest(nvc);
pvm.GatewayRequest.CardNum = pvm.CardNumber;
pvm.GatewayRequest.CardCode = pvm.CardVerificationCode;
pvm.GatewayRequest.ExpDate = pvm.ExpMonth + "/" + pvm.ExpYear;
pvm.GatewayRequest.Zip = pvm.BillingZipCode;
pvm.GatewayRequest.Amount = pvm.PaymentAmount.ToString();
pvm.GatewayRequest.Email = email;
pvm.GatewayRequest.EmailCustomer = "TRUE";
pvm.GatewayRequest.HeaderEmailReceipt = "Custom Header";
pvm.GatewayRequest.FooterEmailReceipt = "Custom Footer";
pvm.GatewayRequest.Description = "Custom Description";
					   
//this is set to test mode - change as needed.
var gate = new Gateway(login, transactionKey, true);
//send to Auth.NET
pvm.GatewayResponse = gate.Send(pvm.GatewayRequest);

if (pvm.GatewayResponse.Approved)
{
	pvm.ResponseSuccess = true;
	pvm.ResponseError = false;
	pvm.ResponseMessage = pvm.GatewayResponse.Message;
	pvm.ResponseTransactionID = pvm.GatewayResponse.TransactionID;
}
else
{
	pvm.ResponseSuccess = false;
	pvm.ResponseError = true;
	pvm.ResponseErrorMessage = pvm.GatewayResponse.Message; 
}

 

View solution in original post

6 REPLIES 6

That only for point to sandbox or production server. You will need to turn of testmode on your merchant account.

 

When the last param is true, it send to the sandbox url

//this is set to test mode - Need to modify URL for Sandblx.
var gate = new Gateway(login, transactionKey, true);

 

 

https://sandbox.authorize.net/

under account settings

RaynorC1emen7
Expert

Thank you for the quick response. I double checked the test mode transaction processing under account settings on my merchant account, and it is set to "Live". Is there something else from the merchant account that I am needing to have set to enable the customer email?

 

Under the Account -> Email Receipts, I have the "Email transaction receipt to customer (if email address is provided)" checked, and some dummy text in the Email Header and Email Footer section.

Maybe is the email address itself? could it be blocking authorize.net email?

That occured to me as well. The email address I am providing is in the same domain as the email address that receives the merchant email confirmation. I have checked spam settings/folder for this account, and it doesn't seem to be rejecting anything.

Can you find the transaction in the merchant account? and see if the customer email is populated?

Hmm... Looking at the transaction, I don't see an email address that posted.

 

So, that got me looking at supplying the transaction values directly to the Gateway AuthorizationRequest. When I did this, I got the customer email receipt.

 

Thanks for pointing me in the right direction, . Much appreciated.

 

Here is the code that was working for me. //Commented out old code.

 

var login = ConfigurationManager.AppSettings["AuthorizeApiLogin"];
var transactionKey = ConfigurationManager.AppSettings["AuthorizeTransactionKey"];

NameValueCollection nvc = new NameValueCollection();

//nvc.Add(ApiFields.CreditCardNumber, pvm.CardNumber);
//nvc.Add(ApiFields.CreditCardCode, pvm.CardVerificationCode);
//nvc.Add(ApiFields.CreditCardExpiration, pvm.ExpMonth + "/" + pvm.ExpYear);
//nvc.Add(ApiFields.Zip, pvm.BillingZipCode);
//nvc.Add(ApiFields.Amount, pvm.PaymentAmount.ToString());
//nvc.Add(ApiFields.Email, email);
//nvc.Add(ApiFields.EmailCustomer, "TRUE");
//nvc.Add(ApiFields.HeaderEmailReceipt, "DA Header");
//nvc.Add(ApiFields.FooterEmailReceipt, "DA Footer");

pvm.GatewayRequest = new AuthorizationRequest(nvc);
pvm.GatewayRequest.CardNum = pvm.CardNumber;
pvm.GatewayRequest.CardCode = pvm.CardVerificationCode;
pvm.GatewayRequest.ExpDate = pvm.ExpMonth + "/" + pvm.ExpYear;
pvm.GatewayRequest.Zip = pvm.BillingZipCode;
pvm.GatewayRequest.Amount = pvm.PaymentAmount.ToString();
pvm.GatewayRequest.Email = email;
pvm.GatewayRequest.EmailCustomer = "TRUE";
pvm.GatewayRequest.HeaderEmailReceipt = "Custom Header";
pvm.GatewayRequest.FooterEmailReceipt = "Custom Footer";
pvm.GatewayRequest.Description = "Custom Description";
					   
//this is set to test mode - change as needed.
var gate = new Gateway(login, transactionKey, true);
//send to Auth.NET
pvm.GatewayResponse = gate.Send(pvm.GatewayRequest);

if (pvm.GatewayResponse.Approved)
{
	pvm.ResponseSuccess = true;
	pvm.ResponseError = false;
	pvm.ResponseMessage = pvm.GatewayResponse.Message;
	pvm.ResponseTransactionID = pvm.GatewayResponse.TransactionID;
}
else
{
	pvm.ResponseSuccess = false;
	pvm.ResponseError = true;
	pvm.ResponseErrorMessage = pvm.GatewayResponse.Message; 
}