$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. This section explains how to query the payment status and how to use the payment data for the integration.
Module overview
Example / excerpt of$wsPayPalCheckout
ƒ() denotes a function.
Variables and methods at a glance
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
Returns the integration date of the PayPal connection.$wsPayPalCheckout.status
Returns the status of the PayPal payment (empty if no payment process is active).$wsPayPalCheckout.paymentCanceled
Returnstrue if the customer canceled the payment.
$wsPayPalCheckout.paymentFailed
Returnstrue if a technical error occurred during the payment.
$wsPayPalCheckout.paymentDeclined
Returnstrue if the payment was declined by PayPal or the bank.
$wsPayPalCheckout.expressCheckout
Indicates whether PayPal Express Checkout is possible (expressCheckoutAllow active and order value greater than 0).
$wsPayPalCheckout.expressCheckoutGooglePay
Indicates whether Google Pay Express is possible (expressCheckoutGooglePayAllow active and order value greater than 0).
$wsPayPalCheckout.expressCheckoutApplePay
Indicates whether Apple Pay Express is possible (expressCheckoutApplePayAllow active and order value greater than 0).
$wsPayPalCheckout.googlePay
Returns a map with Google Pay-specific content.$wsPayPalCheckout.applePay
Returns a map with Apple Pay-specific data.$wsPayPalCheckout.clientMetadataId
Returns the client metadata ID for the PayPal SDK integration (e.g. for thedata-client-metadata-id attribute when embedding the SDK script). The value corresponds to the first 32 characters of the session ID.
Methods
$wsPayPalCheckout.loadData()
Loads the payment data for the PayPal Checkout integration (SDK parameters, URLs, order ID). Returnsnull when no PayPal payment process is currently active — i.e. no PayPal Checkout payment method is selected or available.
Signature$wsPayPalCheckout.loadData(expressCheckout)
Return valueMap — map with payment data or null.
Parameters
Example that loads the payment data.
When you use the
$wsPayPalCheckout.loadData() function, various variables become available to retrieve and output payment data. Below is an overview of the available variables.Payment data (return value of $wsPayPalCheckout.loadData())
First, the map with the payment data — as shown in the example above — has to be assigned to a local variable. It can then be used at various places in the template.
JSON output of the variables
Actions
The PayPal Checkout plugin registers five actions. They are intended for the JavaScript integration of the PayPal SDK callbacks: they are invoked via POST (create the action as usual with$wsActions.create(...) and send wsact/wscsrf along) and — unlike classic form actions — respond directly with JSON.
The error texts of these actions (e.g.
requestEmpty for an empty payload) are controlled via the configuration nodes actions.updateApplePay and actions.updateGooglePay.Related links
- payment.payPalCheckout - PayPal Checkout configuration — sets up the PayPal integration (merchant ID, mode, express checkout).
- $wsCheckout — the checkout into which the PayPal payment is embedded (including
isPPCExpressCheckout,isExpressCheckoutLocked).
