Getting started
How PayPal Checkout works
Integrate PayPal Checkout to give your customers payment buttons for PayPal, Venmo, debit, and credit cards.
PayPal's JavaScript SDK supports how you want to accept payments on your website. Our SDK handles displaying the buttons for PayPal and other payment methods, so your customers can pay with whatever method they choose. They can also use a pre-built form to pay directly using credit or debit.
Checkout
PayPal Checkout helps you get set up quickly to accept PayPal and other payment methods. With expanded checkout you can customize the checkout to match your site's branding.
Integrating the Checkout client
The JavaScript payload shows up in the global window object under the paypal namespace, so you can access it anywhere in your app to render any component in the JavaScript SDK.
The
<script>tag fetches the PayPal SDK when your checkout page renders.When your customer clicks on a PayPal button, the
createOrdercallback tells your server to initiate an order with PayPal's server.PayPal server sends the Order ID to your server, which then relays it to the SDK's
createOrdercallback, prompting the SDK to launch the checkout window for the Order ID.The customer logs in using PayPal credentials and uses the order review page to verify order details and check out.
The
onApprovecallback launches after payment is confirmed.You can use the response to verify the payment was completed or catch any errors about their payment method.
The PayPal buttons component shows up on your website based on the configuration you set in the JavaScript SDK. Your buyer can choose how to check out based on the eligible payment methods. A buyer following the PayPal Checkout flow sees the PayPal, Venmo, and Debit or Credit Card buttons.
When your buyer selects a payment method:
A pop-up shows up on the buyer's screen.
If the buyer is logged into their PayPal account, the pop-up includes details about their order.
This screen shows the buyer's default shipping address and the default shipping option you selected in the initial Orders API call.
The buyer can choose a different shipping address and payment method.
The buyer confirms that all the information is correct.
The buyer selects Complete Purchase to authorize the payment.
The order goes to PayPal's servers, where we process the payment.
Set up your development environment
Build the server
This sample Node.js integration uses the npm package manager. Enter:
to run the sample application. For more information, visit npm's documentation.
Install dependencies
Set up your integration by running:
to install the following 4 libraries at the same time:
@paypal/[email protected]– The PayPal Server SDK provides integration access to the PayPal REST APIsdotenv– separates your configuration and code by loading environment variables from a.envfile intoprocess.envexpress– is a Node.js web application framework that supports web and mobile applicationsbody-parser– is used to parse incoming request bodies in a middleware before your handlers
This sample integration uses PayPal's Server SDK v1.0.0. For more details, visit the PayPal Server SDK documentation (login required).
Verify package.json
package.jsonThe following code sample shows a package.json file for a PayPal integration. Replace YOUR-SERVER-NAME.js with the name of your server file in main and start on lines 5 and 8:
If you're having trouble with your app, reinstall your local library and package files using npm install. If you're getting the following node error, include "type": "module" in your package.json file. This line isn't automatically added when package.json is created.
Warning: To load an ES module, set "type": "module" in the package.json file or use the .mjs extension. Use node --trace-warnings ... to show where the warning was created. See line 5 of the sample package.json file for an example.
Set up environment variables
Update your operating system's local working environment variables to pass your app's client ID and client secret securely. The following examples show how to set up these environment variables in PowerShell on Windows, as well as the Linux and MacOS operating systems:
Windows (PowerShell):
Linux / MacOS:
Build the server
The sample Java integration uses the Maven package manager.
Run mvn clean install to build the server. Enter mvn spring-boot:run to start the sample application. For more information, visit Java's documentation.
Install dependencies
This sample integration uses PayPal's Server SDK v1.0.0. For more details, visit the PayPal Server SDK documentation by logging in to your account.
Build the server
This sample PHP integration uses the Homebrew package manager and Composer.
To install composer on macOS, run the command brew install composer. For Windows users, Composer can be downloaded from their website.
Use composer start to run the sample application. For more details, visit composer's documentation.
Install dependencies
Run composer install to add the dependencies you need to set up your PHP integration.
This sample integration uses PayPal's Server SDK v1.0.0. For more details, visit the PayPal Server SDK documentation by logging in to your account.
Install dependencies
Run pip install -r requirements.txt to add the dependencies you need to set up your Python integration.
This sample integration uses PayPal's Server SDK v1.0.0. For more details, visit the PayPal Server SDK documentation by logging in to your account.
Install dependencies
Run bundle install to add the dependencies you need to set up your Ruby integration.
This sample integration uses PayPal's Server SDK v1.0.0. For more details, visit the PayPal Server SDK documentation by logging in to your account.
Build the server
This sample .NET integration uses the dotnet package manager.
Run dotnet restore to build the server. Enter dotnet run to start the sample application. For more information, visit .NET's documentation.
Install dependencies
This sample integration uses PayPal's Server SDK v1.0.0. For more details, visit the PayPal Server SDK documentation by logging in to your account.
View your client ID and client secret in the PayPal Developer Dashboard under Apps & Credentials.
Last updated
Was this helpful?




