Reply
Member
Posts: 4
Registered: ‎01-11-2017

Email field Null in Card Payment.

Hello Friends,

 

Good Afternoon.

 

Recentaly I Found a new Problem Regarding a Card Payment.

 

I am Setting Fields "Email" in my code but i am not Seeing that in authorized.net Tansaction Laog.

 

Here is My Code:

 

        $refId = 'ref' . time();
        
        // Create the payment data for a credit card
        $creditCard = new AnetAPI\CreditCardType();
        $creditCard->setCardNumber($input['card_num']);
        $creditCard->setExpirationDate($input['exp_month'] . '/' . $input['exp_year']);
        $creditCard->setCardCode($input['ccv']);
        $paymentOne = new AnetAPI\PaymentType();
        $paymentOne->setCreditCard($creditCard);

        $billto = new AnetAPI\CustomerAddressType();
        $billto->setFirstName($input['first_name']);
        $billto->setLastName($input['last_name']);
        $billto->setAddress($input['billing_address']);
        $billto->setCity($input['billing_city']);
        $billto->setState($input['billing_state']);
        $billto->setZip($input['billing_zip']);
        $billto->setCountry("US");
        $billto->setEmail($input['email_address']);
        $billto->setPhoneNumber($input['phone']);

        $shipTo = new AnetAPI\NameAndAddressType();
        $shipTo->setAddress($input['address']);
        $shipTo->setCity($input['city']);
        $shipTo->setState($input['state']);
        $shipTo->setZip($input['zip_code']);
        $shipTo->setCountry("US");

        $order = new AnetAPI\OrderType();
        $order->setDescription($description);

        //create a transaction
        $transactionRequestType = new AnetAPI\TransactionRequestType();
        $transactionRequestType->setTransactionType("authCaptureTransaction");
        $transactionRequestType->setAmount($input['one_time_gift']);
        $transactionRequestType->setPayment($paymentOne);

        //$transactionRequestType->setPoNumber($input['phone']);
        $transactionRequestType->setBillTo($billto);
        $transactionRequestType->setShipTo($shipTo);
        $transactionRequestType->setOrder($order);


        $request = new AnetAPI\CreateTransactionRequest();

        $request->setMerchantAuthentication($this->merchantAuthentication);
        $request->setRefId($refId);
        $request->setTransactionRequest($transactionRequestType);

        $controller = new AnetController\CreateTransactionController($request);

        $response = $controller->executeWithApiResponse($this->Sandbox);

        $result = $response->getTransactionResponse();

 

 

I Got all the Fields in Log except Email Field. I have checked that email Field is successfully Set in CreateTransactionRequest Object.

 

Here is the Responce  in Authorized.net Transaction Log:

Name:Tester Testing
Company: -
Address:Testing
City:Testing
State/Province:VA
Zip Code:22309
Country:US
Phone:11231234567
Fax: 
Email:

 

i have to set email field but don't know because some reason this fields is not setting.

 

here is my CreateTransactionRequest Object :

 

