- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can someone please help me figure out why I am getting E00007 based on this code.
If you need aditional files, I can provide the code as I am new to this.
I am switching over from SANDBOX to PRODUCTION.
Thank you in advance!
<?php require(dirname(__FILE__) . '/Authorize/vendor/autoload.php'); use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\controller as AnetController; define("AUTHORIZENET_LOG_FILE", "phplog"); class Authorize { function authorizeCreditCard($options){ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($options['merchant_login_id']); $merchantAuthentication->setTransactionKey($options['merchant_transaction_key']); $refId = 'ref' . time(); $creditCard = new AnetAPI\CreditCardType(); $creditCard->setCardNumber($options['card_number']); $creditCard->setExpirationDate($options['expiry_year'].'-'.$options['expiry_month']); $creditCard->setCardCode($options['card_code']); $paymentOne = new AnetAPI\PaymentType(); $paymentOne->setCreditCard($creditCard); $order = new AnetAPI\OrderType(); $order->setInvoiceNumber($options['invoice_number']); $order->setDescription($options['description']); $customerAddress = new AnetAPI\CustomerAddressType(); $customerAddress->setFirstName($options['first_name']); $customerAddress->setLastName($options['last_name']); $customerAddress->setAddress($options['address']); $customerAddress->setCity($options['city']); $customerAddress->setState($options['state']); $customerAddress->setZip($options['zip_code']); $customerAddress->setCountry($options['country']); // Set the customer's identifying information $customerData = new AnetAPI\CustomerDataType(); $customerData->setType("individual"); $customerData->setId($options['cust_id']); $customerData->setEmail($options['email']); // Create a TransactionRequestType object and add the previous objects to it $transactionRequestType = new AnetAPI\TransactionRequestType(); $transactionRequestType->setTransactionType("authCaptureTransaction"); $transactionRequestType->setAmount($options['amount']); $transactionRequestType->setOrder($order); $transactionRequestType->setPayment($paymentOne); $transactionRequestType->setBillTo($customerAddress); $transactionRequestType->setCustomer($customerData); //$transactionRequestType->addToTransactionSettings($duplicateWindowSetting); $request = new AnetAPI\CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setTransactionRequest($transactionRequestType); $controller = new AnetController\CreateTransactionController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION); return $response; } function createSubscription($options){ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($options['merchant_login_id']); $merchantAuthentication->setTransactionKey($options['merchant_transaction_key']); $refId = 'ref' . time(); $subscription = new AnetAPI\ARBSubscriptionType(); $subscription->setName($options['subscription_name']); $interval = new AnetAPI\PaymentScheduleType\IntervalAType(); $interval->setLength($options['interval']); $interval->setUnit($options['unit']); $paymentSchedule = new AnetAPI\PaymentScheduleType(); $paymentSchedule->setInterval($interval); $paymentSchedule->setStartDate(new DateTime($options['start_date'])); $paymentSchedule->setTotalOccurrences("120"); $paymentSchedule->setTrialOccurrences("1"); $subscription->setPaymentSchedule($paymentSchedule); $subscription->setAmount($options['amount']); $subscription->setTrialAmount($options['trial_amount']); $creditCard = new AnetAPI\CreditCardType(); $creditCard->setCardNumber($options['card_number']); $creditCard->setExpirationDate($options['expiry_year'].'-'.$options['expiry_month']); $creditCard->setCardCode($options['card_code']); $payment = new AnetAPI\PaymentType(); $payment->setCreditCard($creditCard); $subscription->setPayment($payment); $order = new AnetAPI\OrderType(); $order->setInvoiceNumber($options['invoice_number']); $order->setDescription($options['description']); $subscription->setOrder($order); $billTo = new AnetAPI\NameAndAddressType(); $billTo->setFirstName($options['first_name']); $billTo->setLastName($options['last_name']); $billTo->setAddress($options['address']); $billTo->setCity($options['city']); $billTo->setState($options['state']); $billTo->setZip($options['zip_code']); $billTo->setCountry($options['country']); $subscription->setBillTo($billTo); $request = new AnetAPI\ARBCreateSubscriptionRequest(); $request->setmerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setSubscription($subscription); $controller = new AnetController\ARBCreateSubscriptionController($request); $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION); return $response; } function renewalSubscription($options) { $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($options['merchant_login_id']); $merchantAuthentication->setTransactionKey($options['merchant_transaction_key']); $refId = 'ref' . time(); $subscription = new AnetAPI\ARBSubscriptionType(); $subscription->setName($options['subscription_name']); $interval = new AnetAPI\PaymentScheduleType\IntervalAType(); $interval->setLength($options['interval']); $interval->setUnit($options['unit']); $paymentSchedule = new AnetAPI\PaymentScheduleType(); $paymentSchedule->setInterval($interval); $paymentSchedule->setStartDate(new DateTime($options['start_date'])); $paymentSchedule->setTotalOccurrences("120"); $paymentSchedule->setTrialOccurrences("1"); $subscription->setPaymentSchedule($paymentSchedule); $subscription->setAmount($options['amount']); $subscription->setTrialAmount($options['trial_amount']); $profile = new AnetAPI\CustomerProfileIdType(); $profile->setCustomerProfileId($options['customer_profileid']); $profile->setCustomerPaymentProfileId($options['customer_payment_profileid']); $subscription->setProfile($profile); $request = new AnetAPI\ARBCreateSubscriptionRequest(); $request->setmerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setSubscription($subscription); $controller = new AnetController\ARBCreateSubscriptionController($request); $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION); return $response; } function updateCreditCard($options){ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($options['merchant_login_id']); $merchantAuthentication->setTransactionKey($options['merchant_transaction_key']); $refId = 'ref' . time(); $subscription = new AnetAPI\ARBSubscriptionType(); $creditCard = new AnetAPI\CreditCardType(); $creditCard->setCardNumber($options['card_number']); $creditCard->setExpirationDate($options['expiry_year'].'-'.$options['expiry_month']); $creditCard->setCardCode($options['cvv']); $payment = new AnetAPI\PaymentType(); $payment->setCreditCard($creditCard); $subscription->setPayment($payment); $request = new AnetAPI\ARBUpdateSubscriptionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setSubscriptionId($options['subscriptionid']); $request->setSubscription($subscription); $controller = new AnetController\ARBUpdateSubscriptionController($request); $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION); return $response; } function updateSubscription($options){ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($options['merchant_login_id']); $merchantAuthentication->setTransactionKey($options['merchant_transaction_key']); $refId = 'ref' . time(); $subscription = new AnetAPI\ARBSubscriptionType(); $subscription->setName($options['subscription_name']); $subscription->setAmount($options['amount']); $order = new AnetAPI\OrderType(); $order->setDescription($options['description']); $subscription->setOrder($order); $profile = new AnetAPI\CustomerProfileIdType(); $profile->setCustomerProfileId($options['customer_profileid']); $profile->setCustomerPaymentProfileId($options['customer_payment_profileid']); $subscription->setProfile($profile); $request = new AnetAPI\ARBUpdateSubscriptionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setSubscriptionId($options['subscriptionid']); $request->setSubscription($subscription); $controller = new AnetController\ARBUpdateSubscriptionController($request); $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION); return $response; } function cancelSubscription($options){ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($options['merchant_login_id']); $merchantAuthentication->setTransactionKey($options['merchant_transaction_key']); $refId = 'ref' . time(); $request = new AnetAPI\ARBCancelSubscriptionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setSubscriptionId($options['subscriptionid']); $controller = new AnetController\ARBCancelSubscriptionController($request); $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION); return $response; } }
Solved! Go to Solution.
01-22-2020 08:03 PM - edited 01-22-2020 08:05 PM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I fxied it by requesting a new transaction key. No additional code changes took place.
01-23-2020 07:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I fxied it by requesting a new transaction key. No additional code changes took place.
01-23-2020 07:06 AM

