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.

Advertisements

145 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/

    • First of all few customization features require PayPal Premier or Business account. I guess, you are using PayPal personal account. Secondly, the Logo URL you are providing is actually leading to a wordpress page instead of Image. Please use image URL which is in your case is

  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?

  24. Hello. I am enjoying your plugin very much. Thank you. However I cannot get the add_note to work correctly.
    here is what I am attempting to use:
    Donate In Memory Of: [paypal_button type=”donate” amount=” ” add_note”yes”]
    Everything works great except I never see a NOTE field. What am I doing wrong or missing?

    Again, thank you!

  25. Hi! Great plugin so far but where is the settings page?
    I doesn’t appear next to the plugin name and description in the plugin section.
    There’s only “Deactivate” and “Edit”. No “Settings” page…
    I am using WP 3.5.2.

    Thanks for your help!

    • Sorry Chris, It does not have this feature. But you just need to change the PayPal URL in the “PLUGINS/paypal-pay-buy-donation-and-cart-buttons-shortcode/paypal-pay-buy-cart-buttons.php” file on line 157.
      Thanks

  26. Hi Thanks for a great plugin.

    I’m using the shortcode in a template file

    [paypal_button type=”buynow” name=”blahblahblah” amount=”12.00″] but I keep getting the error

    “The link you have used to enter the PayPal system contains an incorrectly formatted item amount.”

    I’ve tried leaving out the zeros but no luck. Any ideas?

    Cheers!

    • Hi, I managed to sort it

      I had to remove all inverted commas as they were being added again.

      [paypal_button type=”buynow” name=blahblahblah amount=12.00]

      This works but if you want to have more than one word for the name i.e name=Product Name only the first word will show up so at the moment I have to put product names in like this

      name=Product_Name so that the full title will show.

      Cheers

      • Have tried using double quotes to wrap the product name? Following is the standard way of using the shortcode. If it does not work, another script might be interfering with the post contents.

        [paypal_button type=”buynow” name=”Product Name” amount=”12″]

      • Thanks for getting back to me!

        That was what caused the problem. If I put the product name in with double quotes the plugin adds another set of double quotes round it causing an error with PayPal. Same thing with the price etc.

        Cheers

  27. Hello!
    This is a great plugin that can add paypal to any WP site.
    Thanks for developing it.

    I m trying to add an input text(not hidden) where my visitor can enter his username so I can later know where is the payment coming from?

    For now I m using the following paypal form hardcoded:

    Username

    How can i add the last input text in the shortcode?

    • Makis,
      Plugin does not support custom fields yet. But you can fulfill similar functionality using “add_note” attribute which will display a text box in PayPal screen. I believe, you have to instruct your user add their username in next screen.

  28. Hey there I love your plugin!! amazing work 🙂

    I have one little challenge which I hope you can help me with.

    I have this short code:

    [paypal_button type=”paynow” name=”1st Degree & FREE Shamanic Healing Session” amount=”.50″ thankyou_page_url=”http://spiritualtrainingacademy.co.uk/about”]

    My problem is the thankyou_page_url isn’t directing after payment?

    Can you steer me in the right direction of what I’ve done wrong please.

    Many thanks
    Kerry

  29. Interesting Plugin; Don’t understand something very basic – how does the plugin “know” how to tell paypal which account to post the payments to?? In otherwords normally one would need to log onto Paypal with a username and password and then create the payment button code which is unique for that account – in this case the only identifier is the e-mail address??? I must be missing something basic. THx.

    • E-Mail address is the ID of the PayPal account where payment will be transferred. The buttons you are talking about (i.e. creating payment button after signing in to PayPal) are Secure Payment Buttons. PayPal generates a secure hash against each button of specific settings you create. Both versions of the buttons has their own pros and cons. Non-hashing buttons are more dynamic on the other hand hash generated buttons are more secure.

  30. Hi ! I’ve just installed this plugin, it’s quite perfect, except a little detail : usual Paypal cart buttons (created directly from Paypal website) can also basically manage stock. We set a qty available when creating the button, and the button is unactivated when the qty is over. Do you think it’s possible to add this feature ?

  31. Thanks for the plugin but my donate button is displaying some addition text on the extreme right.
    onclick=”return adjustPayPalQuantity412(this);”>
    How can I remove it. thanks again.

  32. Love the plugin… it save my time a lot.
    I have a restaurant and have added add to cart button on each products. how can I dynamically add quantity, item price + addons price in short code in wordpress.

  33. Hi,

    This plugin works great, but is there any way to have a variable amount? I have a fee calculator on my page using Javascript. How can I inject a variable amount into the PayPal button?

    Something like;

    [paypal_button type=”paynow” amount=my_variable.value]

    Thanks

    • While using a javascript, you can use execute WordPress shortcodes until you send them back usin AJAX to fetch the actual output. There is a better method to directly fill the amount field of the generated form. Using jQuery, you can do it like

      jQuery('.paypal_amount').val(your_value);

      Thanks

  34. Hi, Outstanding plugin I’ve been experimenting with it today and noticed that the [quantity=”1-5″] always goes to the left of the CC logo. I want it place it above the Buy Now button so that buyer can clearly see it prior to clicking on the Buy Now button.

  35. I love the plugin so far! Can I use multiple currencies?

    A client runs a store in Toronto, so half the customers want to pay in USD and half want to pay in CAN. Is there a way to incorporate both?

    • This plugin does not do currency conversion. But you can use two shortcodes, one for USD and one for CAN, and switch them on user’s selection of currency (dropbox or radio box) through javascript. It should be fairly easy if you know how to code.

      • What would I put in the short code to differentiate between two buttons?

        It would be something like, “For American customer, please click here to complete your order [paypal_button (USD)]”

        “For Canadian customers, please click here to complete your order [paypal_button (CAN)].”

        How do I set up two separate buttons?

        Thank you very much for your quick responses and support!

        Blake

      • As per your sentences,

        “For American customer, please click here to complete your order [paypal_button amount=’10’ currency=’USD’]”
        and
        “For Canadian customers, please click here to complete your order [paypal_button amount=’10’ currency=’CAN’].”

  36. I love this plugin as well. I wanted to know if I’m able to make more than 1 button. I have made a button for Donate and wanted to make another button for Buy Now. Am I able to do that?

    Thanks

  37. Hi!

    Great plugin! I’m terrible at understanding shortcodes etc.
    Could you let me know what the whole short code etc. should be if I wanted the following:

    – User allowed to input invoice / reference number
    – User allowed to input the amount (£ GBP) to pay now.
    – The end paypal button would be a “Pay Now” type.
    – Logo url = http://www.rentals.09productions.com/wp-content/uploads/2013/05/09rentals-300×57.png
    – return page url = http://rentals.09productions.com/?page_id=1356

    Many thanks for your time in creating this app.

    • Following is the possible shortcode you can use. “amount_prompt” will let user enter the amount and “add_note” will show a text box in PayPal’s checkout screen where user can enter invoice ID.

      [paypal_button type="paynow" name="Invoice" amount_prompt="1" thankyou_page_url="http://rentals.09productions.com/?page_id=1356" checkout_logo_url="http://www.rentals.09productions.com/wp-content/uploads/2013/05/09rentals-300x57.png" add_note="yes"]

      Thanks

    • Please use “name” parametere like this

      [paypal_button type="buynow" name="WordPres Portfolio Theme" amount="100"]

      For above example, “WordPres Portfolio Theme” will display under purpose. Thanks

  38. Hi Mohsin,
    Thanks for a very easy and helpful plugin! Just a quick question. I have a website with pages in english and spanish and have the plugin working well in English with a Donate button. I now want to put a spanish version of the button on the spanish page, but I cant seem to work out how to do it. There seems to be just one language setting, so wont this just change the language throughout all pages?
    Thanks.

    • You can use a spanish version of the custom PayPal button for your spanish page. Take a look at this page and note the en_AU in the URL of the button, change it to your, I guess, es_ES.

  39. Hello, your plugin is really awesome but i have one problem. Everything works fine in firefox but the button is not clickable in safari and chrome. I tried to finde a solution but without success. Can you please adivse? Thanks in advance.
    Dob

  40. Awesome plugin! Is there a way to create a dynamic shortcode that has the name=”Page or Post Title” ? Thought I would ask direct in case you had a hook or something I could call to make that happen. Thanks! : )

    • Yes, it does have an attribute which by default fetches the current post or page title. You can specify your own title by adding name = “My name”. If you interested in a hook, it does not have any yet.

  41. Love this plugin – I have an issue with the item_number. Even thoughI use the code like item_number=”ES24092″ the result in the paypal windoew is always “Item number: 1481”

    I’ve tried many variants but the results are always the same 1481 number – I also tried removing single amd double quotes, but in some cases all the formatting disappears.

    Any ideas?

  42. Hello, Just double checking this… I have my regular PayPal “Pay Now” button that goes to my default business and email address/account.

    If I want a 2nd button just below that, that the payment goes to a different PayPal account, would the shortcode be [paypal_button email=”alternateaccount@example.com” open_new_window=”1″]

    This way it would open up my default page with the same logo, but the payment would actually go into the email address of the alternate account? It would just be invisible to the user? Thanks.

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 )

Google+ photo

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

Connecting to %s