cancel
Showing results for 
Search instead for 
Did you mean: 

E00040 when Creating Subscription from Customer Profile

I am using the CIM and ARB modules in the sandbox environment. I am also using the PHP API. The code that is now failing (it was working just a few weeks ago) first creates a Customer Profile from a TXN. Next, the code makes a call using a method much like the createSubscriptionFromCustomerProfile method from your API documentation. It's during this method call that the E00040 error is thrown. The API documentation states that when this error is thrown, either the Customer Profile ID, or the Payment Profile ID could not be found. However, you can check the Authorize system, and the ID's ARE there.

 

I have read several posts going back a few years with developers asking about the exact same error as I am. If there is a solution, please be so kind as to point me to the correct message post. However, from all the posts that I have read, there never seemed to be a solid answer.

 

BTW, I too can take the exact same method parameters that were used when the E00040 was thrown, try them again, and this time the subscrition is created; no errors. Please help.

griffira59
Member
25 REPLIES 25

Hello @BrandonSurowiec

 

I've escalated your issue to the product support specialist team.  Could you also create a support ticket if you have not already so your issue is properly tracked through resolution.

 

Richard

Done, thanks :)

Thanks @BrandonSurowiec

 

I spoke with a specialist, she asked for some additional detail if you could please add to ticket and post the case # here for me to pass on.

 

She asked for the raw request and response (omitting Trans Key) or the URL where we can repro. Also like to know what API Login ID to query to review the logs if they can provide this information as well that would be helpful.

 

Richard

 

 

Ticket #1-427666651

 

I'll work on getting the information requested.

This is now my 3rd time replying to this thread, not sure why my replies are being moderated...

 

I'm having the same issue in the sandbox.  Steps:

1) createTransactionRequest with transactionType=authCaptureTransaction and createProfile=true

2) immedietly use customerProfileId in response from createTransactionRequest to call ARBCreateSubscriptionRequest

3) ARBCreateSubscriptionRequest returns E00040

 

If I sleep 20 seconds before step 3, it works.

Richard,

 

Thanks for your response. I posted this message a few months ago and, unfortunately, continue to have the exact same problem. I'm using the CIM and ARB modules in the sandbox environment. The login ID is 7f74PwmmNCp . There has been active testing over the last two or more months using that login ID.

 

I basically created a wrapper for the AuthorizeNet PHP module. The two main functions involved have been pasted below. They were created by following the Authorize documentation.

 

The first function 'createCustomerProfileFromTxn' does basically just that; it takes a previously successful CC txn ID, then communicates with the sandbox to create an Authorize customer profile. Next, the function 'createSubscriptionFromAuthCustomer' communicates with the sanbox, sending the new customer profile ID and payment profile ID (and other required fields) which should result in the creation of an Authorize subscription.

 

However, I ALWAYS get the E00040 error code returned from the method that attempts to create the Subscription UNLESS I sleep() for a MINIMUM of 15 seconds AFTER creating the Customer Profile (which, by the way, always works without a hitch). I have even tried to destroy my wrapper object, then re-initializing and re-connecting between these method calls, to no avail.

 

We are hoping to be moving into production by October. I really hope this can be resolved by then, or, have you seen this same problem in production?

 

Thank You,

 

Ralph

 

/**
    * Description:
    * @author: Ralph Griffith, ralphgriffith59@gmail.com
    * @version: 1.0.0
    * @since: Feb 28, 2017
    * @Param string $x_trans_id (numeric string)
    * @Param integer $tboMerchantId
    * @Param string $genReqId
    * @return \net\authorize\api\contract\v1\AnetApiResponseType
    * see https://developer.authorize.net/api/reference/index.html#customer-profiles
    */
    public function createCustomerProfileFromTxn($x_trans_id, $tboMerchantAccountingId, $email, $genReqId) {        
        $customerProfile = new CustomerProfileBaseType();
        $customerProfile->setMerchantCustomerId($tboMerchantAccountingId);
        $customerProfile->setEmail($email);
        $customerProfile->setDescription(authorizeGatewayController::AUTH_CUST_PROFILE_DESC);
        
        //request FNACP = request For New Auth Customer Profile
        $requestFNACP = new CreateCustomerProfileFromTransactionRequest();
        $requestFNACP->setMerchantAuthentication($this->merchantAuthentication);
        $requestFNACP->setTransId($x_trans_id); //The Auth supplied TXN Id
        //For tracking prposes, continue to mark requests with our $genReqId
        $requestFNACP->setRefId($genReqId);
        
        //Set the Profile Object
        $requestFNACP->setCustomer($customerProfile);
        $ccpController = new CreateCustomerProfileFromTransactionController($requestFNACP);
        return $ccpController->executeWithApiResponse($this::AUTH_API_ENV);
    }

 

