Home Html How to make paypal donation button in php?

How to make paypal donation button in php?

by therichpost
0 comment
Php Preg_Match Pattern for Week Days Name

Hello, welcome to therichpost.com. In this post, I will tell you,  How to make paypal donation button in php? I personally like php ver much. PHP is the best web language. There are many cms and frameworks in PHP and WordPress is the best example. facebook also used PHPin it.

Most of sites use donation and this required payment gateway also and  I am making this easy for every developer to make donation form with paypal payment gateway in php.

paypal-donation-php

Here is working and tested code and you need add this code into your php page and you have to add paypal url and paypal and I have added dummy paypal url and payap id:
<?php
$paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr'; // Test Paypal API URL
$paypal_id='yourpaypalid@yahoo.com'; // Business email ID
?>
<h4>Donation : $1</h4>
    <div class="btn">
    <form action="<?php echo $paypal_url; ?>" method="post" name="frmPayPal1">
    <input type="hidden" name="business" value="<?php echo $paypal_id; ?>">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="item_name" value="Donation Payment">
    <input type="hidden" name="item_number" value="1">
    <input type="hidden" name="credits" value="510">
    <input type="hidden" name="userid" value="1">
    <input type="hidden" name="amount" value="1">
    <input type="hidden" name="cpp_header_image" value="test.jpg"> // Add Header Image
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="handling" value="0">
    <input type="hidden" name="cancel_return" value="cancel.php"> // Add Cancel Page url
    <input type="hidden" name="return" value="success.php"> // Add Success Page url
    <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </form> 
    </div>

 For Payment Success and Payment Cancel, you can add your custom urls  in paypal form.

There are so many code in PHP and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

You may also like

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.