On this page
No Headings
Last updated: June 17, 2026
PayPal Fastlane is a streamlined checkout experience that allows returning customers to authenticate and pay quickly using saved payment methods and shipping addresses. New customers can also use it for a smooth guest checkout experience. For more information about Fastlane, see the PayPal Fastlane documentation.
This guide provides instructions for integrating PayPal Fastlane into your web application using the v6 web SDK.
/server/node/README.md.There also are requirements for the backend and your HTML.
Your backend must provide these API endpoints:
GET /paypal-api/auth/browser-safe-client-token{ "accessToken": "YOUR-CLIENT-TOKEN" }POST /paypal-api/checkout/orders/createContent-Type: application/json
PayPal-Request-Id: <unique-id>Your HTML must include these elements.
<!-- Email form -->
<form id="email-form">
<input type="email" id="email-input" />
<div id="watermark-container"></div>
<button id="email-submit-button">Submit</button>
</form>
<!-- Payment containers -->
<div id="card-container"></div>
<div id="payment-container"></div>
<!-- Shipping display -->
<div id="shipping-display-container" hidden></div>
<button id="change-shipping-button" hidden>Change Shipping Address</button>
<!-- Order submission -->
<button id="submit-button" hidden>Submit Order</button>
<!-- Card testing info -->
<p id="card-testing-info" hidden>
For more info on testing cards with PayPal, see
<a href="/sandbox-testing/card-testing/">
/sandbox-testing/card-testing/
</a>
</p>Fastlane integration consists of three main JavaScript files:
fastlaneSdkComponent.js: SDK initialization and client token managementfastlane.js: Main integration logic and UI handlingfastlane.css: Basic styling for the checkout experienceFor examples of these files, see this GitHub repo folder.
To complete the integration:
<script
async
onload="onPayPalLoaded()"
src="https://www.sandbox.paypal.com/web-sdk/v6/core"
></script>fastlaneSdkComponent.js).In this example, you see some Fastlane SDK options:
pageType: The applicable page type, such as product-detailsclientMetadataId: Unique session identifiercomponents: Array that includes fastlaneasync function onPayPalLoaded() {
const clientToken = await getBrowserSafeClientToken();
const sdkInstance = await window.paypal.createInstance({
clientToken,
pageType: "product-details",
clientMetadataId: crypto.randomUUID(),
components: ["fastlane"],
});
fastlane = await sdkInstance.createFastlane();
setupFastlaneSdk();
}fastlane.js).The email-lookup process determines whether a user is a Fastlane member.
async function setupFastlaneSdk() {
fastlane.setLocale("en_us");
// Render Fastlane watermark
const fastlaneWatermark = await fastlane.FastlaneWatermarkComponent({
includeAdditionalInfo: true,
});
fastlaneWatermark.render("#watermark-container");
// Handle email submission
const emailSubmitButton = document.getElementById("email-submit-button");
emailSubmitButton.addEventListener("click", async (e) => {
e.preventDefault();
const { customerContextId } = await fastlane.identity.lookupCustomerByEmail(
emailInput.value,
);
let shouldRenderFastlaneMemberExperience = false;
let profileData;
if (customerContextId) {
const response =
await fastlane.identity.triggerAuthenticationFlow(customerContextId);
if (response.authenticationState === "succeeded") {
shouldRenderFastlaneMemberExperience = true;
profileData = response.profileData;
}
}
// Route to appropriate experience
if (shouldRenderFastlaneMemberExperience) {
renderFastlaneMemberExperience(profileData);
} else {
renderFastlaneGuestExperience();
}
});
}fastlane.js).Members are authenticated Fastlane members who have saved data.
async function renderFastlaneMemberExperience(profileData) {
if (profileData.shippingAddress) {
setShippingAddressDisplay(profileData.shippingAddress);
// Allow address changes
const changeAddressButton = document.getElementById(
"change-shipping-button",
);
changeAddressButton.addEventListener("click", async () => {
const { selectedAddress, selectionChanged } =
await fastlane.profile.showShippingAddressSelector();
if (selectionChanged) {
profileData.shippingAddress = selectedAddress;
setShippingAddressDisplay(profileData.shippingAddress);
}
});
// Render payment component with shipping address
const fastlanePaymentComponent = await fastlane.FastlanePaymentComponent({
options: {},
shippingAddress: profileData.shippingAddress,
});
fastlanePaymentComponent.render("#payment-container");
}
}fastlane.js).Guests are new or unauthenticated users.
async function renderFastlaneGuestExperience() {
const cardTestingInfo = document.getElementById("card-testing-info");
cardTestingInfo.removeAttribute("hidden");
const FastlanePaymentComponent = await fastlane.FastlanePaymentComponent({});
await FastlanePaymentComponent.render("#card-container");
}fastlane.js).Payment processing includes generating a payment token and creating an order.
In this step, you see these payment component options:
options: Additional payment component configurationshippingAddress: Pre-populate with a member's saved address// Get payment token
const { id } = await fastlanePaymentComponent.getPaymentToken();
// Create order via backend API
async function createOrder(paymentToken) {
const response = await fetch("/paypal-api/checkout/orders/create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"PayPal-Request-Id": Date.now().toString(),
},
body: JSON.stringify({
paymentSource: {
card: {
singleUseToken: paymentToken,
},
},
purchaseUnits: [
{
amount: {
currencyCode: "USD",
value: "10.00",
breakdown: {
itemTotal: {
currencyCode: "USD",
value: "10.00",
},
},
},
},
],
intent: "CAPTURE",
}),
});
return await response.json();
}This integration includes basic error handling, including:
For testing, use PayPal's sandbox environment with sandbox credentials.
Test member and guest flows with card numbers.
To see the sample app, run these commands.
npm install
npm startThe sample app will run at http://localhost:3000/. The sample requires a backend server at http://localhost:8080.
Examine a full example of a Fastlane integration on GitHub.