AND:

 

    /**
    * Description:
    * @author: Ralph Griffith, ralphgriffith59@gmail.com
    * @version: 1.0.0
    * @since: Jun 9, 2017
    * @Param unknown $authCustProfileId
    * @Param unknown $authCustPaymentProfileId
    * @Param unknown $x_Invoice_Num
    * @Param unknown $subscriptionTitle
    * @Param unknown $numIntervalsBetweenPayments
    * @Param unknown $billingStartDate
    * @Param unknown $trialOccurrances
    * @Param unknown $totalOccurrances
    * @Param unknown $x_amount
    * @Param unknown $trialAmount
    * @Param unknown $genReqId
    * @return \net\authorize\api\contract\v1\AnetApiResponseType
    */
    public function createSubscriptionFromAuthCustomer($authCustProfileId, $authCustPaymentProfileId, $x_Invoice_Num, $subscriptionTitle,
            $numIntervalsBetweenPayments, $billingStartDate, $trialOccurrances, $totalOccurrances, $costPerInterval, $trialAmount, $genReqId) {
        
        $subscription = new ARBSubscriptionType();
        $subscription->setName($subscriptionTitle);
            
        $order = new OrderType();
        $order->setInvoiceNumber($x_Invoice_Num);
        $order->setDescription($subscriptionTitle);
        $subscription->setOrder($order);
            
        $interval = new IntervalAType();
        $interval->setLength($numIntervalsBetweenPayments); // Frequency of Billing Occurrences (every 3 months (Q), or 1 per month (M))
        $interval->setUnit('months'); // 'months', ALWAYS months in this revision (After SBL Pricing revised)
            
        $paymentSchedule = new PaymentScheduleType();
        $paymentSchedule->setInterval($interval);
        $paymentSchedule->setStartDate($billingStartDate);// == First billing date == Date the Trial Period ends
        // 9999 for recurring, otherwise 'Total Occurances' is just the number of payments within
        // the Subscription ie, 2 for Quarterly, 6 for Monthly        
        $paymentSchedule->setTotalOccurrences($totalOccurrances);
        $paymentSchedule->setTrialOccurrences($trialOccurrances);
                            
        $subscription->setPaymentSchedule($paymentSchedule);
        $subscription->setAmount($costPerInterval);
        $subscription->setTrialAmount($trialAmount); // Should always be set to $0
                            
        $profile = new CustomerProfileIdType();
        $profile->setCustomerProfileId($authCustProfileId);
        $profile->setCustomerPaymentProfileId($authCustPaymentProfileId);
            
        $subscription->setProfile($profile);
            
        $request = new ARBCreateSubscriptionRequest();
        $request->setmerchantAuthentication($this->merchantAuthentication);
        $request->setRefId($genReqId);
        $request->setSubscription($subscription);
        $csController = new ARBCreateSubscriptionController($request);
            
        return $csController->executeWithApiResponse($this::AUTH_API_ENV);
    }

Hello @griffira59

 

The challenge here is both architecture and performance scale in our sandbox and not your code.  Our production systems are scaled to process millions of requests per day, however our sandbox does not have the same scale.

 

Architecturally, when you create a customer profile from a transaction, the profile is created in real time.  When you want to USE a customer profile, in your case to create a subscription, the request is serviced using replicated data to improve performance.  As you've seen, you'll get an E00040 if replication has not completed in which case you must retry.

 

You should not have the same delay in production but we cannot guarantee there won't be some delay.

 

I know this doesn't answer your entire question, but we have communicated the challenge to our teams.

 

Richard

Richard,

 

Thanks for the latest, prompt reply.

 

I was hoping that what you described, as far as sandbox infrastructure, was the root issue. As noted, we are comfortable with what, by all accounts, seems to be a very reasonable explanation. We will monitor this particular area when moved to production.

 

Again, thanks for your attention to this matter.

 

Ralph

Thanks for your response. I posted this message a few months ago and, unfortunately, continue to have the exact same problem. I'm using the CIM and ARB modules in the sandbox environment. The login ID is 7f74PwmmNCp. There has been active testing over the last two or more months using that login ID.

 

I basically created a wrapper for the AuthorizeNet PHP module. The two main functions involved have been pasted below. They were created by following the Authorize documentation.

Hi @kankikara,

 

I had to edit your post to remove some spam links. If those were placed intentionally, please don't do that. More likely, your system has been compromised by malware that's intercepting your post to include spam links. Please address that ASAP.

 

Once that's done, let us know if there's something else we can do to help on this issue. Have you already tried inserting a bit of delay as recommended elsewhere in this thread?