Authorize.net Add-on Recurring Payments End-Date, Number of Occurrences

I’m implementing the Authorize.net add-on, and I see when I create the feed I can specify a number of days or months for the period, and a number of occurrences.

Is there a way that these could be specified by user-submitted form data? So my user can say “I wish to donate every X days/weeks/months?”

Is there a way the user could submit a start date and end date for the payments?

Thank you.

Hello. You can use the gform_authorizenet_subscription_pre_create filter to modify the start date. See example 1 here:

Thanks, Chris.

The docs for that filter refers to the The Authorize.net subscription object.

When I visit the Authorize.net documentation, I see this object within the ARBCreateSubscriptionRequest object:

"subscription": {
            "name": "Sample subscription",
            "paymentSchedule": {
                "interval": {
                    "length": "1",
                    "unit": "months"
                },
                "startDate": "2020-08-30",
                "totalOccurrences": "12",
                "trialOccurrences": "1"
            },
            "amount": "10.29",
            "trialAmount": "0.00",
            "payment": {
                "creditCard": {
                    "cardNumber": "4111111111111111",
                    "expirationDate": "2025-12"
                }
            },
            "billTo": {
                "firstName": "John",
                "lastName": "Smith"
            }
        }

Is that the entirety of the subscription object referred to in your docs for the gform_authorizenet_subscription_pre_create filter?

The examples in the GF docs to manipulate the object appear as follows:

  • $subscription->startDate
  • $subscription->trialOccurrences
  • etc.

I’m a bit confused why it wouldn’t be $subscription->paymentSchedule->startDate. Does GF sort that all out elsewhere?

I have found the function get_subscription on line 1066 of class-gf-authorizenet.php. Are all the properties which are being set here for our subscription object $subscription available to modify with gform_authorizenet_subscription_pre_create?

Finally, can I use that filter to add additional properties that aren’t included in the get_subscription function but are options in the Authorize.net API?

Thank you for wading through all my questions.

All the examples in our documentation have been tested to work before publishing them. The add-on uses AuthorizeNet’s PHP SDK, so it manages the $subscription object as the official PHP SDK created by AuthorizeNet does. Checking how the get_subscription() function uses the $subscription object is a good reference for your custom code.

You can use the filter to alter any of the parameters set by the add-on by default or include any other subscription parameter supported by the AuthorizeNet API.

Extremely helpful. Thank you, Samuel!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.