3 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
6 $freeside = new FreesideSelfService();
8 if ( isset($_POST['amount']) && $_POST['amount'] ) {
10 $payment_results = $freeside->process_payment(array(
11 'session_id' => $_COOKIE['freeside_session_id'],
13 'amount' => $_POST['amount'],
14 'payinfo' => $_POST['payinfo'],
15 'paycvv' => $_POST['paycvv'],
16 'month' => $_POST['month'],
17 'year' => $_POST['year'],
18 'payname' => $_POST['payname'],
19 'address1' => $_POST['address1'],
20 'address2' => $_POST['address2'],
21 'city' => $_POST['city'],
22 'state' => $_POST['state'],
23 'zip' => $_POST['zip'],
24 'country' => $_POST['country'],
25 'save' => $_POST['save'],
26 'auto' => $_POST['auto'],
27 'paybatch' => $_POST['paybatch'],
28 //'discount_term' => $discount_term,
31 if ( $payment_results['error'] ) {
32 $_REQUEST['freeside_error'] = $payment_results['error'];
34 $receipt_html = $payment_results['receipt_html'];
39 if ( $receipt_html ) { ?>
41 Your payment was processed successfully. Thank you.<BR><BR>
42 <?php echo $receipt_html; ?>
46 $payment_info = $freeside->payment_info( array(
47 'session_id' => $_COOKIE['freeside_session_id'],
48 'payment_payby' => 'CARD',
51 if ( isset($payment_info['error']) && $payment_info['error'] ) {
52 $error = $payment_info['error'];
53 wp_redirect('example_login.php?freeside_error='. urlencode($error));
57 extract($payment_info);
59 $tr_amount_fee = $freeside->mason_comp(array(
60 'session_id' => $_COOKIE['freeside_session_id'],
61 'comp' => '/elements/tr-amount_fee.html',
62 'args' => [ 'amount', $balance ],
64 //$tr_amount_fee = $tr_amount_fee->{'error'} || $tr_amount_fee->{'output'};
65 $tr_amount_fee = $tr_amount_fee['output'];
69 <?php include('elements/error.php'); ?>
71 <FORM NAME="OneTrueForm" METHOD="POST" ACTION="payment_cc.php" onSubmit="document.OneTrueForm.process.disabled=true">
75 <TD ALIGN="right">Amount Due</TD>
78 $<?php echo sprintf("%.2f", $balance) ?>
83 <?php echo $tr_amount_fee; ?>
86 <TD ALIGN="right">Card type</TD>
88 <SELECT NAME="card_type"><OPTION></OPTION>
89 <?php foreach ( $card_types AS $ct ) { ?>
90 <OPTION <?php if ( $card_type == $ct ) { echo 'SELECTED'; } ?>
91 VALUE="<?php echo $ct; ?>"><?php echo $ct; ?>
97 <?php include('elements/card.php'); ?>
101 <INPUT TYPE="checkbox" <?php if ( ! $save_unchecked ) { echo 'CHECKED'; } ?> NAME="save" VALUE="1">
102 Remember this card and billing address
106 <INPUT TYPE="checkbox" <?php if ( $payby == 'CARD' ) { echo ' CHECKED'; } ?> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">
107 Charge future payments to this card automatically
112 <INPUT TYPE="hidden" NAME="paybatch" VALUE="<?php echo $paybatch ?>">
113 <INPUT TYPE="submit" NAME="process" VALUE="Process payment"> <!-- onClick="this.disabled=true"> -->
118 <?php get_footer(); ?>