# Buy Now: Sample HTML button code (/archive/paypal-payments-standard/integration-guide/html-example-buy-now)



> **Warning:** This product is [deprecated](/archive/product-lifecycle) and should not be used for new integrations. Use [Payment Links and Buttons](/payment-links-buttons/overview) instead. For information about migrating, visit the [Upgrade Hub](https://developer.paypal.com/upgrade/wps/guide/).

These code samples show how to configure PayPal-hosted Buy Now buttons:

* [A basic Buy Now button](#a-basic-buy-now-button)
* [Buy Now with product options](#buy-now-with-product-options)
* [Buy Now that prompts for quantities](#buy-now-button-that-prompts-for-quantities)
* [Buy Now with discounts](#buy-now-button-with-discounts)

> **Note:** **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.

## A basic Buy Now button [#a-basic-buy-now-button]

This code sample configures a basic Buy Now button with these features:

* "Hot Sauce-12 oz. Bottle" item.
* $5.95 USD price.
* PayPal calculates tax and shipping based on rates that you set up in your         PayPal account.

<div className="pl-[1.625rem]" />

```html lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers will purchase. --> <input type="hidden" name="item_name" value="Hot Sauce-12oz. Bottle"> <input type="hidden" name="amount" value="5.95"> <input type="hidden" name="currency_code" value="USD"> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
```

## Buy Now with product options [#buy-now-with-product-options]

This code sample configures a basic Buy Now button with an option menu named
"Type of umbrella."

```text lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers will purchase. --> <input type="hidden" name="item_name" value="Premium Umbrella"> <input type="hidden" name="amount" value="50.00"> <input type="hidden" name="currency_code" value="USD"> <!-- Provide a drop-down menu option field. --> <input type="hidden" name="on0" value="Type">Type of umbrella <br /> <select name="os0"> <option value="Select Type">-- Select Type --</option> <option value="Standard">Standard</option> <option value="Collapsable">Collapsable</option> </select> <br /> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
```

This sample code displays this image on your web page:

This sample code displays this image on your web page:<img src="https://paypalobjects.com/ppdevdocs/img/docs/buttons/img-docs-product-dropdown.svg" />

## Buy Now button with product options with prices [#buy-now-button-with-product-options-with-prices]

This code sample configures a basic Buy Now button with a drop-down menu of
product options. Each option has its own price.

This code sample configures a basic Buy Now button with a drop-down menu of
product options. Each option has its own price.

* The drop-down menu displays the prices for each option. Buyers see the         prices they pay for each option.
* A list of hidden HTML variables repeats the prices for each option. PayPal         uses these prices to charge buyers for the options they choose.

Drop-down menus with option prices use the following variables:

* **`currency_code`**: Sets the currency for option prices.
* **`item_index`**: Identifies which drop-down menu of product option has prices.
* **`option_select`*&#x2A; and         &#x2A;*`option_amount`**: Repeats the prices for each option.

Paste this code onto your web page below an image or a text description of the
item.

<div className="pl-[1.625rem]" />

```html lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers will purchase. --> <input type="hidden" name="item_name" value="Design"> <input type="hidden" name="currency_code" value="USD"> <!-- Provide a drop-down menu option field. --> <input type="hidden" name="on0" value="Type">Design<br /> <select name="os0"> <option value="Select a type">-- Select a type --</option> <option value="Standard">Striped</option> <option value="Collapsible">Solid</option> </select> <br /> <!-- Provide a drop-down menu option field with prices. --> <input type="hidden" name="on1" value="Design">Design <br /> <select name="os1"> <option value="Striped">Striped - $30.00 USD</option> <option value="Solid">Solid - $25.0 USD</option> <option value="Dots">Dots - $20.00 USD</option> </select> <br /> <!-- Specify the price that PayPal uses for each option. --> <input type="hidden" name="option_index" value="1"> <input type="hidden" name="option_select0" value="Striped"> <input type="hidden" name="option_amount0" value="30.00"> <input type="hidden" name="option_select1" value="Solid"> <input type="hidden" name="option_amount1" value="25.00"> <input type="hidden" name="option_select2" value="Dots"> <input type="hidden" name="option_amount2" value="20.00"> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif"> </form>
```

This sample code displays this image on your web page:

This sample code displays this image on your web page:<img src="https://paypalobjects.com/ppdevdocs/img/docs/buttons/img-docs-product-options-prices.svg" />

### Buy Now button with product options as a text box [#buy-now-button-with-product-options-as-a-text-box]

This code sample configures a basic Buy Now button with a text box for
entering product options.

<div className="pl-[1.625rem]" />

```html lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers will purchase. --> <input type="hidden" name="item_name" value="Hot Sauce-12 oz. Bottle"> <input type="hidden" name="amount" value="5.95"> <input type="hidden" name="currency_code" value="USD"> <!-- Provide the buyer with a text box option field. --> <input type="hidden" name="on0" value="strong>Size">Enter your size (S, M, L, X, XX) <br /> <input type="text" name="os0" maxlength="60"> <br /> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
```

This sample code displays this image on your web page:

This sample code displays this image on your web page:<img src="https://paypalobjects.com/ppdevdocs/img/docs/buttons/img-docs-product-options.svg" />

## Buy Now button that prompts for quantities [#buy-now-button-that-prompts-for-quantities]

This sample code configures a basic Buy Now button that prompts buyers to
specify item quantities. Use this option carefully because buyers might
request more items than you have in your inventory. To avoid this issue,
[set up inventory tracking](/archive/paypal-payments-standard/integration-guide/step-2).

This sample code configures a basic Buy Now button that prompts buyers to
specify item quantities. Use this option carefully because buyers might
request more items than you have in your inventory. To avoid this issue,

<div className="pl-[1.625rem]" />

```html lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers will purchase. --> <input type="hidden" name="item_name" value="Premium Umbrella"> <input type="hidden" name="amount" value="50.00"> <input type="hidden" name="currency_code" value="USD"> <!-- Prompt buyers to enter the quantities they want. --> <input type="hidden" name="undefined_quantity" value="1"> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
```

This sample code displays a similar image during checkout:

This sample code displays a similar image during checkout:<img src="https://www.paypalobjects.com/ppdevdocs/img/docs/buttons/img-docs-item-quantities.svg" />

## Buy Now button with discounts [#buy-now-button-with-discounts]

* [A flat discount amount](#a-flat-discount-amount)
* [Multiple discount amounts](#multiple-discount-amounts)
* [Discount percentages](#discount-percentages)
* [Buy one, get one free discount](#buy-one-get-one-free-discount)

### A flat discount amount [#a-flat-discount-amount]

This sample code configures a basic Buy Now button that:

* Provides a $2.00 discount on the entire order.
* Prompts buyers to also specify item quantities. Use this option carefully         because buyers might request more items than you have in your inventory. To         avoid this issue,         [set up inventory tracking](/archive/paypal-payments-standard/integration-guide/step-2).

Paste this code onto your web page below an image or a text description of the
item.

<div className="pl-[1.625rem]" />

```html lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers purchase. --> <input type="hidden" name="item_name" value="Hot Sauce-12 oz. Bottle"> <input type="hidden" name="amount" value="5.95"> <input type="hidden" name="currency_code" value="USD"> <!-- Specify the discount amounts that apply to the order. --> <input type="hidden" name="discount_amount" value="2.00"> <!-- Prompt buyers to enter the quantities they want. --> <input type="hidden" name="undefined_quantity" value="1"> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
```

### Multiple discount amounts [#multiple-discount-amounts]

This sample code configures a basic Buy Now button that:

* Provides a $0.15 discount on the first item ordered.
* Provides a $0.20 discount on the next four items.
* Prompts buyers to specify item quantities. Use this option carefully because         buyers might request more items than you have in your inventory. To avoid         this issue,         [set up inventory tracking](/archive/paypal-payments-standard/integration-guide/step-2).

Paste this code onto your web page below an image or a text description of the
item.

<div className="pl-[1.625rem]" />

```html lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers will purchase. --> <input type="hidden" name="item_name" value="Hot Sauce-12 oz. Bottle"> <input type="hidden" name="amount" value="5.95"> <input type="hidden" name="currency_code" value="USD"> <!-- Specify the discount amounts that apply to the item. --> <input type="hidden" name="discount_amount" value="0.15"> <input type="hidden" name="discount_amount2" value="0.20"> <input type="hidden" name="discount_num" value="4"> <!-- Prompt buyers to enter the quantities they want. --> <input type="hidden" name="undefined_quantity" value="1"> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
```

### Discount percentages [#discount-percentages]

This sample code configures a basic Buy Now button that:

* Provides a 5% discount on the first item ordered.
* Provides a 10% discount on the next four items.
* Prompts buyers to specify item quantities. Use this option carefully because         buyers might request more items than you have in your inventory. To avoid         this issue,         [set up inventory tracking](/archive/paypal-payments-standard/integration-guide/step-2).

Paste this code onto your web page below an image or a text description of the
item.

<div className="pl-[1.625rem]" />

```html lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers will purchase. --> <input type="hidden" name="item_name" value="Hot Sauce-12 oz. Bottle"> <input type="hidden" name="amount" value="5.95"> <input type="hidden" name="currency_code" value="USD"> <!-- Specify the discount percentages that apply to the item. --> <input type="hidden" name="discount_rate" value="5"> <input type="hidden" name="discount_rate2" value="10"> <input type="hidden" name="discount_num" value="4"> <!-- Prompt buyers to enter the quantities they want. --> <input type="hidden" name="undefined_quantity" value="1"> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
```

### Buy one, get one free discount [#buy-one-get-one-free-discount]

This sample code shows a basic Buy Now button that:

* Offers a "Buy one, get one free" discount. To receive the discount, the         buyer must purchase two of the item; the second one is free (100% discount).
* Prompts buyers to specify item quantities. Use this option carefully because         buyers might request more items than you have in your inventory. To avoid         this issue,         [set up inventory tracking](/archive/paypal-payments-standard/integration-guide/step-2).

If the buyer purchases only 1 unit of the item, it is the full price. If the
buyer purchases more than 2 units, the 2nd unit is free and any additional
units are full price.

If the buyer purchases only 1 unit of the item, it is the full price. If the
buyer purchases more than 2 units, the 2nd unit is free and any additional
units are full price.

<div className="pl-[1.625rem]" />

```html lineNumbers
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com"> <!-- Specify a Buy Now button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- Specify details about the item that buyers will purchase. --> <input type="hidden" name="item_name" value="Hot Sauce-12 oz. Bottle"> <input type="hidden" name="amount" value="5.95"> <input type="hidden" name="currency_code" value="USD"> <!-- Specify the discount percentages that apply to the item. --> <input type="hidden" name="discount_rate" value="0"> <input type="hidden" name="discount_rate2" value="100"> <input type="hidden" name="discount_num" value="1"> <!-- Prompt buyers to enter the quantities they want. --> <input type="hidden" name="undefined_quantity" value="1"> <!-- Display the payment button. --> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now"> <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
```

## See also [#see-also]

* [HTML reference](/archive/paypal-payments-standard/integration-guide/html-reference-landing)
* [Buy Now basic payment options](/archive/paypal-payments-standard/integration-guide/buy-now-step-1)
* [Customize advanced features](/archive/paypal-payments-standard/integration-guide/step-3)
* [Buy Now checkout experience](/archive/paypal-payments-standard/integration-guide/checkout-exp-buy-now)
