Example #1
0
<form id="si_checkout_review" action="<?php 
echo si_get_credit_card_checkout_form_action();
?>
" method="post">
	<div class="checkout_block right_form clearfix">

		<div class="paymentform-info">
			<h2 class="section_heading"><?php 
si_e('Your Payment Information');
?>
</h2>
		</div>
		<fieldset id="si-billing">
			<table>
				<tbody>
					<?php 
foreach ($billing_fields as $key => $data) {
    ?>
						<tr>
							<th scope="row"><?php 
    echo esc_html($data['label']);
    ?>
</th>
							<td><?php 
    echo esc_html($data['value']);
    ?>
</td>
						</tr>
					<?php 
}
?>
    public static function payment_button($invoice_id = 0)
    {
        if (!$invoice_id) {
            $invoice_id = get_the_id();
        }
        $invoice = SI_Invoice::get_instance($invoice_id);
        $user = si_who_is_paying($invoice);
        $user_email = $user ? $user->user_email : '';
        $key = self::$api_mode === self::MODE_TEST ? self::$api_pub_key_test : self::$api_pub_key;
        $payment_amount = si_has_invoice_deposit($invoice->get_id()) ? $invoice->get_deposit() : $invoice->get_balance();
        $data_attributes = array('key' => $key, 'name' => get_bloginfo('name'), 'email' => $user_email, 'description' => $invoice->get_title(), 'currency' => self::get_currency_code($invoice_id), 'amount' => self::convert_money_to_cents($payment_amount), 'allow-remember-me' => 'false');
        $data_attributes = apply_filters('si_stripe_js_data_attributes', $data_attributes, $invoice_id);
        ?>
			<form action="<?php 
        echo add_query_arg(array(SI_Checkouts::CHECKOUT_ACTION => SI_Checkouts::PAYMENT_PAGE), si_get_credit_card_checkout_form_action());
        ?>
" method="POST" class="button" id="stripe_pop_form">
				<input type="hidden" name="<?php 
        echo SI_Checkouts::CHECKOUT_ACTION;
        ?>
" value="<?php 
        echo SI_Checkouts::PAYMENT_PAGE;
        ?>
" />
				<script
					src="https://checkout.stripe.com/checkout.js" class="stripe-button"
					<?php 
        foreach ($data_attributes as $attribute => $value) {
            ?>
						data-<?php 
            echo esc_js($attribute);
            ?>
="<?php 
            echo esc_js($value);
            ?>
"
					<?php 
        }
        ?>
				></script>
			</form>
			<style type="text/css">
				#payment_selection.dropdown {
					  z-index: 9999;
				}
				#stripe_pop_form.button {
					float: right;
					padding: 0;
					margin-top: -6px;
					margin-left: 10px;
					background-color: transparent;
				}
				#payment_selection.dropdown #stripe_pop_form.button {
					float: none;
					padding: inherit;
					margin-top: 0px;
					margin-right: 15px;
					margin-bottom: 15px;
					text-align: right;
				}
			</style>
		<?php 
    }