Monday, June 17, 2024

How to make paypal donation button in php?

Make paypal donation button in php

Hello, welcome to 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.


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:
$paypal_url=''; // Test Paypal API URL
$paypal_id=''; // 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="" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="" width="1" height="1">

 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.

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

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