HTML PayPal Button code

Create your PayPal Button widget
Screenshots
Why add PayPal payments to your HTML website
One widget covers one-time payments, subscriptions and donations, so you do not need a separate tool for each. Set up the button in the editor and choose the payment type that fits your offer.
Tax and shipping are calculated automatically and included in the final PayPal amount, so buyers see the full total. Pick the currency and set the localization for your audience’s country.
Key features of the HTML PayPal Button
- One-time payments, subscriptions and donations – choose the payment type in the editor.
- Tax and shipping – set shipping as a fixed amount and tax as either a fixed amount or a percentage; both are included in the final amount.
- Currency and localization – select a global currency and set the button localization from a list of countries.
- Button design – set the width, height, shape, border radius and colors.
- Card icons – show or hide payment method icons such as Visa, Mastercard and American Express.
- Thank-you page – redirect buyers to a custom page after a transaction.
- Responsive size – the button looks right on any device.
More options in the live editor.
Add a donation button to your HTML website
Collect donations with the same button you use for sales.
- Pick donations as the payment type in the editor, next to one-time payments and subscriptions.
- Let donors enter their own contribution amount.
- Choose the currency your donors use, then copy the code and paste it into your page.
How to add PayPal Button to an HTML website
Create your button in the Elfsight editor and configure its payment settings. In your Elfsight dashboard, find the widget and click Install → Copy Code.
Good to know: Your website must allow HTML embeds and JavaScript. Insert the complete installation code inside <body>, where the button should appear.
Method 1: Add the button to a single page
- Open your website files in a code editor or hosting file manager.
- Select the HTML file for the page you want to edit.
- Paste the installation code where the button should appear, such as beside a product description or below a service price.
- Save the file. If you edited it locally, upload the updated version to your server.
- Open the published page and check the button’s appearance and payment destination.
Method 2: Add the button through a shared template
Use this method if your website includes a shared template or component across multiple pages.
- Open the shared template or included file, such as your footer or sidebar.
- Paste the installation code where you want the button within that layout.
- Save your changes and publish or rebuild your website as required.
- Check several pages that use the template to confirm the button appears correctly.
Note: The shared file must actually be included by your website. Creating a file named footer.html alone won’t display the button on every page.
Method 3: Add the button to multiple separate HTML pages
If your website has no shared templates, update each page individually.
- Open each HTML file where you want the button.
- Paste the installation code into the desired position inside <body>.
- Save and upload the updated files.
- Check each published page to confirm the placement.
For more detailed instructions, check our Help Center guide. If you still need help, our support team can help you install the widget on your website.