Fastlane reference

DocsCurrent

Last updated: August 1st 2024, @ 11:53:55 pm

Troubleshoot, read our FAQs, follow best practices, and customize your integration.

Troubleshooting

FAQs

Best practices

Optimize your buyer experience, Fastlane member experience, integration, and styling.

Buyer experience

Make sure your buyers have the ideal Fastlane experience by following these best practices.

Present the branded PayPal button upstream

You must show the PayPal button upstream in the cart page or alongside the Fastlane email field to ensure consumers have the option to use their PayPal account.

Make email entry the first step

Because Fastlane accounts are looked up by email address, the email address field needs to be the first step of the checkout process. If a profile is found, Fastlane retrieves shipping and payment information for the Fastlane member. If the email comes later in the process, it makes a confusing experience.

Render the Fastlane watermark

Render the Fastlane watermark below any merchant-rendered fields for full consumer transparency. The watermark contains a link where a buyer can go to see the Fastlane terms of service.

Streamline the process

After a registered Fastlane member has been authenticated and the profile information is received, hide any of the member's other payment methods under a single link.

When a buyer enters the OTP, their intent is to use Fastlane. Any additional areas of the UI, such as other payment methods, should be available to give the buyer as many choices as possible. However, keeping the page simple and minimalistic helps the user focus on the transaction.

Member flow

After a Fastlane member authenticates, there are a few best practices that you should implement to further reduce friction during the process:

  • Put the user at the order review page, or your site's equivalent.
  • Ensure the least expensive shipping option is automatically selected.
  • Render a change button for the shipping address. That change button should call the showAddressSelector() method of the client SDK. This invokes the shipping address selector allowing the buyer to select from shipping addresses or add a new one.
  • Render a change button for the card being used for the purchase. That change button should call the showCardSelector() method of the client SDK. This invokes the card selector, allowing the buyer to select from other cards or add a new one to their profile.
  • For other use cases, such as adding a gift message, you can direct a return user to land on that specific page.

Integration

Optimize your integration by following these best practices.

Load the Fastlane SDK on your checkout page

Always make sure to load the Fastlane on the onload event of your checkout page. Attempting to load the SDK after a user interacts with the page may cause conversion issues.

Send shipping and billing addresses server-side

While this is always a best practice, it is particularly important in regards to Fastlane. In cases where the buyer adds a shipping address or a new card to their profile, the changes only apply once the token and address info is sent via /v2/checkout/orders.

Call the authentication flow every time the checkout page is refreshed

Call the triggerAuthenticationFlow() method every time the checkout page is reloaded. There is internal logic within our SDK that determines whether we require the buyer to authenticate via OTP again or restore the session. In either case, the method returns the authenticatedCustomerResult. This also includes a new single-use token.

Ensure that Fastlane members can update their stored credentials

Whether you're using our components or rendering a Fastlane profile information yourself, a change button is required.

You can render the ability to edit information in the way that best fits the look and feel of your site checkout. Have the onclick event call the profile.showShippingAddressSelector() or profile.showCardSelector() to launch the necessary modals.


Customize your integration

Use the following configuration parameters, profile method reference types, and style options to customize your Fastlane integration.

Configuration parameters

window.paypal.Fastlane(options);

1interface FastlaneOptions {
2 shippingAddressOptions: AddressOptions,
3 cardOptions: CardOptions,
4 styles: StyleOptions
5}
6/*
7 * To restrict the use of Fastlane to specific countries or regions, set
8 * allowedLocations to an array containing the countries or regions where Fastlane
9 * should be allowed.
10 *
11 * To allow all regions within a particular country, specify only the country's
12 * ISO 3166-1 alpha-2 country code.
13 *
14 * To allow only specific regions in a country, specify the country's
15 * ISO 3166-1 alpha-2 country code, followed by a colon (":"), followed by the
16 * name of the region.
17 *
18 * Examples:
19 * - [ "US" ] = Allow all regions within the United States
20 * - [ "US:CA", "US:AZ" ] = Allow in California in Arizona, but nowhere else
21 * - [ "US:CA", "US:AZ", "FR" ] = Allow in California, Arizona, and France,
22 * but nowhere else
23 */
24interface AddressOptions {
25 // default: empty array = all locations allowed
26 allowedLocations: [AddressLocationEnum];
27}
28Enum AddressLocationEnum {
29 {
30 ISO - country - code
31 } {
32 ISO - country - code
33 }: {
34 ISO - region - code
35 }
36}
37interface CardOptions {
38 // default: empty array = all brands allowed
39 allowedBrands: [CardBrandEnum];
40}
41Enum CardBrandEnum {
42 VISA
43 MASTERCARD
44 AMEX
45 DINERS
46 DISCOVER
47 JCB
48 CHINA_UNION_PAY
49 MAESTRO
50 ELO
51 MIR
52 HIPER
53 HIPERCARD
54}
1type create = (options: FastlaneOptions) => Fastlane;

Fastlane namespace

