Re: Expiring roles and recurring fees for subscriptions

Joined: 02/18/2009
Juice: 2

I seem to be in the same boat as everyone else here: I'm trying to set up role based subscriptions using CIM.

I've been looking at uc_recurring and uc_subscription for a few hours now, and there seem to be iproblems in both cases. For the sake of reference, I'm documenting the ones I've run across here:

Problems with uc_subscribe:

  • uc_subscribe doesn't leverage any of the existing recurring_fee callbacks. Instead, it handles the details of different payment methods internally, which means that it doesn't benefit from any of the ARB code in uc_authorizenet.

    Additionally, because it doesn't have specific integration with uc_cim, there's a chance it will bill the wrong CIM profile if a user has defined more than one.

Problems with uc_recurring:

  • The workflow-ng actions aren't usable out of the box to do subscriptions. uc_recurring is focused on billing a particular number of payments rather than on billing for a particular period of time. For example, the "expire" workflow action fires after the last charge, rather than after a subscription runs out.
  • The workflow-ng events are triggered in uc_recurring_charge. uc_authorizenet doesn't seem to use this -- the charge is actually being processed by ARB -- which means that the workflow-ng events probably don't work right.

    On the other hand, the uc_arb_payment callback could be a reasonable workaround.

  • It isn't possible to configure a recurring charge to run indefinitely.
  • uc_authorizenet only supports uc_recurring with ARB.
  • uc_recurring doesn't create a new order when it charges customers, which is a problem if you're selling subscriptions for a physical product (because it doesn't integrate with the uc_shipping workflow).

For now, I'm using uc_subscribe with uc_cim and fixing problems as I go.

In order to make uc_cim work with current versions of Ubercart, change the block of code at line 378 to:

  $payment_profile_id = $order->cim_ppid;
  if ($data) {
    if (!is_array($data))
      $data = unserialize($data);
    if ($data['ppid'])
      $payment_profile_id = $data['ppid'];
  }

In order to add (some) uc_cim integration to uc_subscribe, add the following code at line 375:

  if ($order->payment_method == 'cim') {
    $obj = db_fetch_object(db_query('SELECT * from {uc_payment_cim} WHERE order_id = %d', $order_id));
    $neworder->cim_ppid = $obj->cim_ppid;
  }
Expiring roles and recurring fees for subscriptions By: ron_s (53 replies) Sat, 10/04/2008 - 01:50