Question about manual Payment

Discussion in 'Integration' started by digi, May 12, 2009.

  1. digi

    digi New Member

    Joined:
    May 9, 2009
    Messages:
    9
    What I really need to ask is ;

    Is there a function to update the status of a member to PAID and ACTIVE via php?

    I use the following code below to pay a record. The record gets paid and I update the member status to a 1. The user still is not able to log in.

    Is there a function or some code to make a user active able to log in?

    This is what I am doing in the last section of the program:
    // Update member record to record to be paid and active
    $u['status'] = '1';
    $db->update_user($member_id, $u);

    Thanks


    <?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'] ;
    print "Welcome, " . $_SESSION['_amember_user']['name_f'] . " " . $_SESSION['_amember_user']['name_l'];
    print "<br />" ;

    //
    //
    // Assumes following variables already set.
    //
    // $payment_id
    //
    // Fill in xyz with new values, or delete line if no new value needed.
    //
    $member_id = $_SESSION['_amember_user']['member_id'] ;
    $payments = $db->get_user_payments($member_id, $only_completed=0);
    foreach ($payments as $p){
    print "Payment ID " . $p['payment_id']."
    ";
    }
    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>";
    $date=date('Y-m-d', time() + 3600 * 24 * 30);
    print "Expire Date " . $date. "<br />" ;
    echo "<br />" ;
    $payment_id= $p['payment_id'];

    $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);
    $u = $db->get_user($member_id);

    // Update member record to record to be paid and active
    $u['status'] = '1';
    $db->update_user($member_id, $u);

    ?>

Share This Page