3 parameters are passed to hook_order . The third parameter depends on the first. When the first parameter is "update", the third parameter is the status the order goes to.
hook_order($op, &$order, $arg2){ switch($op){ case 'update': if($arg2 === 'completed'){
$order->uid will provide you with the user who created the order. You can do something like the following
$user = user_load(array('uid' => $order->uid));
To expire the role, you will need to write a module that will track the duration and will do something like above when the time runs out. Or you can use the role_expire module and see if that helps.
source share