$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
ƒ() 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
Outputstrue if the customer has canceled the payment.
$wsPayPalCheckout.paymentFailed
Outputstrue if a technical error occurred during the payment.
$wsPayPalCheckout.paymentDeclined
Outputstrue 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. Returnsnull if no active payment process exists.
Signature$wsPayPalCheckout.loadData(expressCheckout)
ReturnsMap - 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
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 toloadData() 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():- The returned object contains less information because the order-related values
approvalUrl,cancelUrl,errorUrl,expressApprovalUrl, andorderIdare missing. - 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 returnsnull, whereasloadData()returns null outside of an active payment process.
$wsPayPalCheckout.loadConfigData(paymentId)
ReturnsMap - 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 outputActions
There are no actions available for$wsPayPalCheckout.
