wordpress - How to charge card on clicking accept button in stripe in PHP

456

I am using stripe and trying to charge card by clicking on accept button. I have already created charge and created customer. and now trying to create charge by clicking accept button.

Please suggest me the way to do it.

Thanks in advance.

<?php
    function payment_show()
    	{
    	include ('config.inc');

    	include ('charge.inc');
    ?>
    <?php
    	$code = db_query("SELECT * FROM {stripe_payment}");
    ?>
    	 <table border='1'>
    <th>ID</th><th>Payment ID</th><th>Customer ID</th><th>Customer Email</th><th>Payment Amount</th><th>Payment Date</th><th>Refund</th><th>Accept</th>
    <?php
    	foreach($code as $codes)
    		{
    		 
    			//$ch = StripeCharge::retrieve($Payment_id);
    			$ch = \Stripe\Charge::retrieve($codes->payment_id);

    ?>
    <tr>
    <td><?php echo $codes->Id; ?></td>
    <td><?php echo $codes->payment_id; ?></td>
    <td><?php echo $codes->customer_id; ?></td>
    <td><?php echo $codes->customer_email; ?></td>
    <td><?php echo $codes->payment_amount; ?></td>
    <td><?php echo $codes->payment_date; ?></td>
    <td><a href="https://dashboard.stripe.com/payments/<?php echo $codes->payment_id; ?>">Refund</a></td><td><strike> <input type="button" value="Accept"  onclick="document.write('<?php $ch->capture(); ?>');" />    </strike></td></tr>
    <?php
    		}

    ?>
    		</table>
    	 <?php
    	}

    ?>



People are also looking for solutions to the problem: call to a member function store() on null
Source

Share


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.


Similar questions

Find the answer in similar questions on our website.

897 php - Comments Not Posting on Wordpress - Blank Page
905 php - Remove dots below required stars in Wordpress checkout-form
717 php - Wordpress show result posts from query
29 wordpress - Insert spaces into a PHP array variable
538 php - How can I change the default WordPress search to search for woocommerce products?
61 php - Configure Wordpress on Azure Cloud Service to connect to Azure MySQL over SSL
190 javascript - jQuery display wordpress categories by click of category buttons
317 Which database to use to build an analytics app with PHP: what should have I to search for to find an answer
728 php - Google bots get 503 errors while indexing my website
76 PHP MYSQLI while loop gets only 1 row

People are also looking for solutions to the problem: lose format when force to download text file in php

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.