Prerequisites
- PayPal sandbox account with appropriate credentials. For more information about using PayPal’s sandbox for testing, see the PayPal sandbox testing guide.
- Backend server for API proxy. For more information, see
/server/node/README.md
. - A web browser with ES6 support.
Backend endpoints
Your backend must provide these API endpoints:- The client token endpoint provides a client token for SDK initialization.
- URL:
GET /paypal-api/auth/browser-safe-client-token
- Response:
{ "accessToken": "YOUR-CLIENT-TOKEN" }
- URL:
- The order creation endpoint creates a PayPal order using the payment token.
- URL:
POST /paypal-api/checkout/orders/create
- Headers:
Content-Type: application/json
PayPal-Request-Id: <unique-id>
- URL:
HTML structure
Your HTML must include these elements.Integration
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 experience
- Include the PayPal SDK script in your HTML.
- Initialize the SDK and Fastlane (
fastlaneSdkComponent.js
).
pageType
: The applicable page type, such asproduct-details
clientMetadataId
: Unique session identifiercomponents
: Array that includesfastlane
- Set up the email-lookup flow (
fastlane.js
).
- Set up handling for members (
fastlane.js
).
- Set up handling for guests (
fastlane.js
).
- Set up payment processing (
fastlane.js
).
options
: Additional payment component configurationshippingAddress
: Pre-populate with a member’s saved address
Error handling
This integration includes basic error handling, including:- If a member’s authentication fails, they get the guest experience.
- Errors in order creation display user-friendly messages.
- The console logs error information to help with debugging.