cancel
Showing results for 
Search instead for 
Did you mean: 

URGENT: authorize.net Production account accepts test credit cards - other people reported it too

Dear all,

I'm at my wit's end as to why, but https://api.authorize.net/xml/v1/request.api accepts test card numbers for monthly subscription:

- American Express Test Card: 370000000000002
- Discover Test Card: 6011000000000012
- Visa Test Card: 4007000000027
- Second Visa Test Card: 4012888818888

 

You can try it yourself:

http://webservicecenter.net/uportal4/tools/tests/authorizeNetSubscription.jsp?cardExpirationYear=201...

(You may need to change "cardOwnerFirstName" and/or "cardOwnerLastName", and "cardChargeAmount" to avoid "duplicate subscription" error. 

 

The code is directly from http://developer.authorize.net/resources/files/samplecode/java_arb.zip (CreateSubscriptionExample.java)


Check the live code below. Also, I'm not the only one that noticed it:

http://stackoverflow.com/questions/6151308/authorize-net-production-account-accepts-test-credit-card...


I'd really appreciate any pointers as to why this is happening. 

Live code from the first link above (except the account data):

<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.text.*"%>
<%@ page import="javax.servlet.http.*"%>
<%@ page import="java.net.*" %>
<%@ page import="java.io.*" %>

<%@ page import="com.anet.api.*"%>
<%@ page import="com.anet.api.http.HttpUtil"%>

<%

// Before working with this sample code, please be sure to read the accompanying Readme.txt file.
// It contains important information regarding the appropriate use of and conditions for this
// sample code. Also, please pay particular attention to the comments included in each individual
// code file, as they will assist you in the unique and correct implementation of this code on
// your specific platform.
//
// Copyright 2008 Authorize.Net Corp.

        // {api-url} {user-login} {transaction-key}
            // subscription:
              java.net.URL apiUrl=new java.net.URL("https://api.authorize.net/xml/v1/request.api"); // live server

             String apiLogin="";
             String transactionKey="";

            // API constructor - url, merchant id, token key
            ARBAPI api = new ARBAPI(apiUrl, apiLogin, transactionKey);


        // getting the passed variables:
            // credit card number:
            String cardNumber=request.getParameter("cardNumber");
                if (cardNumber==null) cardNumber="0";

            // credit card expiration:
            String cardExpirationYear=request.getParameter("cardExpirationYear");
                if (cardExpirationYear==null) cardExpirationYear="0";

            String cardExpirationMonth=request.getParameter("cardExpirationMonth");
                if (cardExpirationMonth==null) cardExpirationMonth="0";

           // credit card owner first/last names:
            String cardOwnerFirstName=request.getParameter("cardOwnerFirstName");
                if (cardOwnerFirstName==null) cardOwnerFirstName="";

            String cardOwnerLastName=request.getParameter("cardOwnerLastName");
                if (cardOwnerLastName==null) cardOwnerLastName="";

           // charge amount:
            String cardChargeAmount=request.getParameter("cardChargeAmount");
                if (cardChargeAmount==null) cardChargeAmount="0.0";


                        // interval length (1 for 1 month or 12 for 1 year)
                        String intervalLength=request.getParameter("intervalLength");
                            if (intervalLength==null) intervalLength="1";
                            int intervalLengthInt=Integer.parseInt(intervalLength);

                    // get the date in mountain time for authorize.net processing:
                        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        df.setTimeZone(TimeZone.getTimeZone("America/Denver"));
                        String currentDateMountainTime=df.format(new java.util.Date());

                            String cardExpiration=cardExpirationYear+"-"+cardExpirationMonth; // format here is "2029-07"

                            // convert it to double:
                            Double cardChargeAmountDouble=Double.parseDouble(cardChargeAmount);

                       // subscription name
                        String subscriptionName=request.getParameter("subscriptionName");
                            if (subscriptionName==null) subscriptionName="";

		// Create a payment schedule
		ARBPaymentSchedule new_schedule = new ARBPaymentSchedule();
		new_schedule.setIntervalLength(intervalLengthInt);
		new_schedule.setSubscriptionUnit("months");
		new_schedule.setStartDate(currentDateMountainTime);
		new_schedule.setTotalOccurrences(7);
		new_schedule.setTrialOccurrences(0);

		// Create a new credit card
		CreditCard credit_card = new CreditCard();
		credit_card.setCardNumber(cardNumber);
		credit_card.setExpirationDate(cardExpiration);

		// Create a billing info
		ARBNameAndAddress billing_info = new ARBNameAndAddress();
		billing_info.setFirstName(cardOwnerFirstName);
		billing_info.setLastName(cardOwnerLastName);

		// Create a customer and specify billing info
		ARBCustomer customer = new ARBCustomer();
		customer.setBillTo(billing_info);

		// Create a subscription and specify payment, schedule and customer
		ARBSubscription new_subscription = new ARBSubscription();
		new_subscription.setPayment(new ARBPayment(credit_card));
		new_subscription.setSchedule(new_schedule);
		new_subscription.setCustomer(customer);
		new_subscription.setAmount(cardChargeAmountDouble);
		new_subscription.setTrialAmount(0.00);

		// Give this subscription a name
		new_subscription.setName(subscriptionName);

		// Create a new subscription request from the subscription object
		// Returns XML document. Also holds internal pointer as current_request.
		//
		api.createSubscriptionRequest(new_subscription);

            // send the request:
                api.sendRequest();

            out.println("subscriptionId: " +api.getResultSubscriptionId());

            // getting the result code ("Ok" or "Error")
                String resultCode=api.getResultCode();

                out.println("resultCode: "+resultCode);

		 api.printMessages();
                
            // clear the session:
		api.destroy();
%>

 

romanlutsk37
Contributor
3 ACCEPTED SOLUTIONS

Accepted Solutions

ARB do not run a transaction until that schedule start date. But a test credit card will get decline on the first run.

To test Credit card use AIM and run a auth_only transaction to verify, then void that transaction. If the CC is valid create ARB, else error.

View solution in original post

RaynorC1emen7
Expert

The ARB only run the schedule on midnight. There sample code for java AIM.

If you going to start the ARB right away, just use the AIM as the first payment then set the start date as the second payment as the ARB.

View solution in original post

Thanks a lot for the pointers. I've split the monthly payment workflow into an instant AIM payment at a monthly rate (which servers as auth) - if that goes through, I schedule a subscription starting in 1 month. 

View solution in original post

4 REPLIES 4

ARB do not run a transaction until that schedule start date. But a test credit card will get decline on the first run.

To test Credit card use AIM and run a auth_only transaction to verify, then void that transaction. If the CC is valid create ARB, else error.

RaynorC1emen7
Expert

Interesting, thanks for clarification. I wonder why they wouldn't the transaction right away, since I'm transmitting the current date for their local server (mountain time). Could you provide some sample code in java? 

 

Thanks,

Roman

The ARB only run the schedule on midnight. There sample code for java AIM.

If you going to start the ARB right away, just use the AIM as the first payment then set the start date as the second payment as the ARB.

Thanks a lot for the pointers. I've split the monthly payment workflow into an instant AIM payment at a monthly rate (which servers as auth) - if that goes through, I schedule a subscription starting in 1 month.