Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Member
Posts: 1
Registered: ‎07-10-2011

Both Trial Amount and Trial Occurrences are required

Hello,

 

Anyone can help me please to resolved my problem now.

 

The error details please see below:

API Error Code: E00026
Error Code Text: Both trialAmount and trialOccurrences are required.
Description: If either a trial amount or number of trial occurrences is specified then values for both must be submitted.

 

I give the value of  both field, but I still having that error. Im very frustrated this error an like paypal is very easy to configure the trial period.

 

Example of:

 

amount = 10 every monthly

TrialInterval.length = 21 days

trialAmount = 7 should be the first payment of the current months subcribe, divided by total of days in month and 10 for every month.

trialOccurrences = 21

 

Please see my code below:

 

MerchantAuthenticationType authentication = PopulateMerchantAuthentication();                                  

                PaymentScheduleTypeInterval PaymentInterval = new PaymentScheduleTypeInterval();
                PaymentInterval.length = b.BillingFrequency;
                PaymentInterval.unit = ARBSubscriptionUnitEnum.months;

                PaymentScheduleType PaymentSchedule = new PaymentScheduleType();
                PaymentSchedule.interval = PaymentInterval;
                PaymentSchedule.startDate = b.DateStartedRecurring;
                PaymentSchedule.startDateSpecified = true;
                PaymentSchedule.totalOccurrences = Convert.ToSByte(b.BillingFrequency);
                PaymentSchedule.totalOccurrencesSpecified = true;                                                    

              
                CreditCardType creditCard = new CreditCardType();                  
              
                creditCard.cardNumber = b.CreditCardNumber;
                creditCard.expirationDate = b.creditCardExpirYear + "-" + b.CreditCardExpirMonth;  // required format for API is YYYY-MM
                creditCard.cardCode = b.CVV2;


                PaymentType PaymentType = new PaymentType();
                PaymentType.Item = creditCard;

                ARBSubscriptionType sub = new ARBSubscriptionType();

             
                PaymentScheduleTypeInterval TrialInterval = new PaymentScheduleTypeInterval();
                TrialInterval.length = Convert.ToSByte(b.TrialLength);
                TrialInterval.unit = ARBSubscriptionUnitEnum.days;

                // Free 1-month trial
                PaymentScheduleType Ps = new PaymentScheduleType();

                Ps.interval = TrialInterval;
                Ps.trialOccurrencesSpecified = true;
                Ps.trialOccurrences =  b.TrialBillingFrequency;
             
                
             
                sub.amountSpecified = true;
                sub.amount = b.RecurrenceBillingAmount;
                sub.trialAmountSpecified = true;
                sub.trialAmount = b.trialAmount;
                        
                        
                //Billing Info
                sub.name = b.SubscriptionDescription;                 
                sub.paymentSchedule = PaymentSchedule;                
                sub.payment = PaymentType;                           
               


                sub.billTo = new NameAndAddressType();
                sub.billTo.company = b.BusinessName;
                sub.billTo.firstName = b.PayerFirstName;
                sub.billTo.lastName = b.PayerLastName;
                sub.billTo.address = b.ShippingAddress;
                sub.billTo.city = b.ShippingCity;
                sub.billTo.country = b.ShippingCountry;
                sub.billTo.state = b.ShippingState;
                sub.billTo.zip = b.ShippingZipCode;

                sub.customer = new CustomerType();
                sub.customer.email = b.EmailAddress;
                sub.customer.phoneNumber = b.PhoneNumber;
               

                ARBCreateSubscriptionResponseType response;
                response = _webservice.ARBCreateSubscription( authentication, sub );

                if( response.resultCode == MessageTypeEnum.Ok )
                {
                    bResult = true;
                }
                else
                {
                    bResult = false;

                }

 

I need you any feedback ASAP thanks.

 

Thanks,

Greg

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Both Trial Amount and Trial Occurrences are required

The trial occurrences object PaymentScheduleType Ps is not getting use. 

Shouldn't it use the PaymentScheduleTypeInterval PaymentInterval and PaymentScheduleType PaymentSchedule for the trial?