Below, you’ll find a detailed guide on how to add the Donations via PayPal Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Donations via PayPal Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Donations via PayPal Plugin and the shortcodes it provides:
"Donations via PayPal is a versatile WordPress plugin that simplifies the process of receiving donations on your site. It seamlessly integrates PayPal gateway for secure and efficient transactions."
- []
Donations via PayPal [paypal-donation] Shortcode
The PayPal Donation shortcode allows users to generate a PayPal donation button with customizable parameters. The shortcode: [paypal-donation] can be modified to include specific purpose, reference, amount, return page, button URL, and IPN validation.
Shortcode: [null]
Parameters
Here is a list of all possible null shortcode parameters and attributes:
purpose
– Defines the reason for the donationreference
– Adds a unique reference for the donationamount
– Specifies the donation amountreturn_page
– Page to redirect donors after donationbutton_url
– URL of the PayPal button imagevalidate_ipn
– Enables IPN validation for secure transactions
Examples and Usage
Basic example – A simple PayPal donation request without any custom parameters.
[paypal-donation /]
Advanced examples
Specifying a purpose for the donation. This will be displayed on the PayPal payment page.
[paypal-donation purpose="Support our cause" /]
Adding a reference to the donation. This could be used to track donations from different sources or campaigns.
[paypal-donation reference="Campaign1" /]
Pre-filling the donation amount. This can be used to suggest a donation amount to the user.
[paypal-donation amount="25" /]
Redirecting the user to a specific page after they have made a donation. This could be a thank you page or a page with more information about how their donation will be used.
[paypal-donation return_page="https://yourwebsite.com/thank-you" /]
Using a custom button for the donation link. This can be used to match the style of your website or to provide a more engaging call to action.
[paypal-donation button_url="https://yourwebsite.com/custom-button.png" /]
Enabling IPN validation. This can be used to verify that the donation was successfully processed by PayPal.
[paypal-donation validate_ipn="true" /]
Combining multiple parameters. This example shows a donation request with a specific purpose, pre-filled amount, custom button, and return page.
[paypal-donation purpose="Support our cause" amount="25" button_url="https://yourwebsite.com/custom-button.png" return_page="https://yourwebsite.com/thank-you" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [null]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('paypal-donation', array(&$this,'paypalShortcode'));
Shortcode PHP function:
function paypalShortcode($atts)
{
extract(
shortcode_atts(
array(
'purpose' => '',
'reference' => '',
'amount' => '',
'return_page' => '',
'button_url' => '',
'validate_ipn' => '',
),
$atts
)
);
return $this->generateHtml(
$purpose,
$reference,
$amount,
$return_page,
$button_url,
$validate_ipn
);
}
Code file location:
paypal-donations/paypal-donations/paypal-donations.php
Conclusion
Now that you’ve learned how to embed the Donations via PayPal Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply