So you made some changes to the parse_params sub to do the redirect for you? I think I understand what you are trying to do but I don't think I follow the program flow.
Try this: In the send_key sub, add something like
$IN->param('user_id_num') = $id;
$IN->param('user_val_key') = $key;
Make sure you use unique key names so you don't overwrite any real keys. Then in parse_params you would need to change your $url to something like this:
my $url = "https://somedomain/paypage.cgi?id=$IN->param('user_id_num')&key=$IN->param('user_val_key')";
Make sure to back up your files though. This is off the top of my head so you might need to fix it a bit. Let me know how it works.