<pre>
<?php
//#define WRENCHBOARD_USER_USESAVEDCC        11056

include('../backend.php');
$hostname = $wrenchboard->cfgReadChar("database.host");
$username = $wrenchboard->cfgReadChar("database.user");
$password = $wrenchboard->cfgReadChar("database.pass");
$database = $wrenchboard->cfgReadChar("database.name");
$dbconn = pg_connect("host=${hostname} dbname=${database} user=${username} password=${password}");

$q = "SELECT * FROM members WHERE stripe_customer_id IS NULL ORDER BY id LIMIT 1";
$r = pg_query($q);
$f = pg_fetch_assoc($r);

$member_id = 1; //$f["id"];


$q2 = "SELECT id AS card_id FROM creditcard WHERE member_id = $member_id AND status =3 ORDER BY random() DESC LIMIT 1";
$r2 = pg_query($q2);
$f2 = pg_fetch_assoc($r2);

$in=array(
    "action" => 11056, /* WRENCHBOARD_USER_USESAVEDCC */
    "amount" => rand(3000,5000),
    "card_id"  => $f2["card_id"],
    "description" => "This is a test charge for new stripe account ".rand(1,10000),
    "member_id" => $member_id
);
$out=array();
$ret = $wrenchboard->wrenchboard_api($in, $out);
var_dump($ret);
var_dump($out);

pg_close($dbconn);

/*
 * 	REQ_LONG(in,   "member_id", 1, -1); // Does not make any sence without member persitence
        REQ_STRING(in, "cardnumber", 12, 16, "(.*)"); //4111111111111111"
        REQ_STRING(in, "cvc", 3, 4, "(.*)"); //234"
        REQ_LONG(in,   "paymenttype", 0, -1);
        REQ_STRING(in, "exp_month", 2, 2, "(.*)");
        REQ_STRING(in, "exp_year", 4, 4, "(.*)")
 */