By El Ghali Bennis · Published
PayPal Buy Now Button HTML: Add One Without Plugins
Copy-ready PayPal Buy Now button HTML, Smart Buttons code, donate and add-to-cart options, plus the limits nobody mentions. No plugin required.

A PayPal Buy Now button in HTML is a snippet you paste into your page that sends a buyer to PayPal to pay for one item. You generate it in your PayPal business account, copy the code, and embed it. No plugin is needed. It works for one product at a time, not a full cart.
That's the short version. The longer one matters, because PayPal now offers two very different ways to do this, and the older one has real limits. This guide covers both, with code you can copy, plus donate buttons, add-to-cart options, WordPress without a plugin, and the point where buttons stop making sense.
How Do You Create a PayPal Button for Your Website?
You create a PayPal button from inside your PayPal Business account, under the pay links and buttons tools. You enter an item name and price, PayPal generates the code, and you paste it into your page. It takes about five minutes.
You need a verified PayPal Business account first. Personal accounts can't generate button code. Once you're in, the steps look like this:
- Log in to PayPal Business and open the pay links and buttons section.
- Choose the button type: Buy Now, Add to Cart, Donate, or Subscribe.
- Enter the item name, price, and currency.
- Set shipping and tax rules if needed.
- Save the button, then copy the HTML or embed code.
- Paste it into your page where the button should appear.
Check PayPal's own business pages for the current menu names, since PayPal moves them around. The code you get back falls into two families: a hosted-button form, or a Smart Buttons script.
PayPal Buy Now Button HTML: The Code You Can Copy
The classic Buy Now button is a plain HTML form that posts to PayPal. It needs no JavaScript. You set the item, price, and your business email or merchant ID, and the buyer lands on PayPal's checkout.
Here's a minimal version with fixed values:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="YOUR_MERCHANT_ID">
<input type="hidden" name="item_name" value="Linen Tote Bag">
<input type="hidden" name="amount" value="28.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="https://yourstore.com/thank-you">
<input type="submit" value="Buy Now">
</form>
Swap in your own merchant ID, item name, and price. The return field sends buyers back to your thank-you page after paying.
Hosted buttons vs. unencrypted forms
The form above exposes the price in your page source. A curious buyer can edit it in their browser and pay less. That's why PayPal pushes hosted buttons, where the price lives on PayPal's servers and your HTML only holds a button ID:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="YOUR_BUTTON_ID">
<input type="submit" value="Buy Now">
</form>
If you sell anything, use the hosted version. Tampered prices are a real problem with raw forms, and you'd only catch them when reconciling orders.
How Do You Embed PayPal Smart Payment Buttons?
PayPal Smart Payment Buttons are the modern option. You load PayPal's JavaScript SDK, then render buttons into a container on your page. They show PayPal, Pay Later, and card options automatically, based on the buyer's location and device.
The setup needs a client ID from the PayPal developer dashboard. Per PayPal's developer documentation, you load the SDK with that ID and call the Buttons method. A trimmed example:
<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID¤cy=USD"></script>
<script>
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{ amount: { value: '28.00' } }]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Paid by ' + details.payer.name.given_name);
});
}
}).render('#paypal-button-container');
</script>
Use a sandbox client ID while testing so no real money moves. Switch to your live ID only after a full test purchase works.
Why Smart Buttons beat the old form
- Buyers pay without leaving your page. A popup handles login and approval.
- More payment methods appear automatically, including cards without a PayPal account.
- You control the logic. Price, shipping, and order details are set in code, so you can change them without regenerating a button.
The tradeoff: you're writing JavaScript, and you should verify payments on a server before shipping anything. Capturing client-side alone is fine for a demo, not for a real shop.
PayPal Add to Cart, Donate, and WordPress Options
Buy Now handles a single item. For several items you need an Add to Cart button, which feeds PayPal's hosted cart. Donations use a separate button type. WordPress works with all of them using a plain HTML block.
PayPal add to cart button
The Add to Cart form uses cmd set to _cart plus add set to 1. Buyers click it on each product, then review everything on PayPal's cart page via a separate View Cart button. It works, but the cart lives on PayPal, not on your site. You can't show cart totals, suggest add-ons, or recover abandoned carts.
PayPal donate button setup
For a PayPal donate button setup, pick Donate in the button creator. Choose a fixed amount or let donors enter their own. Nonprofits can also link a PayPal Giving Fund profile, which handles donation receipts. The code works like Buy Now: a hosted button ID in a form, or a Smart Button with a donation amount field.
PayPal button for WordPress without a plugin
You don't need a plugin for a PayPal button on WordPress. In the block editor, add a Custom HTML block, paste your form or SDK snippet, and publish. Preview first, because some themes strip scripts for non-admin roles. If the button vanishes, check your security plugin's content rules before blaming PayPal.
PayPal Hosted Button Limitations You Should Know
Hosted buttons are simple but narrow. They have no real inventory tracking, no variant logic, and no cart on your own domain. They suit a handful of products, a service fee, or a donation page. They don't suit a growing catalog.
Here's how the options compare:
| Approach | Setup effort | Cart on your site | Inventory tracking | Best for |
|---|---|---|---|---|
| Raw HTML form | Very low | No | No | Quick tests only |
| Hosted button | Low | No (PayPal cart) | Basic, manual | 1-5 products, donations |
| Smart Buttons (SDK) | Medium, needs JS | You build it | You build it | Custom sites with a developer |
| Full store platform | Low to medium | Yes | Yes | Anyone planning to grow |
Other limits show up fast in practice:
- Variants are clumsy. Size and color options need dropdown fields, and each combination can't carry its own stock count.
- Every button is manual. Change a price and you edit or recreate the button, then update every page that uses it.
- No customer accounts or order history on your side. PayPal holds that data.
- No abandoned cart recovery, reviews, or email flows. Those need a real store.
- Dispute exposure. PayPal's seller protection has conditions, and buttons give you little order data to fight a claim. Our guide on handling chargebacks covers what evidence you'll want.
Fees matter too. PayPal publishes its rates on its business fees page, and they vary by country and payment type. Compare them against alternatives in our best payment gateway for a small online store breakdown.
When a PayPal Button Is Enough (and When It Isn't)
A button is enough if you sell fewer than about five products, ship simply, and process a few orders a week. Past that, you'll spend more time patching the setup than selling.
Here's a quick test. Answer yes or no:
- Do you need to track stock across more than a few items?
- Do customers ask for order status or accounts?
- Do you want a real cart that shows on your own domain?
- Do you plan to run email follow-ups or discounts?
Two or more yeses means you've outgrown buttons. You have two paths. One is a store platform with PayPal built into checkout, which our guide to adding PayPal to an online store walks through. The other is stacking apps on Shopify or plugins on WooCommerce, which brings its own bills. Our Shopify app costs piece shows how quickly that adds up.
If you're weighing processors rather than just buttons, Shopify Payments vs PayPal compares fees, payout timing, and holds side by side.
Common mistakes to avoid
- Pasting a raw form with the price exposed on a live store.
- Testing with live credentials instead of the sandbox.
- Skipping server-side payment verification with Smart Buttons.
- Forgetting a return URL, so buyers land on a PayPal receipt and never come back.
- Using one button for items with different shipping costs.
Start With a Button, Grow Into a Store
A PayPal Buy Now button is the fastest way to take a first payment. Use a hosted button or Smart Buttons, never a raw form with an open price, and test in the sandbox before you go live. Treat it as a starting point, not a storefront.
When you're ready for a real cart, inventory, and checkout, Rovela builds a complete store from a plain-language conversation. Stripe checkout, abandoned cart, wishlist, reviews, and an admin dashboard come included in one flat subscription, with no per-app billing. You can see the plans or start at rovela.ai and have a store live in hours instead of patching buttons together.
