Skip to content

paypaldev-community/getting-started-guide-buy-button

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started Guide: PayPal Buy Button

With PayPal's Buy Button accept payments without building your own payment workflow.

Open the code in the web IDE now using GitHub Codespaces... Open in GitHub Codespaces

Preview

PayPal Buy Button example

Explanation

Step 1

In your html <head> tag add the following: (this has your unique client-id).

<script src="https://www.paypal.com/sdk/js?client-id=BAAY5EAkskLsBGeYrYpHm9PzA-KkgOiOx1J0fwKCo_YkS3f81HiV-Ze9QzwmGHyf4S2cZjRtpTRc6pDekA&components=hosted-buttons&disable-funding=venmo&currency=USD"></script>

Important

This should be included only once per page.

Step 2

In your html <body> tag add the following:

<div id="paypal-container-ZGT7S2VPTE4D4"></div>
<script>
  paypal
    .HostedButtons({
      hostedButtonId: "ZGT7S2VPTE4D4",
    })
    .render("#paypal-container-ZGT7S2VPTE4D4");
</script>

Tip

You can create as many buttons as you need for different products or services. Just make sure to use the specific hostedButtonId for each button you create, which you can find in your PayPal dashboard under the details of each button you create.

How to create your PayPal Buy Button

Demo on how to create your PayPal Buy Button

About

PayPal Buy Button example with GitHub Codespaces 1-click deploy

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Contributors

Languages