Integration Guide

Table Of Contents
PayPal Payments Standard Integration Guide June 2012 411
HTML Form Basics for PayPal Payments Standard
Using HTML Variables With Saved Payment Buttons
13
Using HTML Variables With Saved Payment Buttons
When you create payment buttons on the PayPal website and save them in your PayPal
account, PayPal generates HTML code for the saved button. You must add this generated code
to your website. Otherwise, buyers have nothing to click on.
Most features of the button, such as item name and amount, are saved with the button in the
PayPal account. Therefore, PayPal generates much simpler code for saved buttons than for
other buttons, as the following example shows.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Saved buttons use the "secure click" command -->
<input type="hidden" name="cmd" value="_s-xclick">
<!-- Saved buttons are identified by their button IDs -->
<input type="hidden" name="hosted_button_id" value="221">
<!-- Saved buttons display an appropriate button image. -->
<input type="image" name="submit" border="0"
src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif"
alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1"
src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
</form>
IMPORTANT: Do not write HTML button code for saved payment buttons yourself. The
value for the hosted_button_id variable is generated solely by PayPal.
Results are unpredictable if you use your own value.
You should not write HTML button code for saved buttons. Always use the code that PayPal
generates. However, you can enhance the generated code for saved buttons by adding hidden
HTML variables that do not affect the transaction amount. For example, you can enhance
saved buttons with automatic fill-out variables, as described in “Filling Out FORMs
Automatically with HTML Variables” on page 411.
Filling Out FORMs Automatically with HTML Variables
With PayPal Account Optional turned on in your Account Profile, you can accept payments
from buyers without PayPal accounts. However, checking out by paying with PayPal is often
faster for buyers because they do not re-enter information that is stored by them on PayPal. For
repeat buyers, it is to your advantage to encourage them to sign up for PayPal accounts.