1

I am using authorize.net for monthly subscription plan with trial period using customer profile API. Reference: https://developer.authorize.net/api/reference/#recurring-billing-create-a-subscription-from-customer-profile I want to set interval for trial period of subscription. In api, I could not get related to interval of trial period. Scenario: If I subscribe on date 1-1-2019 then user will get 1st trial period of 7 days. So, trial end date must be of 8-1-2019 with 0 amount. Then actual subscription end date must be of 8/2/2019(for 1month after trial period)and 100 amount for subscription.

$subscription = new AnetAPI\ARBSubscriptionType();
$subscription->setName("Sample Subscription");

$interval = new AnetAPI\PaymentScheduleType\IntervalAType();
$interval->setLength('30');
$interval->setUnit("days");

$paymentSchedule = new AnetAPI\PaymentScheduleType();
$paymentSchedule->setInterval($interval);
$paymentSchedule->setStartDate(new DateTime('2019-01-01'));
$paymentSchedule->setTotalOccurrences("9999");
$paymentSchedule->setTrialOccurrences("1");

$subscription->setPaymentSchedule($paymentSchedule);
$subscription->setAmount(100);
$subscription->setTrialAmount("0.00");

Using what parameter I can pass trial interval in authorize.net? Please help me out in this. Thanks in advance.

John Conde
  • 217,595
  • 99
  • 455
  • 496
disha
  • 123
  • 11

1 Answers1

3

This isn't a trial period In Authorize.Net terms. This is just a delay in starting the subscription. All you need to do is set the start date to be one week later and then create a normal subscription with a one-month time frame. No special code or parameter is needed here.

So in your specific example change

 $paymentSchedule->setStartDate(new DateTime('2019-01-01'));

to

$paymentSchedule->setStartDate(new DateTime('2019-01-08'));

Or if you want it done dynamically:

$paymentSchedule->setStartDate(new DateTime('+7 days'));
John Conde
  • 217,595
  • 99
  • 455
  • 496