Sorry if this post is similar to a previous, I don't know how to delete posts. Ultimately, I am trying to pay programatically via php. After I do signup.php , this php is called to update the record as paid. I cannot get a payment_id to pass to the update payment record function. This is what comes on the screen- Welcome, Bill ShakespearMember ID 40 Payment ID[blank] Until I find a way to get the payment_id, I am stuck Can anyone help? <?php session_start(); global $db; require_once 'config.inc.php'; $member = $_SESSION['_amember_user']; $mem_login = $member['login']; $mem_pass = $member['pass']; $mem_name_f = $member['name_f']; $mem_name_l = $member['name_l']; $mem_email = $member['email'] ; $member_id = $member['member_id'] ; print "Welcome, " . $_SESSION['_amember_user']['name_f'] . " " . $_SESSION['_amember_user']['name_l']; // // Example updating payment record for user. // // Assumes following variables already set. // // $payment_id // // Fill in xyz with new values, or delete line if no new value needed. // $payment = $db->get_user_payments($member_id, 0); print "Member ID " . $member_id . " " ; print "Payment ID " . $payment[payment_id] . " " ; $payment = array( 'product_id' => $product->config['product_id'], 'begin_date' => $d = date('Y-m-d'), 'expire_date' => $d + 30, 'paysys_id' => 'telco', 'receipt_id' => 'xxxx', 'amount' => '3.95', 'completed' => 1, ); // // Update payment record // $db->update_payment($payment_id, $payment); ?>
Can someone help me with this. I am still trying to extract a way to pass the payment_id variable from my session to the function below to pay a subscription. The user would be logged in at this point. Obviously, there's a lot of info that I dont need on the screen. I am just clawing at any way to get that variable. If it is a simple thing, I'd really appreciate any help. <?php session_start(); global $db; require_once 'config.inc.php'; $member = $_SESSION['_amember_user']; $mem_login = $member['login']; $mem_pass = $member['pass']; $mem_name_f = $member['name_f']; $mem_name_l = $member['name_l']; $mem_email = $member['email'] ; $member_id = $member['member_id'] ; print "Welcome, " . $_SESSION['_amember_user']['name_f'] . " " . $_SESSION['_amember_user']['name_l']; print "<br />" ; // // Example updating payment record for user. // // Assumes following variables already set. // // $payment_id // // Fill in xyz with new values, or delete line if no new value needed. // //$payment = $db->get_user_payments($member_id, 0); $p = $db->get_payment($payment_id); $product = $db->get_product($payment['product_id']); print "Member ID " . $member_id . "\n " ; print "<br />" ; print "Payment ID " . $product . "\n " ; print "<br />" ; print $payment_id ."\n "; $date=date('Y-m-d', time() + 3600 * 24 * 30); print "Expire Date " . $date. "<br />" ; echo "<br />" ; foreach ($db->get_payment($payment_id ) as $pm){ echo "Value: $pm <br/>\n"; } $payment = array( 'product_id' => $product->config['product_id'], 'begin_date' => $d = date('Y-m-d'), 'expire_date' => $date, 'paysys_id' => 'telco', 'receipt_id' => 'xxxx', 'amount' => '3.95', 'completed' => 1, ); // // Update payment record // $db->update_payment($payment_id, $payment); ?>
My other posts might be too confusing. Is there a way to make $x= payment_id? I am making a new php program and I start with : <?php session_start(); global $db; require_once 'config.inc.php'; * I thought this would equal the payment id $p = $db->get_payment($payment_id); $invoice=$_SESSION['_amember_payment_id'] ; $mem_payid = $invoice['payment_id']; $p = $db->get_payment($payment_id); print "Payment ID " . $p['payment_id'] . "\n " ; print "<br />" ; print "For this period: $payment[begin_date] - $payment[expire_date]<br>"; print "$product[title] ordered by $member[name_f] $member[name_l]<br>"; print "Member ID " . $invoice . "\n " ; print "<br />" ; print $payment ."\n "; $date=date('Y-m-d', time() + 3600 * 24 * 30); print "Expire Date " . $date. "<br />" ; echo "<br />" ; $payments= $db->get_user_payments($_SESSION[_amember_id], 0); print "payments " .$payments ."\n " ; foreach ($payments as $p){ echo "Value:" .$p. " <br />\n"; } $pl = array(); $dat = date('Y-m-d'); foreach ($db->get_user_payments($member_id, 0) as $p){ if (($p['begin_date']<=$dat) && ($p['expire_date']>=$dat)){ $pl[] = $p; foreach ($pl as $key => $value) { if(is_array($value)) { foreach ($value as $keyv => $valuev) { echo "$keyv => $valuev <br>"; } } } } } I get this : Welcome, Bill Shakespear Payment ID For this period: - ordered by Bill Shakespear Member ID Expire Date 2009-06-13 payments Array Value:Array Value:Array Value:Array payment_id => 47 member_id => 40 product_id => 1 begin_date => 2009-05-13 expire_date => 2009-06-13 paysys_id => anylink receipt_id => amount => 3.95 completed => 0 remote_addr => 69.242.33.73 data => Array time => 20090513001447 aff_id => 0 payer_id => coupon_id => 0 tm_added => 2009-05-13 00:14:47 tm_completed => tax_amount => 0.00 Is the payment_id in a _SESSION variable somewhere? I can see that the payment_id is 47 but how do I reference it? Is what I am asking that complicated? Should I try and use an SQL query? Has anyone ever needed to know this? Any help is appreciated
Hey I too had to jump through friggin hoops to find this one out Here is some code to help you out!! PHP: $error=array(); $paysys_id='authorize_aim'; $vars['login'] = generate_login($vars); $vars['pass'] = generate_password($vars); $vars['pass0'] = $vars['pass']; $vars['name_f']= $_POST['name_f']; $vars['name_l']= $_POST['name_f']; $vars['email']= $_POST['email']; if (!strlen($vars['name_f'])){ $error[] = _SIGNUP_PLEASE_ENTER_FNAME; } if (preg_match('/[<>"]/', $vars['name_f'])){ $error[] = _SIGNUP_PLEASE_ENTER_FNAME; } if (!strlen($vars['name_l'])){ $error[] = _SIGNUP_PLEASE_ENTER_LNAME; } if (preg_match('/[<>"]/', $vars['name_l'])){ $error[] = _SIGNUP_PLEASE_ENTER_LNAME; } if(!tep_validate_email_address($vars['email'])) { $error[] = 'Please enter valid email address'; } if(!empty($error)); { $_SESSION['emessg']=$error; tep_redirect($PHP_SELF); exit(0); } //$vars['paysys_id'] = 'free'; //$vars['paysys_id'] = $vars['paysys_id']; //$begin_date = date('Y-m-d'); //$expire_date = '2037-12-31'; if ($db->check_uniq_login($vars['login'], $vars['email'], $vars['pass0'], 1)>=0) { $error[]="User already exists' - please choose another username"; } //add the user $member_id = $db->add_pending_user($vars); $is_affiliate = '1'; //put in newsletter $db->subscribe_member($member_id, $is_affiliate); // Get Product Pricing if you want here // $product = & get_product($oto_array['product_id']); $ipayment = array( 'member_id' => $member_id, 'product_id' => 1 'begin_date' => $d = date('Y-m-d'), 'expire_date' => $product->get_expire($d), 'paysys_id' => $paysys_id, //authorize_aim 'receipt_id' => '', 'amount' => '1.00', 'completed' => 0, ); /* echo'<pre><br>'; print_r($ipayment); echo'<br></pre><hr><br>'; */ $db->add_payment($ipayment); //When we add the payment the insert_id will me added //to the globals array!! So no need to frig around trying to gess it $new_payment_id=$GLOBALS['_amember_added_payment_id']; Hope this helps.. Still trying to figure out what variables to seialize for the enc_info hidden field? any ideas RIck!
THink i got it but i need to verify what V is serialize($xx = array( 'member_id' => $member['member_id'], 'payment_id' => $payment['payment_id'], 'v' => $vars['v'], 'action' => $vars['action']='mfp', 'paysys_id' => $vars['paysys_id'] ))