1interface Fastlane {
2 identity {
3 lookupCustomerByEmail: (email: string) => LookupCustomerResult,
4 triggerAuthenticationFlow: (customerContextId: string, options: AuthenticationFlowOptions) => AuthenticatedCustomerResult
5 }
6 profile {
7 showShippingAddressSelector: () => ShowShippingAddressSelectorResult,
8 showCardSelector: () => ShowCardSelectorResult,
9 }
10 setLocale: (locale: string) => void, // options: en_us, es_us, fr_us, zh_us
11 FastlaneCardComponent: (options: FastlaneCardComponentOptions) => FastlaneCardComponent,
12 FastlanePaymentComponent: (options: FastlanePaymentComponentOptions) => FastlanePaymentComponent,
13 FastlaneWatermarkComponent: (options: FastlaneWatermarkOptions) => FastlaneWatermarkComponent
14}
1interface LookupCustomerResult {
2 customerContextId: string
3}

FastlaneWatermarkComponent

1interface FastlaneWatermarkOptions {
2 includeAdditionalInfo: boolean
3}
4interface FastlaneWatermarkComponent {
5 render: (container) => null
6}

AuthenticatedCustomerResult

The AuthenticatedCustomerResult object type is returned from the identity.triggerAuthenticationFlow() call.

1interface AuthenticatedCustomerResult {
2 authenticationState: 'succeeded' | 'failed' | 'canceled' | 'not_found';
3 profileData: ProfileData;
4}
5interface ProfileData {
6 name: Name;
7 shippingAddress: Shipping;
8 card: PaymentToken;
9}
10interface Name = {
11 firstName: string;
12 lastName: string;
13 fullName: string;
14};
15interface Phone = {
16 nationalNumber: string;
17 countryCode: string;
18};
19interface Address = {
20 addressLine1: string,
21 addressLine2: string,
22 adminArea1: string,
23 adminArea2: string;
24 postalCode: string,
25 countryCode: string
26 phone: Phone;
27};
28interface Shipping = {
29 name: Name;
30 address: Address;
31 companyName: string;
32}
33interface BillingAddress = Address;
34interface PaymentToken {
35 id: string; // This is the payment paymentToken
36 paymentSource: PaymentSource;
37}
38interface PaymentSource {
39 card: CardPaymentSource;
40}
41interface CardPaymentSource {
42 brand: string;
43 expiry: string; // "YYYY-MM"
44 lastDigits: string; // "1111"
45 name: string;
46 billingAddress: Address;
47}

Profile method reference types

1interface ShowShippingAddressSelectorResult {
2 selectionChanged: boolean;
3 selectedAddress: Address;
4}
5interface ShowCardSelectorResult {
6 selectionChanged: boolean;
7 selectedCard: PaymentToken;
8}

FastlaneCardComponent

The FastlaneCardComponent uses hosted card fields. The resulting interface is a subset of the card fields interface.

The instance of a FastlaneCardComponent can be created using:

1const fastlaneCardComponent = await fastlane.FastlaneCardComponent({
2 ...
3})
4fastlaneCardComponent.render("#card-container")
1type FastlaneCardComponent = (options: FastlaneCardComponentOptions) => FastlaneCardComponent;
2interface FastlaneCardComponent {
3 render: (container) => FastlaneCardComponent;
4 getPaymentToken: async (options: PaymentTokenOptions) => PaymentToken;
5}
6interface FastlaneCardComponentOptions {
7 styles: StyleOptions;
8 fields: {
9 Field
10 };
11}
12interface Field {
13 placeholder: string;
14 prefill: string;
15 enabled: boolean;
16}
17interface PaymentTokenOptions {
18 billingAddress: Address;
19 cardholderName: Name;
20}

Card field configurations

You can configure the card fields in the FastlaneCardComponent or FastlanePaymentComponent when initializing the components:

1const styles: {};
2const fields: {
3 number: {
4 placeholder: "Number",
5 },
6 phoneNumber: {
7 prefill: "555-555-5555"
8 }
9}
10}
11
12fastlane.FastlaneCardComponent({
13 styles,
14 fields
15}).render(elem);
16fastlane.FastlanePaymentComponent({
17 styles,
18 fields
19}).render(elem);

You can prefill both  FastlaneCardComponent and FastlanePaymentComponent.

Style options and guidelines

Colors can be any value that CSS allows in hex values, RGB, RGBA, and color names.

1interface StyleOptions {
2 root: {
3 backgroundColor: string,
4 errorColor: string,
5 fontFamily: string,
6 textColorBase: string,
7 fontSizeBase: string,
8 padding: string,
9 primaryColor: string,
10 },
11 input: {
12 backgroundColor: string,
13 borderRadius: string,
14 borderColor: string,
15 borderWidth: string,
16 textColorBase: string,
17 focusBorderColor: string,
18 },
19}

Design guidance

When styling the Fastlane components to match the look and feel of your checkout page, here are some guidelines to provide an accessible and transparent experience to your payer:

  • Ensure that there is adequate contrast between the backgroundColor and textColor to ensure that all text, especially the legal text under the opt-in, is clear and legible. If the contrast ratio between the two is not 4.5:1, PayPal automatically sets the contrast to the default values in the following table.
  • Ensure there is adequate contrast between the borderColor, which drives the consent toggle coloring, and the backgroundColor.

Note: All Fastlane integrations must conform to WCAG levels A and AA. If the color of the legal text and toggle button are not distinguishable from the text and background, the Fastlane component colors are reverted to the default.

Payment component UI

Load card assets

Use the following image URLs to load card assets. These enable users to see the branded image of their card.

Related documentation: