Now that you have created your new button(s), it's time to update your website. This process involves removing the old, outdated code and pasting in the new, secure code you generated in Step 1.
Locate Payment Button code
- Choose the right button code based on your website technology and needs
- Stacked Buttons (Recommended): Navigate to “Stacked Buttons” tab. This option lets you present all of your product information and PayPal payment method upfront on your website. Your customers can choose to pay with other payment methods by clicking on the third button (Checkout button).
- Single Button (embed a payment link): Navigate to “Single button” tab. This option lets you quickly paste a single button on your site. Once customers click the button, they will be redirected to a PayPal page with product information and PayPal payment method.
- To manage your button code later, go to “More Actions” > “Saved Links and Buttons.”
Understanding Your New Button Code
When you copy the code from the PayPal Payment Button Builder, you will notice it's provided in two parts. It's very important to understand what each part does.
Part 1: The PayPal Setup Script
This is a single line of code that loads PayPal's functionality onto your website. Think of it as the "engine" that powers all your new payment buttons.
- You only need to add this script ONCE to your website, even if you have many buttons.
- It looks something like this:
Part 2: The Unique Button Code
This block of code is what actually displays the payment button for a specific product. Each button you created in Step 1 has its own unique Part 2 code.
- You must add this code for EACH product you want to sell.
- It needs to be placed exactly where you want the button to appear on your page, usually next to the product's description.
- It looks something like this (note the unique ID in the first line; this is different for each Payment Button):
How to Replace the Code on Your Site
1. First, Find and Remove Your Old Legacy Code
Before adding anything new, you need to locate the old code. This legacy code is typically an HTML <form> block for each product.
- How to Find It: Open your website editor and view the page containing your products in HTML or "code" mode.
- What to Look For: Search for code that contains any of these keywords:
- paypal.com/cgi-bin/webscr
- cmd=_xclick
- input type="hidden" name="business"
Here is a typical example of the old legacy code you need to delete:
Remove this entire <form>... </form> block for each product on your site.
2. Next, Add Your New Code
Now you'll paste in the new, two-part code.
- Add Part 1 (The Setup Script) Once:
- Copy the Part 1 "Setup Script" from the Button Builder. Paste it once in a central location on your website template, ideally just before the closing tag. Placing it here ensures the script is loaded on every page that might have a button.
- Add Part 2 (The Unique Button Code) for Each Product:
- Go back to the button you generated for your first product. Copy its unique Part 2 code.
Paste this code into the space where you just deleted the old legacy
-
Example: Upgrading a Page with Two Products