Search code examples
phpwordpresswoocommercesubscriptionauthorize.net

What value to pass for "setTotalOccurrences" for never ending subscriptions in Authorize.Net?


I am using Authorized.Net API in my WordPress project, I am selling subscription on my website, some subscriptions lasts for 6 months, some for 12 months, some for 24 months, for these cases I set "setTotalOccurrences" value as follow:

$paymentSchedule->setTotalOccurrences("6");     // for 6 months
$paymentSchedule->setTotalOccurrences("12");    // for 12 months
$paymentSchedule->setTotalOccurrences("24");    // for 24 months

it goes well till now, but I got stuck for the subscriptions which never ends, I tried to pass "setTotalOccurrences" value = 0 for this case, but it throws an error i.e. 0 is invalid.

What value should I pass in "setTotalOccurrences" for never-ending subscriptions?


Solution

  • I have found its solution, if I pass a large value in the "setTotalOccurrences" then the Authorize.Net treat as a never ending subscription, for example:

    $paymentSchedule->setTotalOccurrences("9999");
    

    it will be treated as an ongoing subscription.