PayPal payment buttons

Integrating with the experimental PayPal JavaScript buttons is as easy as including a small snippet of code. To get started:

  1. Customize your button
  2. Add the button to your site

Customize your button

  1. Click Customize & Preview to get a lightbox where you can customize your button code with your merchant ID, product name, price and other options.
  2. Click Preview in the lightbox to see a preview of your newly created button.
  3. Click on the button to test it out.

Buy Now buttons are perfect for single item purchases Customize & Preview

<script src="paypal-button.min.js?merchant=YOUR_MERCHANT_ID"
    data-button="buynow"
    data-name="My product"
    data-amount="1.00"
    async
></script>

Add To Cart buttons let users add multiple items instantly giving your website a cart Customize & Preview

<script src="paypal-button.min.js?merchant=YOUR_MERCHANT_ID"
    data-button="cart"
    data-name="Product in your cart"
    data-amount="1.00"
    async
></script>

Subscribe buttons can be used to set up payment subscriptions with your users Customize & Preview

<script src="paypal-button.min.js?merchant=YOUR_MERCHANT_ID"
    data-button="subscribe"
    data-name="My product"
    data-amount="1.00"
    data-recurrence="1"
    data-period="M"
    async
></script>

QR codes are ideal for allowing quick mobile payments Customize & Preview

<script src="paypal-button.min.js?merchant=YOUR_MERCHANT_ID"
    data-button="qr"
    data-name="Product via QR code"
    data-amount="1.00"
    data-size="250"
    async
></script>

Important: Unless you enable the sandbox environment, all payments made using this code will be live and not test payments.

Add the button to your site

  1. Get your Merchant ID or email address. You'll need to add it to the code above. If you're logged in to PayPal and have a business account, you can get your Merchant ID on your account profile page.

  2. Download this JavaScript file and add it to your site.

    In the generated button code, you can edit the path to the PayPal Button JavaScript file, if needed.

  3. Copy and paste the HTML snippet you customized above, and you're ready to start selling!

Environment

In order to test your implementation before going live you can use our sandbox environment. Please check the Developer Portal for further information.

Callback

On completion of a transaction you can get a payment notification (IPN) on a callback URL you specify using the callback attribute. An IPN simulator is available on the sandbox to help you test your integration.

Customization

For advanced needs, there's a JavaScript API that can be used to pragmatically create buttons, localization support, and the ability to create user-editable inputs. Find out how in the README file.

Browser support

The JavaScript buttons have been tested and work in all modern browsers including: Chrome, Safari, Firefox and Internet Explorer 7+.

Find out more

This project is hosted on Github. Feature requests and issues can be filed on the issue tracker.