Integrating with the experimental PayPal JavaScript buttons is as easy as including a small snippet of code. To get started:
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>
Donate buttons are great for accepting donations from users Customize & Preview
<script src="paypal-button.min.js?merchant=YOUR_MERCHANT_ID"
data-button="donate"
data-name="My product"
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.
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.
Download this JavaScript file and add it to your site.
JavaScript Buttons
Basic support for PayPal's JavaScript buttons
In the generated button code, you can edit the path to the PayPal Button JavaScript file, if needed.
Copy and paste the HTML snippet you customized above, and you're ready to start selling!
In order to test your implementation before going live you can use our sandbox environment. Please check the Developer Portal for further information.
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.
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.
The JavaScript buttons have been tested and work in all modern browsers including: Chrome, Safari, Firefox and Internet Explorer 7+.
This project is hosted on Github. Feature requests and issues can be filed on the issue tracker.