[IMP] payment_providers/paypal: new PayPal version

task-3355211

closes odoo/documentation#11388

X-original-commit: 3a24e18b45
Signed-off-by: Audrey Vandromme (auva) <auva@odoo.com>
This commit is contained in:
Audrey (auva) 2024-11-13 10:38:54 +00:00
parent b29eae5102
commit 71b426177a

View File

@ -2,7 +2,7 @@
PayPal
======
`Paypal <https://www.paypal.com/>`_ is an American online payment provider available worldwide, and
`Paypal <https://www.paypal.com/>`_ is an American online payment provider available worldwide and
one of the few that does not charge a subscription fee.
.. note::
@ -10,112 +10,71 @@ one of the few that does not charge a subscription fee.
<https://www.paypal.com/webapps/mpp/country-worldwide>`_, only `a selection of currencies are
supported <https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies>`_.
Settings in PayPal
==================
.. _payment_providers/paypal/configuration-paypal:
To access your PayPal account settings, log into PayPal, open the :guilabel:`Account Settings`, and
open the :guilabel:`Website payments` menu.
Configuration in PayPal
=======================
.. image:: paypal/paypal-account.png
:align: center
:alt: PayPal account menu
#. `Log into your PayPal Developer Dashboard <https://developer.paypal.com/dashboard/>`_.
#. Click :guilabel:`Apps & Credentials` and click :guilabel:`Create App`.
#. Enter an :guilabel:`App Name` and click :guilabel:`Create App`.
#. Copy the :guilabel:`Client ID` and :guilabel:`Secret` and save them for
:ref:`later <payment_providers/paypal/configuration-odoo>`.
.. important::
Note that for PayPal to work **in Odoo**, the options :ref:`Auto Return <paypal/auto-return>` and
:ref:`PDT <paypal/pdt>` **must** be enabled.
If you use customer names or addresses that include accented or non-Latin characters, you
**must** configure the encoding format of the payment request sent by Odoo to PayPal to avoid
transaction failures without notice. To do so, access the `PayPal button language encoding
setting <https://www.paypal.com/cgi-bin/websrc?cmd=_profile-language-encoding>`_, click
:guilabel:`More Options`, and set the :guilabel:`Encoding` field to :guilabel:`UTF-8`.
.. _paypal/auto-return:
Auto Return
-----------
The **Auto Return** feature automatically redirects customers to Odoo once the payment is processed.
From :guilabel:`Website payments`, go to :menuselection:`Website preferences --> Update --> Auto
return for website payments --> Auto return` and select :guilabel:`On`. Enter the address of your
Odoo database (e.g., `https://yourcompany.odoo.com`) in the :guilabel:`Return URL` field, and
:guilabel:`Save`.
.. note::
Any URL does the job. Odoo only needs the setting to be enabled since it uses another URL.
.. _paypal/pdt:
Payment Data Transfer (PDT)
---------------------------
:abbr:`PDT (Payment Data Transfer)` allows to receive payment confirmations, displays the payment
status to the customers, and verifies the authenticity of the payments. From :menuselection:`Website
preferences --> Update`, scroll down to :guilabel:`Payment data transfer` and select :guilabel:`On`.
If you are trying PayPal as a test, access your :ref:`PayPal Sandbox account
<payment_providers/paypal/testing>` and `configure the encoding format for your sandbox account
<https://sandbox.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding>`_.
.. tip::
PayPal displays your **PDT Identity Token** as soon as :ref:`Auto return <paypal/auto-return>`
and :ref:`Payment Data Transfer (PDT) <paypal/pdt>` are enabled. If you need the **PDT Identity
Token**, disable and re-enable :guilabel:`Payment data transfer` to display the token again.
For encrypted website payments & EWP_SETTINGS errors, please check the `PayPal documentation
<https://developer.paypal.com/docs/online/>`_.
PayPal Account Optional
-----------------------
.. _payment_providers/paypal/configuration-odoo:
We advise not to prompt customers to log in with a PayPal account upon payment. It is better and
more accessible for customers to pay with a debit/credit card. To disable that prompt, go to
:menuselection:`Account Settings --> Website payments --> Update` and select :guilabel:`On` for
:guilabel:`PayPal account optional`.
Configuration in Odoo
=====================
Payment Messages Format
-----------------------
#. :ref:`Navigate to the payment provider PayPal <payment_providers/add_new>`.
#. In the :guilabel:`Credentials` tab, enter the :guilabel:`Email` linked to your PayPal account,
then fill in the :guilabel:`Client ID` and :guilabel:`Client Secret` fields with the values you
saved at the step :ref:`payment_providers/paypal/configuration-paypal`.
#. Click :guilabel:`Generate your webhook` to create the :guilabel:`Webhook ID`.
#. Set the :guilabel:`State` field to :guilabel:`Enabled`, and make sure the PayPal payment provider
is :guilabel:`Published`.
#. Configure the remaining options as desired.
If you use accented characters (or anything other than primary Latin characters) for customer names
or addresses, then you **must** configure the encoding format of the payment request sent by Odoo to
PayPal. If you do not, some transactions fail without notice.
.. _payment_providers/paypal/testing:
To do so, go to `your production account <https://www.paypal.com/cgi-bin/customerprofileweb
?cmd=_profile-language-encoding>`_. Then, click :guilabel:`More Options` and set the two default
encoding formats as :guilabel:`UTF-8`.
Testing
=======
.. tip::
- For Encrypted Website Payments & EWP_SETTINGS error, please check the `Paypal documentation
<https://developer.paypal.com/docs/online/>`_.
- Configure your :ref:`Paypal Sandbox account <paypal/testing>`, then follow this
`link <https://sandbox.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding>`_
to configure the encoding format in a test environment.
PayPal provides two sandbox accounts that you can use to simulate live transactions:
Settings in Odoo
================
.. seealso::
:ref:`payment_providers/add_new`
Odoo needs your **API Credentials** to connect with your PayPal account. To do so, go to
:menuselection:`Accounting --> Configuration --> Payment Providers` and :guilabel:`Activate` PayPal.
Then, enter your PayPal account credentials in the :guilabel:`Credentials` tab:
- :guilabel:`Email`: the login email address in Paypal;
- :guilabel:`PDT Identity Token`: the key used to verify the authenticity of transactions.
.. _paypal/testing:
Test environment
================
Configuration
-------------
Thanks to PayPal sandbox accounts, you can test the entire payment flow in Odoo.
Log into the `Paypal Developer Site <https://developer.paypal.com/>`_ using your PayPal credentials,
which creates two sandbox accounts:
- A business account (to use as merchants, e.g.,
`pp.merch01-facilitator@example.com <mailto:pp.merch01-facilitator@example.com>`_);
- A default personal account (to use as shoppers, e.g.,
`pp.merch01-buyer@example.com <mailto:pp.merch01-buyer@example.com>`_).
Log into PayPal sandbox using the merchant account and follow the same configuration instructions.
Enter your sandbox credentials in Odoo (:menuselection:`Accounting --> Configuration --> Payment
Providers --> PayPal` in the :guilabel:`Credentials` tab, and make sure the status is set on
:guilabel:`Test Mode`.
Run a test transaction from Odoo using the sandbox personal account.
- A business account (to use as the merchant account, e.g., `ab-1abc12345678@business.example.com`);
- A default personal account (to use as the shopper account, e.g.,
`ba-9cba87654321@personal.example.com`).
To test the PayPal payment workflow in Odoo:
#. Log into the `Paypal Developer Site <https://developer.paypal.com/>`_ using your PayPal
credentials and go to :menuselection:`Testing Tools --> Sandbox Accounts`.
#. Click the :icon:`fa-ellipsis-v` (:guilabel:`ellipsis`) icon next to the sandbox business account
and select :guilabel:`View/Edit account`.
#. Copy the :guilabel:`Email`, :guilabel:`Client ID`, and :guilabel:`Secret` and save them for the
next step.
#. In Odoo, :ref:`configure the PayPal payment provider <payment_providers/paypal/configuration-odoo>`
with the values saved at the previous step and set the :guilabel:`State` field to
:guilabel:`Test Mode`.
You can then run a test transaction from Odoo using the sandbox personal account.
.. seealso::
- :ref:`payment_providers/test-mode`
- :doc:`../payment_providers`