It would be great to have a feature where if the users credit card was due to expire before the next recurring payment we could trigger an email. For this we need a better way of storing the expiry date of credit cards, as at the moment they are hidden in the order data.

Although I also want to be mindful that recurring payment are not limited to credit card payments, so this should only only be functional if a credit card gateway is enabled and ideally the actual code should exist in the credit card include file. Or even better in the uc_credit module itself.

Comments

agileware’s picture

Subscribe

Mac Clemmens’s picture

subscribing, too.

WeRockYourWeb.com’s picture

Subscribing

univate’s picture

Anyone have any thoughts on this one? I was thinking of creating an issue in ubercart to add something to uc_credit. It just seems more relevant as part of the credit card system then just some hack added into uc_recurring?

trevorwh’s picture

One of my clients needs this feature, so I was actually planning on writing it - however, it seems to me that the only module that actually requires this is uc_recurring. IE, if the user's card information isn't stored, and they have to re-enter it anyway, then there shouldn't be a need for having to email a customer to say their card is expiring.

I do agree, however, that we need a better way of storing this data. Perhaps temporarily we could just link it in a third party table that is easily stored, to prevent having to patch uc_credit storing this information - again, it probably wouldn't widely be used besides recurring transactions, right?

storyleader’s picture

This brings up a wider issue for merchants accepting recurring payments: needing a system for reminding recurring-billing customers to update expired (and cancelled) credit cards.

I have 10-20 credit cards expiring in any one month, and I would like a way to track the process of contacting customers to remind them. Such a system would flag customers whose card is about to expire, those whose cards have expired, the type of notice sent (or phone call made) and the date of the notice.

I don't know what other businesses do about this problem? Are there perhaps third-party services that do the work of reminding customers to update their credit cards?

Or, is there a Drupal module that could be easily adapted for use keeping track of which customers need which reminders and when?

For me, such a module would have access to UC order data for the customer, so an email, say, could be customized to say something like:

"Dear [customer],
"I hope you have been enjoying your subscription to [product]. Since you subscribed in [month and year of purchase], we have tried to offer you excellent service every month.
"We are honored that you not only selected [product] from our store, but also purchased [other product] and [still other product].
"We notified you via [method of prior notice - e.g., email] on [date of prior notice] that your card was about to expire. Is there anything we can do to help make sure you continue to enjoy [product]?"

I imagine such a module as a tool for an employee of mine to use, to know who has been notified so far and what notice would be appropriate next - as well as the customer's purchase history.

Does anyone know of a way to accomplish this?

Is there a better place for me to post this query?

Thanks!

univate’s picture

@storyleader this is exactly what this feature request is about working out how we can add this feature.

The point that I would make is that this module is about recurring payments which is not limited to credit cards and information about credit card really makes sense with the credit card module (uc_credit). I understand that changes to ubercart/uc_credit are not as easy to make as a change here, so if someone can come up with a solution I would be keen to consider it.

vitis’s picture

Subscribing - important issue

pixelsweatshop’s picture

sub

chrisshattuck’s picture

Subscribing, this would be quite handy.

bluesomewhere’s picture

Subscribing

tinker’s picture

I would suggest running a check every time a recurring transaction is processed, to see if the next payment can be made, with a option for minimum card life remaining. eg set a minimum of 14 days for the card life span. When an initial purchase is made we could check the minimum setting and the interval between recurring billings. So if we have a subscription with payment every month it would override the minimum and check that the card is valid past the next payment. The minimum would be used when the recurrence is very short such as daily billing.

I foresee needing to store a datetime value indicating when the reminder email was sent then clearing it when the card info is updated. I believe the CC expire date is always stored and its not a PCI issue to store it. Since the check takes place on processing we would have the recurring profile loaded and therefor could just store it in the serialized data field. Although it may be more useful to have a separate field for it and then we could easily display a page that lists upcoming card expirations with their reminder status so that admins could preemptively contact users before payments are declined.

The only issue I see is for hosted gateway processing that is not triggered by a CRON run. I have not looked at that code yet.

EvanDonovan’s picture

I am currently having to make these feature for a client. Ubercart already stores the credit card expiration dates in its cache of credit card data, which is in encrypted, so I am presuming that is not a PCI problem. What I have noticed, though, is that the credit card data gets statically cached on uc_order_load, and there is no $reset parameter, so I am going to have to write my own function to modify the orders after load with the actual, non statically cached

If anyone else who's tackled this problem could share their code it would be helpful.

I think it could probably be a separate module providing a conditional action that, when triggered on cron, sent a customizable email, so this wouldn't have to be in uc_recurring or uc_credit.

univate’s picture

Where ubercart currently stores the expiry on credit cards is not really useful as you can't query for expired cards easily.

I think storing a date against a recurring fee when the the related payment method will expiry is probably a perfectly valid option. I also agree that having the actual email sent through a conditional action is the way to go.

EvanDonovan’s picture

@univate: I noticed that actually, as I was working on the module. I think I am going to have to store the data, possibly in the $order->data.

univate’s picture

I think this date needs to be in its own field somewhere. Putting it in $order->data is not going to be helpful, as you will have to load every single order to find the ones that are expired or about to expire.

EvanDonovan’s picture

@univate: I considered implementing hook_schema and having a table with the order_id as a foreign key. Perhaps that is the best solution. I needed this feature immediately, however, for a project I am currently working on, so for now, I am simply loading the actual expiration date, by iterating over an array of order_id's and calling uc_order_load() on each, but calling uc_credit_cache('clear') in-between, so that the credit card info will be there.

uc_credit_cache('clear'), by the way, serves the same purpose as a $reset parameter would, so I actually didn't need to look further than that function to get the data I needed.

univate’s picture

If you get some working code, it would be great if you could post it. At the very lest it will probably be useful in migrate existing expiry dates out of database and into their own fields somewhere.

EvanDonovan’s picture

After I deploy tonight, I will try to remove the site-specific stuff from my code and post a tarball.

EvanDonovan’s picture

Status: Active » Needs work

Sorry for the delay. I committed a genericized version of my code to a Git sandbox: http://drupal.org/project/1106348.

I won't have the time or resources to devote to this code in the future, at least for a while, but I included a README.txt that shows what would be needed to make it a well-rounded solution to this problem.

My main contribution here is at least to show how to find out what credit cards are soon expiring. The overall solution could be architected differently; it should be a Conditional Action and be configurable, but I was working under time constraints for a client.

EvanDonovan’s picture

Btw, I don't have a database field in which I am tracking expiry dates, even though we discussed handling it that way. Ubercart, I think, just has an expiry month, and that is all I am looking at. I was able to get that data just by clearing the uc_credit_cache() in between loading each order.

tinker’s picture

@EvanDonovan The link to the GIT sandbox does not appear to be working (Page not found).

univate’s picture

EvanDonovan’s picture

Oh, I think I was giving the link only I can see - oops.

unclearthur’s picture

sub

mattcasey’s picture

sub!

RikiB’s picture

subscribing

tanjerine’s picture

+1

agileware’s picture

I have now (finally) put a module up at UC Recurring credit card notify.

It has had some testing but still will need some work so please test more and post issues (and patches if I'm lucky).

Not sure if the maintainer wants to keep this open and eventually add the functionality to uc recurring or else close this and keep it in a separate module.

EvanDonovan’s picture

Status: Needs work » Needs review

Looks like you refined my code a bit. Thanks, Agileware! I will mark my sandbox as obsolete now (though I haven't tested your code yet).

Seems like it would make sense to have as a separate module, since not everyone needs this feature. Obviously, it sounds like your patch to uc_recurring is necessary though.

I'd say this should be "needs review" for discussion on whether this can be closed out pending resolution of [##1195892].

mattcasey’s picture

Thanks Agileware and EvanDonavan. The module sends notifications fine. I am trying to set this up on a test site and have two concerns:

- Custom permissions to update credit cards? In order to update their CC information, my customers would need 'administer recurring fees' permission, which also gives them access to edit their subscription and view anyone else's recurring fees. I am registered with Authorize.net CIM and using UC Recurring's integrated support. There is an Authorize.net CIM module to manage profiles, but last I checked, UC Recurring was not fully supported.

- One minor request is to call the trigger something obvious like "Credit card is about to expire" instead of "Upcoming recurring fee credit card expiry"

mattcasey’s picture

Replying to myself: I think Authorize.net CIM module is working (http://drupal.org/node/454952). But then I might need to port my existing customers over somehow, and I still don't know if things would integrate so well. Is there an easier solution, editing this or building my own module with the few fields I'd need?

tinker’s picture

@mattwad I have been successfully using Authorize.net CIM, provided by Ubercart, with uc_recurring for a while now. Using CIM customers do not need 'administer recurring fees' permission. I provided a number of patches to uc_recurring which improve the update credit card page. I think they are included in the 6.2 dev version. On our system we notify users when first payment fails and most users go to the site and update their info. I will be looking into the new module in the next week or so.

mattcasey’s picture

@tinker I just checked on my test site, and... you are correct, I can update and cancel with a new account. I'm not sure what I was seeing before, maybe it is something with my live site. Cheers :)

agileware’s picture

@mattwad:

Updating credit card details is the job of your payment gateway, not the credit card notify module, as the process will likely be different depending on the gateway.

Any feature/bug/support requests for the credit card notifications should be posted to that module's issue queue - http://drupal.org/project/issues/uc_recurring_cc_notify

mattcasey’s picture

Thanks Agileware, I wasn't sure the feature was already available in UC Recurring. Anyway, I have solved the issue after tinker's suggestion. Thanks again everyone for a great module.

IWasBornToWin’s picture

Any suggestions on how we handle any of this in d7 since the new module mentioned here in only for d6, and with only 28 sites using it i'd be surprised if it has d7 anytime soon?

To summarize - From what I read, if I want my members to be able to update their credit card info, e.g. lost card, desire to use different card, etc. or if their card expires and I want to send them a notice, I think I just read that my hope is the d6 module with 28 sites, is this correct?

Thanks