4798486a2df19891abf728504194573576aa2e9d
The `setupFutureUsage` parameter must be passed correctly to the Elements API, and must match the value that is provided in the paymentIntent [^1]. If there is a mismatch, the payment will fail with an error: "The provided setup_future_usage (off_session) does not match the expected setup_future_usage (null). Try confirming with a Payment Intent that is configured to use the same parameters as the Stripe Elements" Due to customizations or default values, it is possible that the `tokenizationCheckbox` (`o_payment_save_as_token` input) is checked by default, even though the `is_tokenization_required` property of the transaction context if false. In this situation, the Stripe Elements params would not be initialized with a `setup_future_usage` (cfr [^2]), yet the checkbox status would be passed as `tokenizationRequired` to the transaction route [^3], leading to the preparation of a Payment Intent with a mismatching value [^4]. The eventListener code is present to sync changes to the checkbox status, but the initial state of the checkbox was not guaranteed to be synced with the Stripe Elements. This patch adds the missing step, similar to the event handler code 15 lines below. [^1]: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage [^2]: https://github.com/odoo/odoo/blob/e26c007dd14de9d0cbf76181e8054a3498e67bd9/addons/payment_stripe/static/src/js/checkout_form.js#L19C1-L21 [^3]: https://github.com/odoo/odoo/blob/e26c007dd14de9d0cbf76181e8054a3498e67bd9/addons/payment/static/src/js/payment_form_mixin.js#L327 [^4]: https://github.com/odoo/odoo/blob/882fc6d1479797215a104cb1fc1ee7a0bb9c84c7/addons/payment/controllers/portal.py#L306C2-L308 closes odoo/odoo#139116 X-original-commit: 9d8da1d14484fa466bb67e8002ce15526ebef676 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
…
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%