I am putting together a site that has various subscriptions and products that open up capabilities in wordpress. I'm using the user access manager plugin to manage the access a user would have to his or her subscribed to or purchased products. I have to do it this way instead of by role since a single user might have multiple subscriptions at any given time.
http://wordpress.org/extend/plugins/user-access-manager/
The way I have things set up is that I have created a plugin to which I can match a given form to a user access group. Then, I have tied into the gform_paypal_post_ipn hook to see when someone subscribes and the gform_subscription_canceled hook to determine when someone unsubscribes. Then I go find the form tied to the subscription event, find the connection to the User Access Manager group, and enable or disable it.
As you can see below, the gform_subscription_canceled hook is a little easier to work with. So my request is to put in hooks for all the paypal transaction id's, for example subscr_signup, and {I'm forgetting the other ones right now]. That would make it much easier to grab what is going on.
gform_paypal_post_ipn calls:
function paypal_hook($post, $entry, $config, $cancel)
        {
            global $wpdb;
            $post= (object) $post;
            if("subscr_signup" == $post->txn_type) {
                $custom=explode("|",$post->custom);     // Custom is in the form of {Lead ID}|{some other stuff}
                $lead=$custom[0];                       // I want the lead ID
                //get the form associated with the lead
                $sql=$wpdb->prepare("SELECT form_id FROM {$wpdb->prefix}rg_lead WHERE id=%d",$lead);
                $form=$wpdb->get_var($sql);
                // Get user ID
                $sql=$wpdb->prepare("SELECT created_by FROM {$wpdb->prefix}rg_lead WHERE id=%d;",$lead);
                $user=$wpdb->get_var($sql);
                if(is_null($user)) {
                    $subject="Couldn't Find user to add to subscription";
                    $msg="Variables:\n\n".var_export(get_defined_vars(),TRUE);
                    mail($this->debugmail,$subject,$msg);
                    return;
                }
                $connections = get_option("gf_uam_settings");   // Gets settings in the form of $a[form_id]=access ID
                if(isset($connections[$form])) {
                    $this->addCapability($user,$connections[$form]);
                } else {
                    $subject="Trying to subscribe but form not connected to capability";
                    $msg="Variables:\n\n".var_export(get_defined_vars(),TRUE);
                    mail($this->debugmail,$subject,$msg);
                }
            } else {
                $subject="Non subscription IPN";
                $msg="Variables:\n\n".var_export(get_defined_vars(),TRUE);
                mail($this->debugmail,$subject,$msg);
            }
        }and for gform_subscription_canceled hook:
function cancel_hook($entry, $config, $tr_id)
        {
            $user=$entry['created_by'];
            $form=$entry['form_id'];
            $connections = get_option("gf_uam_settings");   // Gets settings in the form of $a[form_id]=access ID
            if(isset($connections[$form])) {
                $this->removeCapability($user,$connections[$form]);
            } else {
                $subject="Couldn't find form connection to cancel subscription";
                $msg="Variables:\n\n".var_export(get_defined_vars(),TRUE);
                mail($this->debugemail,$subject,$msg);
            }
            $subject="At end of cancel hook";
            $msg="Variables:\n\n".var_export(get_defined_vars(),TRUE);
            mail($this->debugemail,$subject,$msg);
        }