Skip to main content
With the $wsPayPalCheckout module, you can use PayPal payment data dynamically in the frontend. It supports various payment methods such as PayPal Express Checkout, Google Pay, and Apple Pay. In this section, you learn how to query the payment status and use the payment data for the integration.

Module overview

Example / excerpt of $wsPayPalCheckout
JSON output
Note: ƒ() denotes a function. Variables and methods overview

Templates

The $wsPayPalCheckout module is typically used in the checkout area, in particular on the payment page and the order confirmation. The PayPal buttons can also be embedded on product pages or in the basket for express checkout.

Variables

$wsPayPalCheckout.integrationDate

Outputs the integration date of the PayPal connection.

$wsPayPalCheckout.status

Outputs the status of the PayPal payment (empty if no payment process is active).

$wsPayPalCheckout.paymentCanceled

Outputs true if the customer has canceled the payment.

$wsPayPalCheckout.paymentFailed

Outputs true if a technical error occurred during the payment.

$wsPayPalCheckout.paymentDeclined

Outputs true if the payment was declined by PayPal or the bank.

$wsPayPalCheckout.expressCheckout

Indicates whether PayPal Express Checkout is possible.

$wsPayPalCheckout.expressCheckoutGooglePay

Indicates whether Google Pay Express is possible.

$wsPayPalCheckout.expressCheckoutApplePay

Indicates whether Apple Pay Express is possible.

$wsPayPalCheckout.googlePay

Outputs a map with Google Pay-specific content.

$wsPayPalCheckout.applePay

Outputs a map with Apple Pay-specific data.

Methods

$wsPayPalCheckout.loadData()

Loads all payment data for PayPal Checkout. Returns null if no active payment process exists. Signature
$wsPayPalCheckout.loadData(expressCheckout)
Returns
Map - map with payment data or null.
Parameters Example that loads the payment data.
When using the $wsPayPalCheckout.loadData() function, various variables are available to retrieve and output payment data. Below is an overview of which variables are available.

Payment data (return value of $wsPayPalCheckout.loadData())

First, it is necessary to assign the map with the payment data, as shown in the example above, to a local variable. This can then be used at various places in the template. JSON output of the variables
Variables overview General properties: Properties of Google Pay and Apple Pay Google Pay: Apple Pay:

$wsPayPalCheckout.loadConfigData()

Loads the configuration data of the PayPal Checkout SDK parameters such as client ID, language code, and mode. This method is the counterpart to loadData() for pages outside the order process, for example a page in the customer account where the customer links their account with the payment provider.
There are two differences to loadData():
  1. The returned object contains less information because the order-related values approvalUrl, cancelUrl, errorUrl, expressApprovalUrl, and orderId are missing.
  2. It is not checked whether a PayPal payment method is selected in the checkout or whether there are products in the basket. Therefore, loadConfigData() never returns null, whereas loadData() returns null outside of an active payment process.
Signature
$wsPayPalCheckout.loadConfigData(paymentId)
Returns
Map - map with the configuration data. Never null.
Parameters Example that loads the configuration data for the integration of the PayPal SDK.
When using the $wsPayPalCheckout.loadConfigData() function, various variables are available to retrieve and output the configuration data. Below is an overview of which variables are available.

Configuration data (return value of $wsPayPalCheckout.loadConfigData())

First, it is necessary to assign the map with the configuration data, as shown in the example above, to a local variable. This can then be used at various places in the template. JSON output
Variables overview
getClientToken() always determines the token for the payment method selected in the checkout, regardless of which paymentId was passed to loadConfigData().

Actions

There are no actions available for $wsPayPalCheckout.