HTML Form Basics for PayPal Payments Standard (2023)

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

The FORM tag includes two required attributes, action and 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">

Where:

  • is an HTML variable name.
  • is an HTML variable value.

For information, see HTML Variables for PayPal Payments Standard.

(Video) PayPal Checkout Integration Tutorial For Beginners - [2020]

Specifying button type — cmd

The cmd variable is always required in a FORM. Its value determines which PayPal Payments Standard checkout experience you are using to obtain payment.

Allowable Values for the cmd HTML Variable
Value of cmdDescription
_xclick The button that the person clicked was a Buy Now button.
_cart For shopping cart purchases. The following variables specify the kind of shopping cart button that the person clicked:
  • add — Add to Cart buttons for the PayPal Shopping Cart
  • display — View Cart buttons for the PayPal Shopping Cart
  • upload — The Cart Upload command for third-party carts
_xclick-subscriptions The button that the person clicked was a Subscribe button.
_xclick-auto-billing The button that the person clicked was an Automatic Billing button.
_donations The button that the person clicked was a Donate button.
_s-xclick 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.

Variations on basic variables

This section highlights a few ways to use PayPal Payments Standard FORM variables.

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:

  • custom
  • item_number oritem_number_x
  • invoice

Setting the character set — charset

Use the 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

:::list--columns list--columns--third

(Video) Website Payments Standard - Getting Started

  • Big5 (Traditional Chinese in Taiwan)
  • EUC-JP
  • EUC-KR
  • EUC-TW
  • gb2312 (Simplified Chinese)
  • gbk
  • HZ-GB-2312 (Traditional Chinese in Hong Kong)
  • ibm-862 (Hebrew with European characters)
  • ISO-2022-CN
  • ISO-2022-JP
  • ISO-2022-KR
  • ISO-8859-1 (Western European Languages)
  • ISO-8859-2
  • ISO-8859-3
  • ISO-8859-4
  • ISO-8859-5
  • ISO-8859-6
  • ISO-8859-7
  • ISO-8859-8
  • ISO-8859-9
  • ISO-8859-13
  • ISO-8859-15
  • KOI8-R (Cyrillic)
  • Shift_JIS
  • UTF-7
  • UTF-8
  • UTF-16
  • UTF-16BE
  • UTF-16LE
  • UTF16_PlatformEndian
  • UTF16_OppositeEndian
  • UTF-32
  • UTF-32BE
  • UTF-32LE
  • UTF32_PlatformEndian
  • UTF32_OppositeEndian
  • US-ASCII
  • windows-1250
  • windows-1251
  • windows-1252
  • windows-1253
  • windows-1254
  • windows-1255
  • windows-1256
  • windows-1257
  • windows-1258
  • windows-874 (Thai)
  • windows-949 (Korean)
  • x-mac-greek
  • x-mac-centraleurroman
  • x-mac-cyrillic
  • ebcdic-cp-us
  • ibm-1047

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 FORM:

<INPUT TYPE="hidden" NAME="return" value="URLspecificToThisTransaction">

Desired currency on individual transactions

Use the 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_code variable 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_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.

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.

(Video) How To Accept Payments With PayPal

Billing Information Page without Buyer Information Filled Out Automatically

HTML Form Basics for PayPal Payments Standard (1)

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

HTML Form Basics for PayPal Payments Standard (2)

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.

(Video) How To Create A PayPal Button To Accepts Payments Online

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="seller@designerfotos.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="jdoe@zyzzyu.com"> <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="seller@designerfotos.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

  1. Someone pays you.

  2. PayPal POSTs FORM variables to a URL you specify that runs a program to process the variables.

  3. You validate the notification.

    (Video) How to Create a PayPal Smart Button (PayPal Checkout Button)

    Figure 3. How IPN Works — General Steps

    HTML Form Basics for PayPal Payments Standard (3)

Detailed description of each step:

  1. 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.
  2. PayPal posts HTML FORM variables to a program at a URL you specify. You can specify this URL either in your account profile or with the notify_url variable 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.
  3. Your server must then validate the notification to ensure that it is legitimate. For details, see the Instant Payment Notification Guide.

FAQs

How do I make a payment form on PayPal? ›

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? ›

Simple Method: How To Put a PayPal Button On Any Website
  1. Go to paypal.com/buttons and choose an appropriate button (Buy Now, Add To Cart, Subscribe, etc)
  2. Follow the prompts to create a custom button in PayPal.
  3. When you're finished creating the button, copy the HTML code that PayPal provides.
Nov 18, 2021

What basic features are included with PayPal payments standard select all that apply *? ›

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? ›

Integration steps
  1. Optional. Design an optimal checkout flow.
  2. Required. Choose the right payment button based on your business requirements.
  3. Required. Create a payment button using PayPal's website.
  4. Required. Test your payment button integration.
  5. Optional. Set up payment notifications.

How do I add a payment option to my website? ›

How to Accept Payments Online: 7 Methods
  1. Accept credit and debit cards.
  2. Add a payment gateway.
  3. Set up a Direct Debit.
  4. Use eChecks.
  5. Integrate mobile wallet payments.
  6. Send click-to-pay invoices.
  7. Install recurring billing software.
Apr 26, 2022

What is the difference between PayPal checkout and PayPal standard? ›

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.

What are the benefits of using PayPal standard? ›

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? ›

Get PayPal API credentials
  1. When you've created a business account, go to the PayPal Developer page and log in to the dashboard.
  2. 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”
  3. Enter an app name and click “Create” once again.
Mar 19, 2020

How much does it cost to have PayPal on your website? ›

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? ›

Jotform integrates with PayPal. One of them is the PayPal Payments Standard, a.k.a PayPal Personal.
...
Adding and Setting up PayPal Personal
  1. In the Form Builder, click the Add Form Element button.
  2. Go to the Payments tab.
  3. Search and click PayPal Personal from the list. You can also drag and drop it to add.
Jun 26, 2022

Videos

1. Web Design Tips — Setting up PayPal WebSite Payments Standard
(logiforms)
2. PayPal Website Payments Standard
(PayPal Canada)
3. PayPal Integration for HTML Website Tutorial
(My Digital Saga)
4. Create a registration form that allows people to pay via PayPal in minutes
(FormSmarts)
5. Paypal Payments PHP Integration
(Vicode Media)
6. PayPal Checkout Integration in Javascript Example
(Code Java)
Top Articles
Latest Posts
Article information

Author: Jeremiah Abshire

Last Updated: 12/07/2022

Views: 6245

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Jeremiah Abshire

Birthday: 1993-09-14

Address: Apt. 425 92748 Jannie Centers, Port Nikitaville, VT 82110

Phone: +8096210939894

Job: Lead Healthcare Manager

Hobby: Watching movies, Watching movies, Knapping, LARPing, Coffee roasting, Lacemaking, Gaming

Introduction: My name is Jeremiah Abshire, I am a outstanding, kind, clever, hilarious, curious, hilarious, outstanding person who loves writing and wants to share my knowledge and understanding with you.