WordPress Shortcode for Paypal Pay, Buy, Donation and Cart Buttons

This plugin adds “paypal_button” shortcode to display pay now, buy now, donation and add to cart PayPal buttons with facility to customize they paypal checkout page. After installation you would need to set your PayPal E-Mail address, Business Name (for donations) in “Settings->PayPal Buttons”. You can also set you companies logo in PayPal’s checkout page . It has numerous other option to allow all possible variant of the buttons. Some common usage of the shortcode are as follows

Pay Now Button:
[paypal_button type="paynow" amount="100"]
Buy Now Button:
[paypal_button type="buynow" name="WordPres Portfolio Theme" amount="100"]
Donation Button:
[paypal_button type="donate" amount="100"]
Add to cart Button:
[paypal_button type="cart" name="Computer Table" amount="100"]

pay now, buy now, add to cart, donate

Possible variants of PayPal buttons

Paypal Checkout Page with Company Logo

Paypal Checkout Page with Company Logo

There  are 16 attributes for this shortcode and all of them are option. If none of them is specified, it will look for the what has been configureding in Settings page. If nothing is set up in Settings page, It will try to use the website’s settings.

Shortcode Help Section

type:
(string) (optional) Type of transaction. Allowed Values are
Possible Values: ‘paynow’, ‘buynow’, ‘cart’ or ‘donations’

id:
(string) (optional) Product Number
Possible Values: Any numeric product id

email:
(string) (optional) Your PayPal E-Mail address.
Possible Values: A valid PayPal E-Mail address

name:
(string) (optional) Name of the Product
Possible Values: Any String

amount:
(numeric) (optional) Product price to be charged. Yes, you can left empty for user to input amount. This can be used for donations.
Possible Values: Any numeric value

quantity:
(numeric or string) (optional) Specfiy quantity as number or range or possible comma separated values. Leave empty to let user specify any quantity.
Possible Values: “1″ or “1,5,10″ or “1-10″

quantity_txt_postfix:
(string) (optional) Post fix text to be shown in quantity dropdown.
Possible Values: ” items” or ” products”

field_sep:
(string) (optional) HTML code to separate the generated visible HTML fields. Use “<br />” for new line.
Possible Values: “&nbsp;” or “<br />”

amount_prompt:
(boolean) (optional) Setting to “1″ will enable user to enter amount they would like to pay.
Possible Values: 1 or 0

echo_link:
(boolean) (optional) Set to “1″ for linked output of they payment
Possible Values: 1 or 0 Default:0

open_new_window:
(boolean) (optional) Set to “1″ to open payment page in a new window
Possible Values: 1 or 0

btn_url:
(string) (optional) Set to URL of the custom button image

currency:
(string) (optional) Currency of the Transaction.
Possible Values: ‘USD’ or ‘CAD’ or any currency code

tax_rate:
(numeric) (optional) Tax rate in percentage applied to the total price.
Possible Values: 0.0001 to 100

shipping_charges:
(numeric) (optional) Shipping charges for the product.
Possible Values: Any numeric value

btn_size:
(string) (optional) Set size of the button either ‘large’ or ‘small’.
Possible Values: ‘large’ or ‘small’

btn_display_cc:
(string) (optional) Display Credit Cards Logo under the button.
Possible Values: ‘yes’ or ‘no’

add_note:
(string) (optional) Let buyer add a note to order.
Possible Values: ‘yes’ or ‘no’

thankyou_page_url:
(string) (optional) Buyer will be redirect to this page after successful payment.
Possible Values: An absolute URL e.g. http://abc.com/thankyou

checkout_logo_url:
(string) (optional) URL to your Logo image.
Possible Values: An absolute URL e.g. http://abc.com/logo.png

checkout_header_border_color:
(string) (optional) Set border color of the checkout page header.
Possible Values: A HTML Hexa-decimal code. e.g. FFFF00, 999999 etc

checkout_header_bg_color:
(string) (optional) Change background color of the checkout page header.
Possible Values: A HTML Hexa-decimal code. e.g. FFFF00, 999999 etc

checkout_bg_color:
(string) (optional) Change background color of the entire checkout page
Possible Values: A HTML Hexa-decimal code. e.g. FFFF00, 999999 etc

PayPal Button shortcode setting page

PayPal Button shortcode setting page

Update 1: Plugin now supports custom payment button.

Update 2: Plugin now supports 17 languages to translate the payment buttons.

About these ads

