3 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
5 $freeside = new FreesideSelfService();
7 if ( isset($_POST['amount']) && $_POST['amount'] ) {
9 $payment_results = $freeside->process_payment(array(
10 'session_id' => $_COOKIE['freeside_session_id'],
12 'amount' => $_POST['amount'],
13 'payinfo' => $_POST['payinfo'],
14 'paycvv' => $_POST['paycvv'],
15 'month' => $_POST['month'],
16 'year' => $_POST['year'],
17 'payname' => $_POST['payname'],
18 'address1' => $_POST['address1'],
19 'address2' => $_POST['address2'],
20 'city' => $_POST['city'],
21 'state' => $_POST['state'],
22 'zip' => $_POST['zip'],
23 'country' => $_POST['country'],
24 'save' => $_POST['save'],
25 'auto' => $_POST['auto'],
26 'paybatch' => $_POST['paybatch'],
27 //'discount_term' => $discount_term,
30 if ( $payment_results['error'] ) {
31 $_REQUEST['freeside_error'] = $payment_results['error'];
33 $receipt_html = $payment_results['receipt_html'];
38 if ( $receipt_html ) { ?>
40 Your payment was processed successfully. Thank you.<BR><BR>
41 <?php echo $receipt_html; ?>
45 $payment_info = $freeside->payment_info( array(
46 'session_id' => $_COOKIE['freeside_session_id'],
47 'payment_payby' => 'CARD',
50 if ( isset($payment_info['error']) && $payment_info['error'] ) {
51 $error = $payment_info['error'];
52 wp_redirect('example_login.php?freeside_error='. urlencode($error));
56 extract($payment_info);
58 $tr_amount_fee = $freeside->mason_comp(array(
59 'session_id' => $_COOKIE['freeside_session_id'],
60 'comp' => '/elements/tr-amount_fee.html',
61 'args' => [ 'amount', $balance ],
63 //$tr_amount_fee = $tr_amount_fee->{'error'} || $tr_amount_fee->{'output'};
64 $tr_amount_fee = $tr_amount_fee['output'];
68 <?php include('elements/error.php'); ?>
70 <FORM NAME="OneTrueForm" METHOD="POST" ACTION="payment_cc.php" onSubmit="document.OneTrueForm.process.disabled=true">
74 <TD ALIGN="right">Amount Due</TD>
77 $<?php echo sprintf("%.2f", $balance) ?>
82 <?php echo $tr_amount_fee; ?>
85 <TD ALIGN="right">Card type</TD>
87 <SELECT NAME="card_type"><OPTION></OPTION>
88 <?php foreach ( $card_types AS $ct ) { ?>
89 <OPTION <?php if ( $card_type == $ct ) { echo 'SELECTED'; } ?>
90 VALUE="<?php echo $ct; ?>"><?php echo $ct; ?>
96 <?php include('elements/card.php'); ?>
100 <INPUT TYPE="checkbox" <?php if ( ! $save_unchecked ) { echo 'CHECKED'; } ?> NAME="save" VALUE="1">
101 Remember this card and billing address
105 <INPUT TYPE="checkbox" <?php if ( $payby == 'CARD' ) { echo ' CHECKED'; } ?> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">
106 Charge future payments to this card automatically
111 <INPUT TYPE="hidden" NAME="paybatch" VALUE="<?php echo $paybatch ?>">
112 <INPUT TYPE="submit" NAME="process" VALUE="Process payment"> <!-- onClick="this.disabled=true"> -->
117 <?php get_footer(); ?>