object(net\authorize\api\contract\v1\CreateTransactionRequest)#406 (4) {
  ["transactionRequest":"net\authorize\api\contract\v1\CreateTransactionRequest":private]=>
  object(net\authorize\api\contract\v1\TransactionRequestType)#407 (27) {
    ["transactionType":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    string(22) "authCaptureTransaction"
    ["amount":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    string(2) "30"
    ["currencyCode":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["payment":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    object(net\authorize\api\contract\v1\PaymentType)#411 (7) {
      ["creditCard":"net\authorize\api\contract\v1\PaymentType":private]=>
      object(net\authorize\api\contract\v1\CreditCardType)#412 (5) {
        ["cardCode":"net\authorize\api\contract\v1\CreditCardType":private]=>
        string(3) "323"
        ["isPaymentToken":"net\authorize\api\contract\v1\CreditCardType":private]=>
        NULL
        ["cryptogram":"net\authorize\api\contract\v1\CreditCardType":private]=>
        NULL
        ["cardNumber":"net\authorize\api\contract\v1\CreditCardSimpleType":private]=>
        string(13) "4007000000027"
        ["expirationDate":"net\authorize\api\contract\v1\CreditCardSimpleType":private]=>
        string(7) "01/2019"
      }
      ["bankAccount":"net\authorize\api\contract\v1\PaymentType":private]=>
      NULL
      ["trackData":"net\authorize\api\contract\v1\PaymentType":private]=>
      NULL
      ["encryptedTrackData":"net\authorize\api\contract\v1\PaymentType":private]=>
      NULL
      ["payPal":"net\authorize\api\contract\v1\PaymentType":private]=>
      NULL
      ["opaqueData":"net\authorize\api\contract\v1\PaymentType":private]=>
      NULL
      ["emv":"net\authorize\api\contract\v1\PaymentType":private]=>
      NULL
    }
    ["profile":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["solution":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["callId":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["terminalNumber":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["authCode":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["refTransId":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["splitTenderId":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["order":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    object(net\authorize\api\contract\v1\OrderType)#408 (2) {
      ["invoiceNumber":"net\authorize\api\contract\v1\OrderType":private]=>
      NULL
      ["description":"net\authorize\api\contract\v1\OrderType":private]=>
      string(23) "Recurring donation: $30"
    }
    ["lineItems":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["tax":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["duty":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["shipping":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["taxExempt":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["poNumber":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["customer":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["billTo":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    object(net\authorize\api\contract\v1\CustomerAddressType)#410 (11) {
      ["phoneNumber":"net\authorize\api\contract\v1\CustomerAddressType":private]=>
      string(10) "9426383160"
      ["faxNumber":"net\authorize\api\contract\v1\CustomerAddressType":private]=>
      NULL
      ["email":"net\authorize\api\contract\v1\CustomerAddressType":private]=>
      string(35) "jaimin.vadher@aavidtechnologies.com"
      ["firstName":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(4) "demo"
      ["lastName":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(4) "user"
      ["company":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      NULL
      ["address":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(12) "demo address"
      ["city":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(11) "Ahmedabadff"
      ["state":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(2) "NM"
      ["zip":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(6) "123456"
      ["country":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(2) "US"
    }
    ["shipTo":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    object(net\authorize\api\contract\v1\NameAndAddressType)#409 (8) {
      ["firstName":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      NULL
      ["lastName":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      NULL
      ["company":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      NULL
      ["address":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(12) "demo address"
      ["city":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(11) "Ahmedabadff"
      ["state":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(2) "NM"
      ["zip":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(6) "123456"
      ["country":"net\authorize\api\contract\v1\NameAndAddressType":private]=>
      string(2) "US"
    }
    ["customerIP":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["cardholderAuthentication":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["retail":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["employeeId":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["transactionSettings":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
    ["userFields":"net\authorize\api\contract\v1\TransactionRequestType":private]=>
    NULL
  }
  ["merchantAuthentication":"net\authorize\api\contract\v1\ANetApiRequestType":private]=>
  object(net\authorize\api\contract\v1\MerchantAuthenticationType)#426 (8) {
    ["name":"net\authorize\api\contract\v1\MerchantAuthenticationType":private]=>
    string(10) "8bSfhLA55J"
    ["transactionKey":"net\authorize\api\contract\v1\MerchantAuthenticationType":private]=>
    string(16) "4r996DZxxAh869x8"
    ["sessionToken":"net\authorize\api\contract\v1\MerchantAuthenticationType":private]=>
    NULL
    ["password":"net\authorize\api\contract\v1\MerchantAuthenticationType":private]=>
    NULL
    ["impersonationAuthentication":"net\authorize\api\contract\v1\MerchantAuthenticationType":private]=>
    NULL
    ["fingerPrint":"net\authorize\api\contract\v1\MerchantAuthenticationType":private]=>
    NULL
    ["clientKey":"net\authorize\api\contract\v1\MerchantAuthenticationType":private]=>
    NULL
    ["mobileDeviceId":"net\authorize\api\contract\v1\MerchantAuthenticationType":private]=>
    NULL
  }
  ["clientId":"net\authorize\api\contract\v1\ANetApiRequestType":private]=>
  NULL
  ["refId":"net\authorize\api\contract\v1\ANetApiRequestType":private]=>
  string(13) "ref1490261535"
}

 

help me to set email field. what are the posible reason?

 

Thanks,

Jaimin

All Star
Posts: 699
Registered: ‎11-03-2016

Re: Email field Null in Card Payment.

Hi @jaimin,

 

In our documentation for payment transactions, 'email' is part of the 'customer' element, not part of the 'billTo' element.

 

Try this: Take the email out of the billTo settings, and create an object of customer data settings like this:

    // Set the customer's identifying information
    $customerData = new AnetAPI\CustomerDataType();
    $customerData->setType("individual");
    $customerData->setId("99999456654");
    $customerData->setEmail("EllenJohnson@example.com");

Then set that into your transaction request:

    $transactionRequestType->setCustomer($customerData);

If it's still confusing, check our sample code.