PayPal Payments Standard / HTML Reference / HTML Form Basics
DocsLegacyLast updated: October 12th 2021, @ 6:58:00 pm
This chapter describes in technical terms the basic functionality of PayPal Payments Standard and its use of HTML Forms. Use the information in this chapter as a guide to writing the HTML code yourself for PayPal Payments Standard payment buttons. A wide variety of HTML authoring tools exist. This guide does not describe all the possibilities.
People who pay you through PayPal Payments Standard interact with HTML forms and hidden HTML input variables that you place on your website. When someone clicks a payment button in an HTML form on a webpage, the form submits the variables and their values to PayPal. You set the values of the variables to produce the desired effect, such as invoking the Buy Now, the Donate, the Subscribe, or the PayPal Shopping Cart checkout experience and various other PayPal features.
Form attributes — ACTION and METHOD
FORM tag includes two required attributes,
method, which always look like this:
<FORM action="https://www.paypal.com/cgi-bin/webscr" method="post">
Important: Do not change these values. These attributes are required for all payment buttons and the Cart Upload command.
HTML input variables in a PayPal Payments Standard
FORM are always hidden from the payer's view. They have the following general format:
<INPUT TYPE="hidden" name="variableName" value="allowedValue">
is an HTML variable name. is an HTML variable value.
For information, see HTML Variables for PayPal Payments Standard.
Specifying button type — cmd
cmd variable is always required in a
FORM. Its value determines which PayPal Payments Standard checkout experience you are using to obtain payment.
|Value of cmd||Description|
|The button that the person clicked was a Buy Now button.|
|For shopping cart purchases. The following variables specify the kind of shopping cart button that the person clicked:|
|The button that the person clicked was a Subscribe button.|
|The button that the person clicked was an Automatic Billing button.|
|The button that the person clicked was a Donate button.|
|The button that the person clicked was protected from tampering by using encryption, or the button was saved in the merchant's PayPal account. PayPal determines which kind of button was clicked by decoding the encrypted code or by looking up the saved button in the merchant's account.|
The input tag looks like one of the following:
- Buy Now buttons —
<INPUT TYPE="hidden" name="cmd" value="_xclick">
- Shopping cart buttons —
<INPUT TYPE="hidden" name="cmd" value="_cart">
- Subscribe buttons —
<INPUT TYPE="hidden" name="cmd" value="_xclick-subscriptions">
- Automatic Billing buttons —
<INPUT TYPE="hidden" name="cmd" value="_xclick-auto-billing">
- Donate buttons —
<INPUT TYPE="hidden" name="cmd" value="_donations">
Important: These INPUT tags are required exactly as shown above. Do not alter them.See AlsoInformativo comentado: Informativo 625-STJ (RESUMIDO · PDF fileIniciou-se a execução penal quanto ao crime òA ó. João poderá aproveitar o tempo que ficou preso - [PDF Document]This is Really Happening: Fun With ForumsИгры спанч боб футбол, игра — Хроники ЗайчегаGta Namaste America Game Download For Pc
Variations on basic variables
This section highlights a few ways to use PayPal Payments Standard
Because an HTML variable can overwrite or depend on another variable, learn about HTML variable interactions and dependencies at HTML Variables for PayPal Payments Standard and Address Handling (U.S. Merchants Only).
Recordkeeping with passthrough variables
Some variables are exclusively for your own use, such as order management. PayPal returns the values that you send through Instant Payment Notification exactly as you sent them. For this reason, they are called passthrough variables. Their values are not recorded or used by PayPal.
The following are passthrough variables:
Setting the character set — charset
charset HTML variable to specify the character set and character encoding for the billing information/log-in page on the PayPal website. In addition, this variable sets the same values for information that you send to PayPal in your HTML button code.
For example, the following
INPUT tag sets the encoding to UTF-8:
<INPUT TYPE="hidden" name="charset" value="utf-8">
Character Sets and Encoding Schemes Supported by PayPal
- Big5 (Traditional Chinese in Taiwan)
- gb2312 (Simplified Chinese)
- HZ-GB-2312 (Traditional Chinese in Hong Kong)
- ibm-862 (Hebrew with European characters)
- ISO-8859-1 (Western European Languages)
- KOI8-R (Cyrillic)
- windows-874 (Thai)
- windows-949 (Korean)
Setting the return URL on individual transactions
With Auto Return turned on in your account profile, you can set the value of the return URL on each individual transaction to override the value that you have stored on PayPal. For example, you might want to return the payer's browser to a URL on your site that is specific to that payer, perhaps with a session ID or other transaction-related data included in the URL.
To set the return URL for a transaction, include the
return variable in the HTML
<INPUT TYPE="hidden" NAME="return" value="URLspecificToThisTransaction">
Desired currency on individual transactions
currency_code variable on individual transactions to specify the currency of the payment:
<INPUT TYPE="hidden" NAME="currency_code" value="CurrencyCode">
For allowable values in
currency_code, see Currencies Supported by PayPal. PayPal uses 3-character ISO-4217 codes for specifying currencies in fields and variables."
Note: If the
currency_codevariable is not included, the currency defaults to USD.
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" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online"> <img alt="" width="1" height="1" src="https://www.paypalobjects.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_idvariable 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.
Auto-fill forms 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.
Billing Information Page without Buyer Information Filled Out Automatically
When you initiate a checkout process, you can fill out the Billing Information page automatically by including special HTML input variables. When you pass these variables in your button code, with the buyer's name, billing address, and contact information, PayPal fills out the page automatically and displays a simpler version.
Billing Information Page Filled Out Automatically with the Buyer's Name, Address, and Other Contact Information
The automatically filled-out form displays Change links to let buyers change billing or contact information, if necessary.
Filling out the Billing Information page automattically with buyers' names, billing addresses, and contact information streamlines the checkout experience, reduces buyer friction, and helps improve the conversion of shopping carts to completed purchases.
For information about the variables to use, see Auto fill PayPal checkout page variables.
To learn how filling out addresses automatically affects the way PayPal handles billing and shipping addresses during checkout, see Address Handling (U.S. Merchants Only)."
Sample HTML code for auto-fill forms
The following sample HTML code shows a payment button with variables for automatically filling out PayPal forms for the buyer. Your website generates the field entries dynamically from information that your website gathers about the buyer. The variables and their values are included in the URL to which buyers are sent when they click the payment button.
Important: This page contains unencrypted button code for illustrative purposes only. To prevent malicious tampering of buttons on your live website, always encrypt your manually created buttons.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="email@example.com"> <input type="hidden" name="item_name" value="hat"> <input type="hidden" name="item_number" value="123"> <input type="hidden" name="amount" value="15.00"> <input type="hidden" name="first_name" value="John"> <input type="hidden" name="last_name" value="Doe"> <input type="hidden" name="address1" value="9 Elm Street"> <input type="hidden" name="address2" value="Apt 5"> <input type="hidden" name="city" value="Berwyn"> <input type="hidden" name="state" value="PA"> <input type="hidden" name="zip" value="19312"> <input type="hidden" name="night_phone_a" value="610"> <input type="hidden" name="night_phone_b" value="555"> <input type="hidden" name="night_phone_c" value="1234"> <input type="hidden" name="email" value="firstname.lastname@example.org"> <input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online"> </form>
Overriding addresses stored with PayPal
For people who already have PayPal accounts and whom you already prompted for a shipping address before they choose to pay with PayPal, you can use the entered address instead of the address the person has stored with PayPal. Set the
address_override variable to 1, as in the following example:
<INPUT TYPE="hidden" name="address_override" value="1">
You must also include
FORM variables that contain the person's address information, as detailed in Auto fill PayPal checkout page variables."
The payer is shown the passed-in address but cannot edit it. No address is shown if the address is invalid, such as missing required fields like country, or if the address is not included at all.
For a detailed description of how overriding the address and other settings affect the PayPal billing and shipping addresses, see Address Handling (U.S. Merchants Only)."
Sample HTML code for overriding addresses stored with PayPal
The following sample HTML code shows the
address_override variable in conjunction with variables for overriding a buyer's address that is stored with PayPal.
Important: The example button code shown below is unencrypted for illustrative purposes only. In reality, you must always use encrypted or hosted buttons in your web pages to prevent malicious users from tampering with the code.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="email@example.com"> <input type="hidden" name="item_name" value="Memorex 256MB Memory Stick"> <input type="hidden" name="item_number" value="MEM32507725"> <input type="hidden" name="amount" value="3"> <input type="hidden" name="tax" value="1"> <input type="hidden" name="quantity" value="1"> <input type="hidden" name="currency_code" value="USD"> <!-- Enable override of buyers's address stored with PayPal . --> <input type="hidden" name="address_override" value="1"> <!-- Set variables that override the address stored with PayPal. --> <input type="hidden" name="first_name" value="John"> <input type="hidden" name="last_name" value="Doe"> <input type="hidden" name="address1" value="345 Lark Ave"> <input type="hidden" name="city" value="San Jose"> <input type="hidden" name="state" value="CA"> <input type="hidden" name="zip" value="95121"> <input type="hidden" name="country" value="US"> <input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online"> </form>
Instant Payment Notification — notify_url
Someone pays you.
FORMvariables to a URL you specify that runs a program to process the variables.
You validate the notification.(Video) How to Create a PayPal Smart Button (PayPal Checkout Button)
Figure 3. How IPN Works — General Steps
Detailed description of each step:
- A payment or a refund triggers IPN. This payment can be via PayPal Payments Standard
FORMs or via the PayPal Web Services APIs for Express Checkout, MassPay, or RefundTransaction. If the payment has a "Pending" status, you receive another IPN when the payment clears, fails, or is denied.
- PayPal posts HTML
FORMvariables to a program at a URL you specify. You can specify this URL either in your account profile or with the
notify_urlvariable on each transaction. This post is the heart of IPN. Included in the notification is the payment information, such as the payer's name and the amount paid. All possible variables in IPN posts are detailed in the Instant Payment Notification Guide. When your server receives a notification, it must process the incoming data.
- Your server must then validate the notification to ensure that it is legitimate. For details, see the Instant Payment Notification Guide.
Log in to your account, go to Form -> Payments, and click the PayPal Pro tab. Check the box next to Enable PayPal Payments Pro and enter your API Username, Password, and Signature. Optional settings: Success pages: Create custom pages for successful transactions or use the default page provided by Formsite.How do I set up PayPal in HTML? ›
- Go to paypal.com/buttons and choose an appropriate button (Buy Now, Add To Cart, Subscribe, etc)
- Follow the prompts to create a custom button in PayPal.
- When you're finished creating the button, copy the HTML code that PayPal provides.
Beyond a simple payment solution, PayPal Payments Standard provides invoicing, transaction management, shipment tracking, and data integration with tools like Excel, Quickbooks, and Quicken.How do I set up PayPal payments on standard website? ›
How do I setup PayPal Website Payments Standard (WPS)?What is a payment form? ›
A payment form template is a type of payment form that is used by online stores to authorize payments from the customers from the given credit card. No coding is required!Is PayPal Checkout free? ›
Businesses that choose to use PayPal Checkout will be charged a 2.9% fee, plus $0.30 per transaction. But given that there are no startup fees or monthly dues to pay, many sellers find this to be a great option for their business.How do I accept PayPal payments on my website? ›
To use PayPal payment buttons on your website, you'll need to access your website's HTML and paste in a few lines of code. If you'd like to use PayPal Checkout, you can integrate it with your website or use an eCommerce partner like UEESHOP, Magento or Shopify. It's very easy to turn on.How do I integrate PayPal payment gateway in my website? ›
- Optional. Design an optimal checkout flow.
- Required. Choose the right payment button based on your business requirements.
- Required. Create a payment button using PayPal's website.
- Required. Test your payment button integration.
- Optional. Set up payment notifications.
- Accept credit and debit cards.
- Add a payment gateway.
- Set up a Direct Debit.
- Use eChecks.
- Integrate mobile wallet payments.
- Send click-to-pay invoices.
- Install recurring billing software.
The only real difference for your customers is the checkout flow. In Paypal Standard, your customer completes their check out and will be directed to the Paypal website. In Paypal Express, your customer go to the Paypal website first to approve the purchase and they go back to your website to finalize the order.
Website Payments Standard is a PayPal Checkout button you can add to your website or mobile app to securely accept debit, credit and PayPal payments. It is the faster and easier way if you do not want advanced programming involved, and gives your customers the option of paying without a PayPal account.How many PayPal pay in 4 can you have? ›
PayPal Pay in 4 is PayPal's buy now, pay later (BNPL) service for online shoppers. If you use this option at checkout, you can split your purchase into four equal payments with no interest or fees.What is the cost of PayPal payments standard cost? ›
PayPal's payment processing rates range from 1.9% to 3.5% of each transaction, plus a fixed fee ranging from 5 cents to 49 cents. The exact amount you pay depends on which PayPal product you use. A $100 transaction will cost between $2 and $3.99.How do I set up PayPal API? ›
- When you've created a business account, go to the PayPal Developer page and log in to the dashboard.
- After signing in, you'll be able to get a personal PayPal API key. For this, go to the “My Apps & Credentials” section and click “Create App”
- Enter an app name and click “Create” once again.
That's right, it costs you nothing to get started with Website Payments Standard; there are no upfront fees of any type. Monthly fee: Zero. You also don't pay any ongoing monthly subscription fee. In other words, there are no fixed costs; you pay only when you sell something.Can you add a PayPal button to a Google form? ›
Google Forms doesn't include a CTA button at the end of forms—but it does let you include a confirmation message where you can share the PayPal link. Just open your form settings, select the Presentation tab, and add a confirmation message along with your PayPal link.How do I integrate PayPal with Jotform? ›
Adding and Setting up PayPal Personal
- In the Form Builder, click the Add Form Element button.
- Go to the Payments tab.
- Search and click PayPal Personal from the list. You can also drag and drop it to add.