The PWA provides a component with the selector ish-payment-paypal that dynamically loads the PayPal SDK and renders the appropriate PayPal component based on the configured adapter type and page type.
It supports:
To use PayPal payment methods in the Intershop PWA, ensure that the following prerequisites are met:
The PayPal integration follows a modular architecture with clear separation of concerns:
src/app/core/utils/paypal/
├── adapters/
│ ├── paypal-buttons/ # PayPal Buttons adapter
│ ├── paypal-card-fields/ # PayPal Card Fields adapter
│ ├── paypal-messages/ # PayPal Pay Later Messages adapter
│ ├── paypal-adapters.builder.ts # Factory for creating adapters
│ └── paypal-adapters.styling.ts # Centralized styling configuration
├── paypal-config/
│ └── paypal-config.service.ts # SDK loading and configuration
├── paypal-data-transfer/
│ └── paypal-data-transfer.service.ts # Data communication service
└── paypal-model/
└── paypal.model.ts # PayPal SDK interfaces
| Component | Location | Purpose |
|---|---|---|
PaymentPaypalComponent |
src/app/shared/components/payment/payment-paypal/ |
Main Angular component for rendering PayPal elements |
PaypalAdaptersBuilder |
src/app/core/utils/paypal/adapters/ |
Factory service that creates appropriate PayPal SDK adapters |
PaypalConfigService |
src/app/core/utils/paypal/paypal-config/ |
Handles SDK script loading and URL construction |
PaypalCardFieldsAdapter |
src/app/core/utils/paypal/adapters/paypal-card-fields/ |
Representation of the PayPal SDK Card Fields object, responsible for rendering PayPal card fields and handling the associated callbacks |
PaypalButtonsAdapter |
src/app/core/utils/paypal/adapters/paypal-buttons/ |
Representation of the PayPal SDK Buttons object, responsible for rendering PayPal buttons and handling the associated callbacks |
PaypalMessagesAdapter |
src/app/core/utils/paypal/adapters/paypal-messages/ |
Representation of the PayPal SDK Messages object, responsible for rendering PayPal Pay Later messages |
The ish-payment-paypal component supports three different adapter types:
This adapter type is used to display PayPal checkout buttons for both standard and express payments.
The rendering is performed by the PayPalButtonsAdapter.
This component also provides the callback methods that are required by the PayPal JavaScript SDK Buttons API.
To use the ish-payment-paypal component with the Buttons adapter type, the adapterType input must be set to Buttons.
Additionally, the pageType is required to apply the appropriate SDK styling options.
It is also necessary to specify the selectedPaymentMethod so that the component can load the correct SDK for PayPal Buttons.
The following example shows how to integrate ish-payment-paypal for the corresponding adapter type Buttons into any component:
<ish-payment-paypal [selectedPaymentMethod]="paypalPaymentMethod" [adapterType]="'Buttons'" [pageType]="'cart'" />This adapter type is used to display Pay Later messaging on various pages (home, category, product details, cart, checkout) based on the configuration in Intershop Commerce Management.
The rendering is performed by the PaypalMessagesAdapter.
It is not necessary to set the adapterType input for messages, as it is the default type when no adapterType is provided.
However, the pageType input is required to apply the appropriate SDK styling options and to determine the visibility of Pay Later messages based on the configuration in Intershop Commerce Management.
The following example shows how to integrate ish-payment-paypal for the corresponding adapter type Messages into any component:
<ish-payment-paypal [pageType]="'home'" />This adapter type is used to provide card input fields for direct credit/debit card payments (Advanced Card Payments).
The rendering is performed by the PaypalCardFieldsAdapter.
This component also provides input validation, error handling, and the callback methods that are required by the PayPal JavaScript SDK Buttons API.
The following example shows how to integrate ish-payment-paypal for the corresponding adapter type CardFields into any component:
<ish-payment-paypal [selectedPaymentMethod]="paymentMethod" [adapterType]="'CardFields'" [pageType]="'checkout'" />The page type is required for various processes:
data-page-type.This section explains how to style PayPal components in the Intershop PWA using the styling options provided by the PayPal JavaScript SDK.
All styling configurations are located in paypal-adapters.styling.ts.
The styling of PayPal messages depends on the page type.
// This example shows the Pay Later messages styling for the component with pageType `home`.
export const PAYPAL_MESSAGE_STYLING = {
home: { layout: 'flex', color: 'white-no-border', ratio: '20x1' },
...
};Depending on the configured adapter type, the PayPal integration dynamically loads the appropriate SDK instance with the necessary parameters (e.g., client-id, merchant-id, currency, locale, intent) via the PaypalConfigService.
Since the PayPal SDK URL parameters can differ for each payment method, the script URL is loaded with a unique namespace to avoid conflicts when multiple instances are required.
The namespace format is PPCP_<payment_method_id> for Buttons and Card Fields, and PPCP_MESSAGES for Pay Later Messages.
// Namespace format: PPCP_<payment_method_id> or PPCP_MESSAGES
const paypalObject = window['PPCP_FAST_CHECKOUT'];Loading is handled by the PaypalConfigService, which constructs the SDK URL with necessary parameters, and uses the ScriptLoaderService to load the script dynamically.
The ScriptLoaderService is a core utility service for dynamically loading external JavaScript files into the DOM.
It provides the following features:
data-namespace attributes as cache keys to handle scripts with dynamic URLs (e.g., PayPal SDK URLs that change with locale/currency)type, integrity, crossorigin, and custom data attributesObservable<ScriptType> for tracking load statusThe visibility of Pay Later messages or Pay Later buttons is controlled by the settings of the PayPal Common Configuration Service in Intershop Commerce Management.
The PayPal configuration is retrieved from Intershop Commerce Management via the configurations endpoint.
The following example shows how to integrate the PayPal component on the product detail page to display Pay Later messages if Intershop Commerce Management settings are to be taken into account:
<ng-container *ngIf="'payment.paypal.payLaterPreferences.PayLaterMessagingProductDetailsEnabled' | ishServerSetting">
<ish-payment-paypal [pageType]="'product-details'" />
</ng-container>The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Website, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.