I have a client with a subscription site. There are 2 type of subscriptions - monthly and annual. The client also wants to sell a gift certificate (100% discount coupon code) for the annual subscription. I want to be able to use the UC Free Order Payment Method, but uc_recurring will not allow a customer to complete checkout because the Free Order is not an allowed payment method. But Free Order won't allow a customer to enter any payment info, so there's no way to complete the order using the coupon code/gift certificate.

At this point I figured there were a few ways to proceed:

1. Make the annual subscription non-recurring for everyone. But then the annual subscription will not automatically renew and re-bill, which is not good.

2. Make a separate non-recurring annual subscription just for people redeeming a gift certificate, which could become extremely confusing.

3. Remove the free order payment method, so that when someone checks out they will need to enter a credit card, but will not be billed if their order total is $0. But since the annual subscription is recurring, then their credit card will be billed $22 12 months later. Not so nice for a gift!

Is there another work-around that I haven't thought of? Is there a way to make the Free Order Payment Method play nice with uc_recurring?

Thanks in advance for any help!!

Comments

univate’s picture

For any payment gateway to to work with uc_recurring it need to implement the recurring api, the the hook_recurring_info() function is what important.

tinker’s picture

So what should happen when a user purchases the annual subscription with a gift certificate?

A- They get the first year for free and then get billed yearly
B- They get the first year for free and then the subscription ends
C- Other, please describe

If A you have a problem because something must be charged so that you have the CC info for the next payment. You could use a discount code (uc_discount_alt module) to do a 99% discount so it would be almost free.

If B then you do not need any payment processing and you could consider working with a module that grants role/group permission based on a code and bypass store purchase.

sidharth_k’s picture

@univate: This is an important question. See for instance a couple of other issues in free order method:

http://drupal.org/node/702372
http://drupal.org/node/1175104

Its quite natural to sell gift coupons that make a full recurring stream become zero dollars i.e. a free recurring subscription.

It would obviously be great if you added support for free orders but if you're not able to ... can you please give more suggestions on how the free payment method code would need to be changed?

Thanks,

Sidharth

univate’s picture

I don't see much point of a "free" payment gateway when it comes to recurring payments. If you want recurring payments where the first payment is free then you probably want the user to still enter their credit card details so in that case your user needs to use a normal payment gateway. For other systems where you want something more complete due to coupons or discounts then I think its probably best to use the hooks to custom develop those business workflows.

The "free" payment gateway as I understand it is really just a work around to prevent a payment form showing up when the order total is free and for most cases you probably don't want that. But if you were to develop integration for free payments gateway then you would need to put the code in that module not in this project.

Anonymous’s picture

Hi everyone, we were struggling with the same problem, and i think implemented a good solution.

The free payment method needed to be recognized by recurring module as a payment method that could do recurring billing. so we implemented the hook_recurring_info.

here is what we needed to insert:

/*
 * Implementation of hook_recurring_info (from uc_recurring, optional support for CIM-style recurring payments)
 */
function uc_free_order_recurring_info() {
  $items = array();
  $items['free_order'] = array(
    'name' => t('Free Order standalone'),
    'payment method' => 'free_order',
    'module' => 'uc_recurring',
    'fee handler' => 'free_order',
    'renew callback' => 'uc_free_order_renew',
    'process callback' => 'uc_free_order_proc',
    'own handler' => FALSE,
    'menu' => array(
      'charge' => UC_RECURRING_MENU_DEFAULT,
      'edit' => UC_RECURRING_MENU_DEFAULT,
      'cancel' => UC_RECURRING_MENU_DEFAULT,
    ) // Use the default user operation defined in uc_recurring.
  );
  return $items;
}

function uc_free_order_renew($order, &$fee) { 	 return true; }
function uc_free_order_proc($order, &$fee) { 	 return true; }

Here are the steps:

  1. Add this code to the uc_free_order.module (if you are not sure how to do this download a patched version from here ).
  2. go to http://example.com/admin/store/settings/payment/edit/recurring and make sure where it says Valid payment methods for orders with recurring fees: that free payment method is selected

P.S. Also maybe someone with proper permission level could apply this as a patch to the module.

The development was sponsored by Levia IT. The developers who worked on this are:

univate’s picture

Project: UC Recurring Payments and Subscriptions » UC Free Order Payment Method
Version: 6.x-2.0-alpha5 » 6.x-1.x-dev
Component: Miscellaneous » Code
Category: support » feature

That should work, since you are not doing anything on setup or renew there are exists default callbacks in uc_recurring that you could use as well.