CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Automatically Recurring Memberships (with automated billing)
Pages: [1] 2

Author Topic: Automatically Recurring Memberships (with automated billing)  (Read 11965 times)

jrosen

  • Guest
Automatically Recurring Memberships (with automated billing)
September 25, 2008, 07:31:30 pm
Hi,

My name is Jason and I have been test-driving CiviCRM for a couple of weeks and have noticed both in the software and on the forums that CiviCRM does not have a recurring billing option for memberships. 

I have a great amount of experience as a PHP software-developer and also with the Authorize.Net Automated Recurring Billing (ARB) interface.

I am going to take on the task of adding this feature to CiviCRM for a project I am consulting for at the moment. 

I haven't gone through the code-base thoroughly yet and put together a design, but here is an overview of what I have so far:
  • 1.  Write recurring subscription functionality for Authorize.Net using ARB API
  • 2.  Assume that subscriptions renew X days before end of current period.  The period is the same as set in the Membership Type (Day, Month, Year) (haven't figured out what X is going to be yet) Possibly add configuration for X later.


I have a few questions:

In the recurring billing model you have now, do you create an "unpaid" transaction and then update it's status to "paid"?

What do you guys do with failed transactions?  Are they entered into the transaction tables with "failed" statuses and a reason code?  Is there any notification code that sends an email to an admin when a failure occurs?

Is there functionality built into CiviCRM at this time to allow a member to cancel an existing recurring payment schedule?


Any information you can offer would be a great help to me. 

Thanks,
Jason Rosen
Mojave Solutions, LLC
www.mojavesolutions.com

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Automatically Recurring Memberships (with automated billing)
September 25, 2008, 08:34:49 pm

Hey Jason:

Thanx for stepping up and taking this on. Will be a great addition to CiviCRM. At the top level, i'd recomment you keep the "payment processor" interface as abstract as possible since we can reuse it for other payment processors too a a later stage. Some responses inline, you can chat with some of the developers on IRC at: http://embed.mibbit.com/?server=irc.freenode.net&channel=%23civicrm&forcePrompt=true


Quote from: jrosen on September 25, 2008, 07:31:30 pm
  • 1.  Write recurring subscription functionality for Authorize.Net using ARB API

Does Auth have a recurring API? there is code to handle the recurring email sent by auth (we've eliminated it in 2.1 since this was community contributed but not supported) check: bin/ProcessAuthorizeReport.php in your distribution.

Quote from: jrosen on September 25, 2008, 07:31:30 pm
  • 2.  Assume that subscriptions renew X days before end of current period.  The period is the same as set in the Membership Type (Day, Month, Year) (haven't figured out what X is going to be yet) Possibly add configuration for X later.

Yeah, during development we make X a constant and once we have it working, we make it a config variable or a property of the membership type etc

Quote from: jrosen on September 25, 2008, 07:31:30 pm
In the recurring billing model you have now, do you create an "unpaid" transaction and then update it's status to "paid"?

Only the first transaction is created and set to "pending". All subsequent transactions / records are created when we receive a notification. Note that in our current model, the payment processor "pings CiviCRM' with all the info needed to process a transaction

Quote from: jrosen on September 25, 2008, 07:31:30 pm
What do you guys do with failed transactions?  Are they entered into the transaction tables with "failed" statuses and a reason code?  Is there any notification code that sends an email to an admin when a failure occurs?

This is handled at the payment processor end. We just switch the status of those transactions to failed. No mail is sent (but i assume paypal sends out an email also to the admin about the failed transaction)

Quote from: jrosen on September 25, 2008, 07:31:30 pm
Is there functionality built into CiviCRM at this time to allow a member to cancel an existing recurring payment schedule?

No. We generate a link to the paypal page that deals with cancelling a recurring payment and send the user to that page

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jrosen

  • Guest
Re: Automatically Recurring Memberships (with automated billing)
September 26, 2008, 04:53:58 pm
Hey Lobo - thanks for your responses.

I will definitely check out the IRC channel at some point once I start developing this.


Quote from: jrosen on September 25, 2008, 07:31:30 pm
  • 1.  Write recurring subscription functionality for Authorize.Net using ARB API

Quote from: Donald Lobo on September 25, 2008, 08:34:49 pm
Does Auth have a recurring API? there is code to handle the recurring email sent by auth (we've eliminated it in 2.1 since this was community contributed but not supported) check: bin/ProcessAuthorizeReport.php in your distribution.

Authorize.Net has a recurring API they call it the ARB.  I see part of the ARB API is already implemented in CRM_Core_Payment_AuthorizeNet.doRecurPayment.  It looks like this sets up a recurring payment in Authorize.Net. 

Quote from: jrosen on September 25, 2008, 07:31:30 pm
In the recurring billing model you have now, do you create an "unpaid" transaction and then update it's status to "paid"?

Quote from: Donald Lobo on September 25, 2008, 08:34:49 pm
Only the first transaction is created and set to "pending". All subsequent transactions / records are created when we receive a notification. Note that in our current model, the payment processor "pings CiviCRM' with all the info needed to process a transaction

Authorize.Net uses a ping-back also when it processes a recurring payment - the ping back posts to a URL that you specify and uses an MD5 hash for security.  I plan on implementing the recurring billing using the ARB ping-back.

Quote from: jrosen on September 25, 2008, 07:31:30 pm
Is there functionality built into CiviCRM at this time to allow a member to cancel an existing recurring payment schedule?

Quote from: Donald Lobo on September 25, 2008, 08:34:49 pm
No. We generate a link to the paypal page that deals with cancelling a recurring payment and send the user to that page

I think it makes sense to have a "Cancel Membership" or "Do Not Renew" UI that allows the user to stop paying for future renewals.   The intent would only be to stop future renewals and not cancel an exisiting paid membership (I am not looking to implement refunds, etc).



jrosen

  • Guest
Re: Automatically Recurring Memberships (with automated billing)
March 05, 2009, 07:19:22 pm
Hi, I am starting to work on recurring membership payments and I have a development question:

  • I was taking a look at the Contribution and Payments APIs and I noticed the function CRM_Contributte_Form_Contribution::postProcess(), but I can't find a call to it anywhere in CiviCRM.  Is this function still used?

Thanks.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Automatically Recurring Memberships (with automated billing)
March 05, 2009, 08:47:24 pm

that function is used for offline contributions

the form's postProcess is called automatically by the framework (in CRM/Core/Form.php). For most forms you will not see an explicit call to the postProcess function

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jsimonis

  • I post frequently
  • ***
  • Posts: 316
  • Karma: 4
    • Forward Support, Inc.
  • CiviCRM version: 4.4-4.5
  • CMS version: Drupal 7
  • MySQL version: 5.5.37-cll
  • PHP version: 5.3.29
Re: Automatically Recurring Memberships (with automated billing)
April 08, 2009, 09:08:01 pm
I can't wait for this to become available. We switched to Authorize.net because of the hassle of trying to do recurring payments with Paypal. It wasn't until afterwards that we realized that it doesn't work with Authorize.net either.

I'm hoping to put together a how-to for them to be able to do it for now until we can automate it.

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Automatically Recurring Memberships (with automated billing)
December 11, 2009, 11:49:14 am
Has any progress been made on using the ARB API from Authorize.net within CiviCRM?

Thanks,
Sarah
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

punchy99

  • Guest
Re: Automatically Recurring Memberships (with automated billing)
December 12, 2009, 01:47:16 am
Hi-

I am just about to start on a project involving recurring memberships, and was wondering about the status of this effort? Is the Authorize.net module a good starting point or is it still incomplete?

One bit of personal feedback regarding recurring membership processing: I feel it is pretty important to handle the payment exceptions in a graceful fashion - I am talking about:

 *declines
 *refunds
 *cancellations
 *expirations - only case handled currently by CiviCRM?
 *chargebacks

Especially with the downturn in the economy, you are bound to encounter cases where people change their mind or simply don't have the cash - the payment processing code needs to handle these cases.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Automatically Recurring Memberships (with automated billing)
December 12, 2009, 02:04:41 am
I believe that authorize.net is still incomplete. Someone got it pushing up the payments but didn't actually write the code to get the updates & update CiviCRM as it wasn't important to them.

I looked at the recurring code recently and I believe both Paypal and Google have full recurring functionality?

I was working on Payflow Pro at the time but the customer is going live without recurring functionality so although I got a bit further with it than the Authorize.net one it still isn't complete. High on my to-do list is submitting the code (without recurring enabled) as a patch to civi. (right up there with sending out Xmas cards)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Automatically Recurring Memberships (with automated billing)
December 12, 2009, 07:09:40 am
Quote from: punchy99 on December 12, 2009, 01:47:16 am
One bit of personal feedback regarding recurring membership processing: I feel it is pretty important to handle the payment exceptions in a graceful fashion - I am talking about:

 *declines
 *refunds
 *cancellations
 *expirations - only case handled currently by CiviCRM?
 *chargebacks

Especially with the downturn in the economy, you are bound to encounter cases where people change their mind or simply don't have the cash - the payment processing code needs to handle these cases.

Would be great if you/your org steps up and handles these cases. Would help quite a few folks in the community. Alternatively if you dont have developer resources, consider hiring someone to do the needed work

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Automatically Recurring Memberships (with automated billing)
December 12, 2009, 01:22:32 pm
writing a spec for how Civi should handle these would also be a good start.

The payment processors return a variety of failure codes such as you mention and they also return 'success but cvv didn't match' or ' success but avs didn't match' and I think there are some other 'success but ...' in the fraud services sections.

I think the chargebacks would be the trickiest.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jrosen

  • Guest
Re: Automatically Recurring Memberships (with automated billing)
February 23, 2010, 09:52:51 pm
Hi, I haven't updated this thread in a while, so I thought I would update it with my progress on PayPal automatic recurring membership billing...

So at the moment I am pretty close to having basic recurring billing in place for PayPal Website Payments Pro. 

Basically, the idea is that if a Membership is marked as "Auto-Renew", then when the user gets to the membership payment page, they don't see the recurring billing section - it is automatically filled for them on the server end once the recurring membership payment page is submitted. 

That creates a new PayPal recurring billing profile using the PayPal Direct HTTP API using the CreateRecurringPaymentsProfile function (dpesn't send the user over to a PayPal webpage - all processing is done by CiviCRM).  Then the PayPal IPN process kicks in and sends the recurring payment info to CiviCRM each time a new payment is sent where CiviCRM uses it's PayPal IPN code to update the payment info and the membership is renewed as usual.

I am still testing to see how error handling works out for the various payment errors.

Making these changes was not easy and required making modifications to the Membership configuration page, Contribution Configuration page, and modifying a bunch of the payment code that was tailored for PayPal Express recurring billing setup.

In making my changes I was pretty careful to re-use as much existing CiviCRM payment code as possible, so adding in recurring billing for Authorize.Net should not be too difficult once I am done.  The biggest part to getting Authorize.Net ARB to work I think would be implementing the CiviCRM IPN code to handle the ARB IPN requests - I don't think there is currently an Authorize.Net ARB IPN processor in CiviCRM.

If anyone would like to contribute some $$$ to the development and testing for the PayPal Pro recurring billing modifications I am currently working on - they would be greatly appreciated and would speed up my timeline.  Having some sponsors would also speed up my process of creating version 3.x patches for contribution back to the project.

Anyway, I will keep you all posted once I have my testing complete.

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Automatically Recurring Memberships (with automated billing)
February 24, 2010, 08:08:36 am
Would it help if I could contribute my time for testing?


-Sarah
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

jrosen

  • Guest
Re: Automatically Recurring Memberships (with automated billing)
March 05, 2010, 03:24:15 am
I am l trying to figure out what to do in CiviCRM when the Payment Processor IPN's telling CiviCRM that the Recurring Billing Subscription Profile was successfully created (but has not yet processed the first payment). 

Should I have the membership start off Pending when it is initially created and then have the IPN update it to New once the Recurring Billing Subscription is successfully created? 

If the Recurring Billing Profile is NOT successfully created, should I Cancel the Membership and mark the pending Contribution as Failed as if the first payment has failed?

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Automatically Recurring Memberships (with automated billing)
March 05, 2010, 07:40:57 am
Your approach seems reasonable.  I would make sure the individual signing up for membership ( or renewal ) is notified about what they should do next. Such as a message like "Your payment for your membership failed. Click here to provide a new payment mechanism to activate your membership. "      I would also notify ( by email ) a staff member the error. That way the staff can follow up with the person and make sure they do not loose a possible member.
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Automatically Recurring Memberships (with automated billing)

This forum was archived on 2017-11-26.