Giter Club home page Giter Club logo

magento2-stripe-payments's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

magento2-stripe-payments's Issues

Use deferred intents

Hello Hyva team,

Just came across this repository. From a brief look at the code, this seems to depend on older versions of v3.x of the Stripe module. In the older versions, a PaymentIntent was required in order to render the PaymentElement. I can see that a dummy PI is created in a custom get_client_secret API endpoint, and this can create duplicate, incomplete payments in the Stripe dashboard. Additionally, I can see that the flow is to first confirm the payment on the client side, and then place the order. If the order placement fails, and a re-attempt to place the order is made, then this could create a problem with duplicate payments.

I would recommend that the implementation changes so that deferred intents are utilized. With deferred intents, the PaymentElement can be rendered without a payment intent, and a payment method token can be generated in a standalone way, without creating an incomplete payment in the Stripe dashboard.

Here is the documentation on how to use deferred intents: https://stripe.com/docs/connectors/adobe-commerce/custom-storefront#tokenize-payment-method.

This will improve performance by dropping the get_client_secret and refresh_payment_intent API calls, and would additionally shift the payment confirmation to the server side, right before the order is saved.

Additionally, the minimum version dependency for the Stripe module would need to be v3.4 or newer, which is the version that introduced deferred intents.

The provided examples at https://stripe.com/docs/connectors/adobe-commerce/custom-storefront are based on the GraphQL API, however there is an equivalent example for Magento's REST API in the module's examples/ directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.