## Hyvä Themes - PayPal Integration

This module enables the use of PayPal with Hyvä Checkout.  
The first release covers only basic functionality for PayPal Express, but still can be used in production and as an example for custom payment integrations.
For supported features, please check the [checkout integration tracker ticket](https://gitlab.hyva.io/hyva-public/checkout-integration-tracker/-/issues/1).

## Installation

Hyvä-Checkout license holders can install the PayPal integration by running

```sh
composer require hyva-themes/magento2-hyva-checkout-paypal
```

## Express shortcut buttons and the PayPal order review page

PayPal Express can be started in two ways, and they end in different places.

When the shopper picks PayPal **inside Hyvä Checkout**, they return to Hyvä Checkout after
authorizing, and the payment is completed there. The shipping and billing addresses stay as
entered in the checkout: the address on the shopper's PayPal account is not imported,
whatever the *Skip Order Review Step* setting.

When they use an **express shortcut button** (cart, mini cart or product page), they return
to PayPal's own order review page at `paypal/express/review`. This is deliberate: PayPal
Seller Protection only covers shipments to an address held by PayPal, so the shipping
address has to be confirmed rather than edited. Navigating to `/checkout` with such a
payment authorized sends the shopper back to the review page, and the addresses stay
read-only there as a second line of defense.

The review page is rendered by Magento's `Magento_Paypal` blocks, for which Hyvä provides no
templates. It therefore needs the **Luma Fallback module**, with these two routes registered
for fallback rendering:

```
paypal/express/review
paypal/express/saveShippingMethod
```

Without it, the page shows Hyvä's "You currently need the Luma Fallback module to render
the PayPal Express Review Page" placeholder. To disable the shortcut buttons entirely
instead, turn off *Display on Shopping Cart* / *Display on Product Details Page* under
**Stores → Configuration → Sales → Payment Methods → PayPal Express Checkout → Frontend
Experience Settings**.

## Known issues

Currently the integration only works if the payment step is after the shipping address is specified.  
Retrieving the shipping address from the PayPal account is not yet implemented.

Any issues can be found and/or reported through the [appropriate repository](https://gitlab.hyva.io/hyva-checkout/checkout-integrations/magento2-hyva-checkout-paypal/-/issues) issues section.

## Developer Documentation

* [Checkout Developer Documentation](https://docs.hyva.io/checkout/hyva-checkout/devdocs/index.html)

## Security Vulnerabilities

If you discover a security vulnerability within this module, please send an e-mail to
[info@hyva.io](mailto:info@hyva.io). All security vulnerabilities will be addressed promptly.

## License

Copyright © Hyvä Themes 2022-present. All rights reserved.  
This product is licensed per Magento install  
See [hyva.io/license](https://hyva.io/license)
