How to Add a PayPal Button to Your Website

PayPal builds the button for you: sign in, open paypal.com/donate/buttons for a Donate button, and finish the wizard to get a code that contains your hosted_button_id. Paste that code, or just the ID on builders that ask for it, where the button should appear. Test with a small real payment or PayPal's sandbox first.

Donate button versus Buy Now button
DonateBuy Now / checkout
AmountVisitor can choose, or you suggest oneFixed price you set per item
Typical useCharities, creators, tip jarsOne product, ticket or deposit
Shipping and taxNot collectedCan be configured per button
AccountBusiness account gets a hosted_button_id; personal accounts use the business emailBusiness account

Updated

PayPal buttons are the quickest way to take money without building a store. The button sends the visitor to PayPal (or opens a PayPal window over your page with the Donate SDK), PayPal takes the payment, and the money lands in your account. Your website never handles card details.

Add a PayPal button on We.Inc, WordPress, Wix, Squarespace or plain HTML

We.Inc

  1. Create the button in PayPal and copy its hosted button ID.
  2. From the ... menu, open Add-ons and pick PayPal Donate, or PayPal checkout for a fixed price.
  3. Paste the ID into the add-on's field and switch it on.
  4. Ask in the AI chat where it goes, for example 'put the PayPal donate button under the About section'.
  5. Publish, then click the button on the live site to check it opens PayPal.

WordPress

  1. Copy the code PayPal generates for your button.
  2. Add a Custom HTML block where the button should be.
  3. Paste the code and Update the page.
  4. Alternatively install PayPal's official plugin for WooCommerce if you are building a full store.

PayPal's Donate SDK uses a script tag, which WordPress.com only keeps on paid plans with plugins and hosting features turned on.

Wix

  1. In the Editor, click Add Elements, then Button, then PayPal Buttons.
  2. Drag the Donate or Buy Now button onto the page.
  3. Click it, choose Add PayPal Info and pick Donating or the purchase option.
  4. Enter your PayPal email, organisation name, currency and amount settings.

Wix's PayPal button needs a PayPal Business or Premier account.

Squarespace

  1. Copy the PayPal button code.
  2. Edit the page and add a Code block.
  3. Paste the code and save.
  4. Check it on the live site; code blocks show a placeholder in the editor.

Code blocks only run JavaScript on the Core, Plus or Advanced plan. On other plans, use a button block that links to your PayPal donation link instead.

Plain HTML

  1. Add an empty div with an ID where the button goes.
  2. Include PayPal's donate-sdk.js script below it.
  3. Call PayPal.Donation.Button with your hosted_button_id and render it into the div.
  4. Test with env set to sandbox, then remove it and swap in the live ID.

PayPal's Donate SDK pattern

Donate button rendered by the SDK

This is the shape PayPal documents. Swap in your own ID; while testing, PayPal's sample adds env: 'sandbox' and a sandbox ID.

<div id="donate-button"></div>
<script src="https://www.paypalobjects.com/donate/sdk/donate-sdk.js" charset="UTF-8"></script>
<script>
  PayPal.Donation.Button({
    hosted_button_id: "YOUR_HOSTED_BUTTON_ID",
    image: { src: "https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif", alt: "Donate with PayPal" }
  }).render("#donate-button");
</script>

Sources

Checked October 28, 2026: the PayPal button pages we read.

  • PayPal developer docs for the Donate SDK: https://developer.paypal.com/sdk/donate/
  • Wix Editor PayPal Donate button setup: https://support.wix.com/en/article/wix-redigerare-konfigurera-din-paypal-donationsknapp
  • Wix Editor PayPal Buy Now button setup: https://support.wix.com/en/article/setting-up-your-paypal-buy-now-button
  • Squarespace code block plan requirements for scripts: https://support.squarespace.com/hc/en-us/articles/206543167-Code-blocks

Hosted button ID versus raw HTML

Older tutorials paste a long HTML form with your email address in a hidden field. Hosted buttons are safer: the price and settings live in your PayPal account, so nobody can edit the page source to change the amount.

The Donate SDK is PayPal's current pattern for donations. It loads one script from paypalobjects.com and renders the button into a container you choose.

How it works

  1. Decide between Donate and a fixed-price checkout button.
  2. Create the button inside your PayPal account and note the hosted button ID.
  3. Paste the code or ID into your site.
  4. Make a test payment in the sandbox or a small live one and refund it.
  5. Set where PayPal sends people after paying, such as a thank-you page.

Tips

  • Sandbox button IDs do not work live. PayPal's docs say to create new hosted buttons in the live account before launch.
  • A charity label is not automatic. Registered charities should enrol in PayPal's charity programme so donors see the right wording and receipts.
  • Place the Donate button next to a sentence on what the money pays for. A bare button converts poorly.
  • PayPal payments made through a Wix PayPal button go straight to PayPal, so they will not show in your Wix dashboard; reconcile in PayPal.

Frequently asked questions

Can I add a PayPal Donate button with a personal account?

PayPal's Donate SDK accepts a business value (your email or payer ID) for personal accounts instead of a hosted_button_id. Wix's PayPal button element requires a Business or Premier account.

Does the PayPal Donate button cost anything?

Creating the button is free. PayPal charges its standard fees on each payment received; check the fee page for your country and whether you qualify for charity rates.

Can the donation open without leaving my site?

Yes. PayPal's Donate SDK shows the donation flow in a pop-up over your page instead of redirecting to a PayPal donation page.

Should I use PayPal or Stripe?

Many buyers trust PayPal and some prefer not to type a card. Stripe gives more control over checkout. Plenty of sites offer both; our Stripe vs PayPal guide compares fees and features.

Related: Stripe vs PayPal, Accept payments on a website, Stripe payment links, HTML embed code generator, Sell digital products.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

Product

Who It's For

Features

Resources

Company

View Sitemap