Introduction

Use the Button Manager API to create and manage buttons when you are creating more than just a few PayPal Payments Standard buttons or when you manage buttons for others. For example, you should use the Button Manager API if you provide a shopping cart for merchants.

The Button Manager API enables you to manage PayPal Payments Standard buttons programmatically in the same way that you can manage them from the My Saved Buttons page on paypal.com.

Note: The My Saved Buttons page can be accessed by clicking Tools at the top of the page, then selecting the PayPal Buttons item on the Tools page. If you do not see Tools at the top of the page, Click Merchant Services and then select Create payment buttons for your website under the Features you can use right now heading.

You can use this API to create the following PayPal Payments Standard and Website Payments Pro Hosted Solution buttons:

Buy Now

Add to Cart and View Cart

Donate

Subscribe and Unsubscribe

Pay Now (Website Payments Pro Hosted Solution only)

Important: Website Payments Pro is currently available in the UK only. PayPal continues to support merchants with existing integrations outside the UK. New integrations outside the UK must use PayPal Payments Pro, the replacement for Website Payments Pro.

Installment Plan

Automatic Billing

Generated button code

When you create a button, PayPal responds by generating code that you can paste into your web page or document.

The generated HTML code includes:

HTML code for including the button in web pages

URL link code for adding buttons to email and documents that support links

Note: Not all merchants in every country can use all the buttons that can be created. For example, German merchants cannot use Subscribe buttons even though they can be created through the API. If you can create the button for the specified country using the Create PayPal payment button page on www.paypal.com, your merchant can use the button.

The following example shows the PayPal code for displaying a hosted Add to Cart button to sell a wireless mouse:

Button hosting

The Button Manager API can create the following types of buttons:

Hosted buttons: These buttons are hosted by PayPal. The parameters associated with this type of button are secure. Hosted buttons provide the greatest flexibility because you can instruct PayPal to change them dynamically, and PayPal maintains information about their state, such as the inventory level associated with the button.

Note: You cannot use hosted buttons with Website Payments Hosted Solution; you should use token buttons instead.

Encrypted buttons: These buttons are not hosted by PayPal. The parameters associated with this type of button are encrypted. Encrypted buttons are similar to hosted buttons with regard to secure operation; however, you must update the web pages that use an encrypted button each time the button or its associated information changes, because that information is not hosted by PayPal. You should use an encrypted button only if a hosted button cannot be used.

Clear text buttons: These buttons are not hosted by PayPal. The parameters associated with this type of button are not encrypted. Clear text buttons are not hosted and are not encrypted. They can be used dynamically because you can change the value of a parameter "on the fly." However, if you use them, recognize the risk that sensitive information can be altered or stolen.

Token buttons: These buttons are not hosted by PayPal. They are only used with the Website Payments Pro Hosted Solutions product and the parameters associated with this type of button are secure. Token buttons are dynamic and initiate the Website Payments Pro Hosted Solution checkout flow. They have a lifetime of approximately 2 hours if not used.

Important: Website Payments Pro is currently available in the UK only. PayPal continues to support merchants with existing integrations outside the UK. New integrations outside the UK must use PayPal Payments Pro, the replacement for Website Payments Pro.

Hosted button manipulation

When you create a hosted button, the response includes an ID that allows you to manipulate the button using the Button Manager API. Do not confuse a hosted button with a button used as part of Website Payments Pro Hosted Solution, which is a product that supports token, encrypted, and clear text buttons.

With hosted buttons, you can:

Get a list of all hosted buttons, which enables you to identify buttons for further programmatic manipulation.

Get details about a hosted button, which enables you to identify the parameters and values associated with a button.

Update a hosted button, which enables you to change individual parameters, such as price, in a hosted button.

Manage hosted button status. Currently, you can only delete a button.

Get and set inventory information associated with the button.

Inventory management using hosted buttons

You can get or set the inventory level for the item associated with a hosted button. You can also track inventory on options within an item, such as color or size.

If you enable inventory management for a button, PayPal tracks inventory for you and also lets your buyer know if the item is sold out. You can specify inventory tracking on an item-by-item basis, and also by option, such as color or size, within the item.

An e-mail alerts you if inventory falls below the threshold you specify. If an item is sold out, you can specify whether or not to accept a payment anyway. Optionally, you can specify a URL where your buyer's browser is redirected if the item is sold out.

You can also enable profit and loss tracking for an item or option associated with a button. If you enable this feature, you must provide the cost of the item or option. PayPal then calculates your gross profit, which is the selling price of the item less the specified cost.

Inventory management for digital downloads

If you use hosted buttons, you can choose to specify a list of download keys, which are keys that you define and are associated with the item being sold. These keys are useful when you want to sell digital goods with a key to enable access.

To use this feature, you set the inventory for the button to include one or more download keys, up to a maximum of 1,000 keys. These keys are then available when you get the inventory for a button.

For example, when a customer orders software or music, you could obtain an unused key from the list of download keys and email it to your customer so they can download the item. You are responsible for choosing the appropriate key from the list and how it is used. PayPal only stores the inventory of keys and does not track how a specific key is used, although PayPal does provide options for making this process simpler.

When you specify the inventory for a button, you can specify the usage of download keys:

Whether the keys you specify should be appended to the current list of keys or whether the list of keys should be replaced, which enables you to replenish the list of keys or replace the list entirely.

Whether the list of keys are to be reused or not.

If you do not reuse keys, PayPal also notifies you when the item is sold out, which means that no more keys are available.

Specifying download keys with NVP

The following example shows how you might create several keys using the BMSetButtonInventory API operation:

Website Payments Pro Hosted Solution links

Important: Website Payments Pro is currently available in the UK only. PayPal continues to support merchants with existing integrations outside the UK. New integrations outside the UK must use PayPal Payments Pro, the replacement for Website Payments Pro.

Note: Although you can use the Button Manager API to create buttons that initiate the Website Payments Pro Hosted Solution checkout flow, do not confuse a button for Website Payments Pro Hosted Solution with hosted buttons that you also create with the Button Manager API.

You create the Website Payments Pro Hosted Solution checkout link dynamically when your buyer attempts to check out. For example, when your buyer clicks your check out button, you call the BMCreateButton API operation to create the link and then redirect the buyer's browser to PayPal using the link. The buyer then pays on the PayPal Website Payments Pro Hosted Solution page. After making the payment, PayPal returns the buyer to the page you specified when you created the link.

HTML variables control the presentation of the Website Payments Pro Hosted Solution pages, the information contained on the pages, and pages to which your customer can be returned to when leaving Website Payments Pro Hosted Solution pages. For an example of setting up HTML variables, see Checkout flow with Website Payments Pro Hosted Solution.