77 Responses to WordPress Shortcode for Paypal Pay, Buy, Donation and Cart Buttons

  1. Really really cool! I’m going to check this out now! Probably the easiest of the ones I’ve looked up so far!

    Dev testing it on my site. I’ll try to remember to update here if/when I use it. I’ll definitely give it a rating!

  2. This looks great, and I have just installed it. However I must be blind as I can’t see where the shortcode is created once I configure the settings I want. Please advise…

  3. Thanks man.
    A shortcode is not a visual element like widget or post types that you find in admin panel. But you need to use it in your post or page or in a PHP file. For example, to display a buy now button for amount of $100. You would paste the following code in your post/page.

    [paypal_button type="buynow" amount="100"]

    If you want to use it in one of your PHP file, you can use do_shortcode function.

    You can read more about it on Codex at following URL.

    http://codex.wordpress.org/Shortcode_API

  4. Hi, this is an awesome and simple way of adding paypal functionality to a website but, I have one question. Is it possible to have it where the user can change the quantity? Thanks!

    • Thanks Maxwiz for contacting and making me improve this plugin.
      I just added quantity attribute to shortocode. Please upgraded to version 1.1 to enjoy new attributes. You can specify a a particular fix quantity, a range or specific values to be chosen by the user Or you can leave it empty to let user fill in the quantity they want. I hope it will work for you. Enjoy!
      p.s. Do rate if it helped you.

  5. What a great plugin, thanks! And quantity feature is really fantastic, except it doesn’t seem to be calculating once it the order is sent to PayPal. I’m using it with the “Donate Now”, [paypal_button type="donate" name="2013 Calendar" amount="25" quantity="1,2,3,4,5,6,7,8,9,10"] which gives a very nice drop down quantity on the page but no matter what quantity I choose it always says $25 on the checkout page.

    I might be doing something wrong, or maybe there’s a specific PayPal setting I need.

    Anyway, don’t absolutely need it since the site I’m working on is for a non-profit collecting donations, but it would be great to have!

    Again, thanks for a very cool, easy-to-configure plugin!

    • Thanks Tricia!
      Unfortunetly, PayPal ignore quantity field for donate buttons. Anyway, I implemented a workaround in newer version of the plugin. Please upgrade to latest version to enjoy the trick. By the way, you can also use range feature for quantity, your shortcode will look like [paypal_button type="donate" name="2013 Calendar" amount="25" quantity="1-10"].
      Hope it solves your problem.

      • Thanks Mohsin!! Just upgraded plugin and it works! AWESOME!

        I was having trouble using the range feature, some characters regarding array appeared at the top of my page where I placed the shortcode, but I’ll try it again.

        Just rated the plugin on wordpress.org! Have a great weekend and thanks again!

        Tricia (karsaygirl)

  6. Hi,

    Very nice plugin! Are you also planning to install a ‘shipping table’. In that case the customer can choose betwoon ‘National shipping’ and ‘International shipping’.

    Kind regards,
    Wieger

  7. Hey. I love the Plugin for my new client but I’m receiving an error upon preview..Large Button with CC under then next to it is this:
    onclick=”return adjustPayPalQuantity184(this);”>

    Fix suggestion…I’m sure I’m missing something. Thanks, CBPOE

    • Actually, Your Post/Page ID is treated as Product/Item ID. If you want to change it you can use “item_number” attribute of the shortcode. Item number is a unique product ID of your store.

  8. This is a great plug-in! I’m just having an issue with how it is displaying on my page, and not sure if it’s something I have to go look at in my style sheets. There is a HUGE gap between text and the generated button below it, even though I wanted the button to be in line with the text. I am not doing anything to make it drop down to another line, so I’m wondering what I might be able to do to have it display all together on the same line.

    • I guess, you stylesheet is adding margins. There are number of solutions to making it inline with text. One possible way that might work for you, is to wrap the shortcode in a span like [paypal_button] and add following CSS to your stylesheet.
      span.paypal_button form{ margin:0 !important; padding:0 !important; display:inline !important;}
      If that does not work for your scenario, another work around is to use tables.
      Good Luck
      p.s. add “!important” to make sure that it applies.

  9. Hey there! The plugin is awesome, it was exactly what I was looking for!
    I have two little things to ask:

    1.) Can I change the default language of the PayPal page? It shows up in english, can I change this somewhere?

    2.) I have a button shortcode [btn size="large" url="#"]…[/btn] …how can I manage to put in the paypal link to the url?

    • Thanks Phil, I am glad you like this plugin. Here are answers

      1) Not yet, I am looking forward to add it you can expect it in 2-3 days. If you cant wait, you can use custom button technique to use with the PayPal’s translated button.

      2) This shortcode has “echo_link” attribute to output a link to the payment, But I am afraid you can not use it because “btn” shortcode require a string that starts with “http://”. You can use either one of the shortcode “btn” or “paypal_button” but not one inside one another. But, you do have option to use the Payment URL as given in the link above.

      • Thank you for the quick reply!

        I can wait a couple of days, that’s no problem!

        Is there no other work around for the btn issue? :-)
        I mean it’s not a big thing either, I can just create a custom button that resembles the themes button… but would’ve been neat.

      • Hey Phil, New upgrade is ready you can upgrade the plugin to enjoy the button translation. By the way, PayPal does not support all languages for all buttons but I hope you will get the translation of what you choice. thanks

  10. This is a great plugin thank you! Can you help with one small thing? I cannot change the language to anything other than Danish. If I select another language then hit save it reverts back to Danish. Any ideas why? Thanks

  11. I really appreciate this, it’s going to come in handy. But I have to confess I have no idea what to do, being that I’m a complete novice with WordPress. Am I to copy and paste the shortcode of my choosing into the page I want? Is there code I’m supposed to be adding? I just have no idea. Please help. Thanks a lot.

    • Yes, you need to copy a code (like below) and paste it in your page or post. thats it. Assuming, you need a buy now button.

      [paypal_button name="YOUR_PRODUCT_NAME" amount="YOUR_PRODUCT_CHARGES" business="YOUR_PAYPAL_EMAILADDRESS"]

      Change the words in capitals with your own settings. There are many other options you can customize from “Settings->PayPal Button” page.

  12. Hi Moh. This button works great! I’m only having one small problem. I’m trying to center it at the bottom of the post. I even center the [paypal_button] shortcode in the post formatting options, but no matter what it defaults to the bottom left of the screen. Is there a way to change this?

    • Thanks fullmetalmikey for appreciation. Post formatting does not center it because the button reside in blocked form element. Please put following css in your theme’s style.css to center it.

      form.paypal_button_form {text-align:center !important}

      Please note that it will be applied to all the button in your website.

      • Thank you for your prompt response and solution. That worked perfectly! I donated and will give your plugin a good review. Thanks again!

  13. This looks to be a great plugin. I made a test page and the shortcode worked fine. However, when I tried to put it in a text widget, the widget just shows the literal text of the code and not the button. Do I need to do something special to make it work in a widget?

  14. I had a question about checkout_logo_url. I put the URL of a PNG file that is 217×90 (so within the max size) in both the default setting field and as an argument in the shortcode. However, the graphic doesn’t show up on the checkout page. Can you please have a look? http://low-forecast.com/

  15. Hi, this really looks almost like what I’m looking for, but I have a question: would it be possible for the client to insert the price themselves, in a text box?

    What I want to do is create a “pay now” page for a chalet rental so that clients can pay their week online. It won’t be displayed on the website, but I’ll send the link to the pay page by email to clients who confirmed their booking for them to pay by cc. The thing is that there are loads of possible prices depending on how long they stay and on what dates. So I want them to enter the price themselves before paying. You see?

    Is that possible with your plugin? In fact, the principle is a bit like a donation button where you can enter the amount you want to give, but with the “pay now” button.

    Many thanks for your time.

  16. Again and again I’m amazed by your work and support!

    Can I create a widget where I can have an input box, so that customers can type in a value and then click a button to get linked to paypal with the amount they just typed in?

  17. Hi this plugin is really great and easy to use. Need to know if it is possible to have a subscription type for automatic monthly donations for those who want to donate monthly via paypal/ card?

    • Dane, Unfortunately, It does not support any kind of subscription yet. I am thinking about adding it but it wont be available in near future though. Thanks for taking interest in my plugin.

  18. When I create donate buttons via PayPal button tool for html sites, customers were automatically sent to a PayPal generated Thank You page. Is this true with this plugin, or do I have to create a custom page?

  19. This tool is wonderful! I’m trying to get my custom button to show. I put in a link to a .png file, but it’s still showing the default Pay Now button. Any thoughts?

  20. Hi – thank you so much for this plugin – it works great! I have 1 request – can you add dropdown functionality ie:

    Small $25
    Medium $50
    Large $75

    thanks!!!!!

  21. Hello Mohsin,
    Thank you very much for this plugin. It really simplifies adding basic Paypal features to a site. Nice.

    I have an issue I have not been able to resolve. Not sure if it is a bug or my ignorance causing it. The site is a standard 3.5.1 installation.

    I have tried the following short-codes:

    [paypal_button type="donations" name="Donation for event" amount_prompt="1" currency="USD"]

    ** Results in what looks like a missing image placeholder. When I click on that placeholder, it takes me to https://www.paypal.com/cgi-bin/webscr

    If I am logged into Paypal, that link generates the following error from Paypal:
    “You have requested an outdated version of PayPal. This error often results from the use of bookmarks.”

    If I am not logged it, Paypal tells me I need to log in to view the link. But then it just takes me to the default PP user page. Or it might say “Your session has timed out, please log in again.”

    I have also tried:
    [paypal_button type="donations" currency="USD" amount=""]

    … and numerous other combinations.

    The PAYNOW option works fine.

    I will post this message on the WordPress support system too, because that way I will more clearly know when you have responded.

    Thank you very much,

    Jonathan

    • Please use “donate” or “donation” in the type attribute (i.e. without “s”). Secondly, I did not get any PayPal error or warning. Perhaps it is somehow connected to same “s” :-)

      • Thanks. I will try it without the “s”. Although I must check if I even used an “s” on the site, as I typed those shortcodes into my note here by hand. Will let you know.

  22. Thank you for this wonderful plugin! So far this is the most amazing thing I have seen, and I am new to WP!

    I do have a question however, I have a pre-existing drop down menu made in Paypal with a few set values (prices & descriptions), can this be translated into this plug-in?

  23. Hi. I like the simplicity of this plugin but for the life of me, I can’t figure out how to view cart or checkout without having to add another product to get to the cart. Am I missing something or do you have a magical spell I can cast?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s