vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
Other
5.5k stars 976 forks source link

Payments plugin #1087

Closed michaelbromley closed 2 years ago

michaelbromley commented 2 years ago

All e-commerce apps need to accepts payments of some kind. Right now we don't have any official integrations, so every project has to implement their own. This has the following negative results:

  1. Increased time/cost to implement an app on Vendure
  2. Duplicated work re-implementing e.g. a Stripe integration that could be shared
  3. Reliance on 3rd-party plugins which might not be well-maintained or tested.

Describe the solution you'd like Vendure should ship with support for some of the more popular payment providers. This would be housed in a @vendure/payments-plugin npm package, and developed as part of this monorepo.

This package will contain a number of plugins, one for each supported payment provider.

Prior Art

existing 3rd-party payment plugins

Provider Author Repo Last updated notes
Mollie @martijnvdbrug link 2 months ago
Mollie @stefanvanherwijnen link 6 months ago
Braintree @artcoded-dev link 17 days ago extracted from real-world-vendure
PayUMoney @landofcoder link 12 months ago
Stripe @c0ldfront link 12 months ago
Stripe @gaiusmathew link 12 days ago Based on the c0ldfront repo
RazorPay @Deathwish98 link 2 months ago
Pagar.me @jonyw4 link 10 months ago

Supported Payment Providers

There are many, many payment providers. We cannot support them all, so we need to carefully choose in order to be able to keep this package maintainable. The criteria for inclusion would be:

  1. Popularity - it makes the most sense to support the most commonly-used providers. Popularity can be highly regional, but we should lean towards providers which are popular over the largest territory.
  2. Simplicity - the quality of APIs and complexity of features should be taken into account. It is easier to maintain a simple integration where the vendor's SDK does most of the work. The less integration code needed, the better. The developer docs need to be clear, high-quality and up-to-date.

References:

Here is an initial list of candidates. Please comment with suggestions or feedback for this list!

Provider Website Coverage
Stripe https://stripe.com EU, N. America, Brazil, India, Australia, Japan (46 countries, see https://stripe.com/global)
Paypal https://www.paypal.com Worldwide (https://www.paypal.com/webapps/mpp/country-worldwide)
Braintree https://www.braintreepayments.com EU, N. America, Australia, some Asia (https://www.braintreepayments.com/at/country-selection)
Mollie https://www.mollie.com EU, UK & Switzerland (https://help.mollie.com/hc/en-us/articles/115002116105-Can-I-use-Mollies-services-in-my-country-)
Klarna https://www.klarna.com/ Sweden, Norway, Finland, Denmark, Germany, Austria, the Netherlands, Belgium, Switzerland, UK & USA (https://www.klarna.com/uk/business/merchant-support/in-which-countries-can-i-use-klarna/)
Razorpay https://razorpay.com/ India
Adyen https://www.adyen.com/ EU, N.America, Brazil, Australia, Singapore (https://www.rapyd.net/blog/what-are-countries-are-supported-by-adyen)
Checkout.com https://www.checkout.com/ EU, UK, USA, M. East & more (https://www.checkout.com/payment-methods)
AliPay https://intl.alipay.com/ China. Cannot find dev docs.
WeChat Pay https://pay.weixin.qq.com/index.php/public/wechatpay China. Dev docs seems to be a PDF

Did you work with any of these providers' APIs/SDKs? What's your feedback?

My initial feeling is to support: Stripe, Paypal, Braintree, Mollie. Reasoning:

Action plan

  1. Get feedback on the above suggestions
  2. Finalize initial integrations (max 4)
  3. Find contributors who would like to work on one of the selected integrations
tomsvogel commented 2 years ago

@michaelbromley 👏 on Braintree i had massive issues with their support, i could not get an production account. Thinks focus on Stripe and PayPal is a good choice, it is also possible to implement Alipay with stripe.

filipproch commented 2 years ago

I am for Stripe integration, I had to implement ours so I think I could even contribute to that one. We have it working including webhook support and receiving updates from Stripe.

Draykee commented 2 years ago

I think stripe and paypal already covers a lot of business cases in our community. I like some features of klarna, but I would not prioritize it. I'm not sure if I'm able to contribute code right now, but I would at least try to test it, implement it with our front-end and document my experience aswell.

SharmaPawan11 commented 2 years ago

I can help out with Razorpay integration. I have used their js file ( https://checkout.razorpay.com/v1/checkout.js https://checkout.razorpay.com/v1/checkout.js ) in Angular app for frontend.

Razorpay is the leading payment processor when it comes to India. Also we have UPI payment method in India which is a payment option that has a unique address and facilitates users to complete payments in under 10 seconds. It is supported by Razorpay.

Let me know if I can be of further assistance.

On Tue, Sep 14, 2021 at 6:01 PM Michael Bromley @.***> wrote:

All e-commerce apps need to accepts payments of some kind. Right now we don't have any official integrations, so every project has to implement their own. This has the following negative results:

  1. Increased time/cost to implement an app on Vendure
  2. Duplicated work re-implementing e.g. a Stripe integration that could be shared
  3. Reliance on 3rd-party plugins which might not be well-maintained or tested.

Describe the solution you'd like Vendure should ship with support for some of the more popular payment providers. This would be housed in a @vendure/payments-plugin npm package, and developed as part of this monorepo.

This package will contain a number of plugins, one for each supported payment provider. Prior Art

existing 3rd-party payment plugins Provider Author Repo Last updated notes Mollie @martijnvdbrug https://github.com/martijnvdbrug link https://github.com/martijnvdbrug/pinelab-vendure-plugins/tree/master/packages/vendure-plugin-mollie 2 months ago Mollie @stefanvanherwijnen https://github.com/stefanvanherwijnen link https://github.com/simsustech/vendure-plugin-payment-mollie 6 months ago Braintree @artcoded-dev https://github.com/artcoded-dev link https://github.com/artcoded-net/vendure-braintree-plugin 17 days ago extracted from real-world-vendure PayUMoney @landofcoder https://github.com/landofcoder link https://github.com/landofcoder/vendure-payumoney-payment-plugin 12 months ago Stripe @c0ldfront https://github.com/c0ldfront link https://github.com/c0ldfront/stripe-vendure-plugin 12 months ago Stripe @gaiusmathew https://github.com/gaiusmathew link https://github.com/gaiusmathew/stripe-payment-plugin 12 days ago Based on the c0ldfront repo RazorPay @Deathwish98 https://github.com/Deathwish98 link https://github.com/Deathwish98/vendure-razorpay-payment-plugin 2 months ago Pagar.me @jonyw4 https://github.com/jonyw4 link https://github.com/jonyw4/vendure-pagarme-plugin 10 months ago Supported Payment Providers

There are many, many payment providers. We cannot support them all, so we need to carefully choose in order to be able to keep this package maintainable. The criteria for inclusion would be:

  1. Popularity - it makes the most sense to support the most commonly-used providers. Popularity can be highly regional, but we should lean towards providers which are popular over the largest territory.
  2. Simplicity - the quality of APIs and complexity of features should be taken into account. It is easier to maintain a simple integration where the vendor's SDK does most of the work. The less integration code needed, the better. The developer docs need to be clear, high-quality and up-to-date.

References:

Here is an initial list of candidates. Please comment with suggestions or feedback for this list! Provider Website Coverage Stripe https://stripe.com EU, N. America, Brazil, India, Australia, Japan (46 countries, see https://stripe.com/global) Paypal https://www.paypal.com Worldwide ( https://www.paypal.com/webapps/mpp/country-worldwide) Braintree https://www.braintreepayments.com EU, N. America, Australia, some Asia (https://www.braintreepayments.com/at/country-selection) Mollie https://www.mollie.com EU, UK & Switzerland ( https://help.mollie.com/hc/en-us/articles/115002116105-Can-I-use-Mollies-services-in-my-country- ) Klarna https://www.klarna.com/ Sweden, Norway, Finland, Denmark, Germany, Austria, the Netherlands, Belgium, Switzerland, UK & USA ( https://www.klarna.com/uk/business/merchant-support/in-which-countries-can-i-use-klarna/ ) Razorpay https://razorpay.com/ India Adyen https://www.adyen.com/ EU, N.America, Brazil, Australia, Singapore ( https://www.rapyd.net/blog/what-are-countries-are-supported-by-adyen) Checkout.com https://www.checkout.com/ EU, UK, USA, M. East & more ( https://www.checkout.com/payment-methods) AliPay https://intl.alipay.com/ China. Cannot find dev docs. WeChat Pay https://pay.weixin.qq.com/index.php/public/wechatpay China. Dev docs seems to be a PDF

Did you work with any of these providers' APIs/SDKs? What's your feedback?

My initial feeling is to support: Stripe, Paypal, Braintree, Mollie. Reasoning:

  • At least 1 provider option for almost all parts of the world
  • All have high-quality docs & developer APIs.
  • All cover a broad range or territories

Action plan

  1. Get feedback on the above suggestions
  2. Finalize initial integrations (max 4)
  3. Find contributors who would like to work on one of the selected integrations

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vendure-ecommerce/vendure/issues/1087, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGFN3A75FCDOLEMFTMVXSJLUB46BJANCNFSM5EABKZPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

stefanvanherwijnen commented 2 years ago

In the Netherlands iDEAL is the main payment method and Mollie and Adyen were the only ones with a decent JS SDK and documentation. I haven't got to the point of using my implementation for Mollie yet and will probably switch to the package of @martijnvdbrug once I continue my work (and PR anything I am missing, if any). I think Mollie is a relatively small payment provider internationally so it is probably better suited for a community/third party plugin.

Adyen on the other hand is focused on larger companies (250k+ yearly revenue iirc) and might be used more often internationally, so that might be the better choice for official support.

gaiusmathew commented 2 years ago

Hi, @michaelbromley, I'm up for PayPal and stripe integration. I've already integrated PayPal and Stripe into our project and vendure, so I hope I can contribute to PayPal and Stripe. I've also created PayPal and Stripe plugins separately and I'll push the updated vendure-plugins this week.

Let me know if I can be of further assistance.

michaelbromley commented 2 years ago

OK, thanks for all the great feedback so far!

So far we have the following offers of help:

The important things for an "official" plugin is that:

  1. They are in actual production use so we can find and smooth out bugs and edge-cases.
  2. They are well documented, including examples of how the storefront flow needs to work.
  3. They are tested (somehow). E2E tests will be difficult with external services, so let's see what is both feasible and useful.
  4. They are maintained.

If you choose to assist me in building these, there's no formal commitment to maintain them forever, but it at least helps very much if you are using them in a real project so you have a good feel for how well they are working.

Next steps

I just pushed a commit to the minor branch (all this work should go on that branch) which contains a new /packages/payment-plugin/ dir.

To get started, add your implementation to that and send a PR!

martijnvdbrug commented 2 years ago

@michaelbromley I see Adyen mostly being used in (very) big companies, whereas Mollie is mostly used for small to medium sized companies. From what I understand Adyen can be cheaper for large number of transactions, but I can't seem to find exact pricing details for Adyen. Mollie only has transaction fees, no recurring costs.

michaelbromley commented 2 years ago

@martijnvdbrug Thanks, good feedback. I think these integrations are more useful for smaller companies anyway, since very large companies have in-house developers who are able to create a tailor-made solution for whatever integrations they need.

Would you be interested in donating your Mollie integration to this effort?

martijnvdbrug commented 2 years ago

@michaelbromley Sure thing! My current implementation lacks testing and some features like refund, but it's a good place to start. Maybe @stefanvanherwijnen can shed some light on the features he uses (apart from the default payments) so I can take them into account aswell.

I'll keep an eye on this thread, so I know where to contribute.

stefanvanherwijnen commented 2 years ago

I will need refunds in the future but it is not implemented in my package. Ideally the plugin will support all features provided by Mollie, but payments and refunds would have the priority for me. I do not have time in the near future to work on it though. I did manage to get E2E tests working: https://github.com/simsustech/vendure-plugin-payment-mollie/blob/master/src/e2e/mollie.e2e-spec.ts You just need to provide the Test API Key as an env variable.

I fully agree with Mollie over Adyen by the way, just was not sure which direction you wanted to go with these official plugins :+1: .

martijnvdbrug commented 2 years ago

@michaelbromley

The important things for an "official" plugin is that: ...

  1. They are tested (somehow). E2E tests will be difficult with external services, so let's see what is both feasible and useful.

I started using nock for e2e with external services: it patches Node's http module, allowing you to intercept outgoing requests https://github.com/martijnvdbrug/pinelab-vendure-plugins/blob/master/packages/vendure-plugin-myparcel/test/e2e.spec.ts

(Not fully e2e, because the external service is not involved, but best you can do while keeping it self-contained I guess)

stefanvanherwijnen commented 2 years ago

For stripe there seems to be a solution for mocking: https://github.com/stripe/stripe-mock Perhaps the mock implementation can be tested for equality against the real api, and then the mock implementation can be used for self contained testing. The ideal solution would be a mock implementation provided by the payment provider, but that's probably not going to happen.

michaelbromley commented 2 years ago

Status update: Mollie & Braintree plugins are now done and ready to be released in v1.4.

Stripe & Paypal can be added to a later release.

michaelbromley commented 2 years ago

Closing this now and we can open separate issues for PayPal & Stripe integrations.

eshopsoftware commented 1 year ago

Has anyone done PayPal integration please?

michaelbromley commented 1 year ago

@eshopsoftware there's no standalone PayPal integration yet, but the Braintree plugin has full support for PayPal (Braintree is owned by PayPal)

eshopsoftware commented 1 year ago

@eshopsoftware there's no standalone PayPal integration yet, but the Braintree plugin has full support for PayPal (Braintree is owned by PayPal)

Thanks Michael for your swift reply. Its such a shame as we didnt see the Coming Soon button on the plugins page and client doesn`t want BT as they only want to use their existing PayPal account.

eshopsoftware commented 1 year ago

Hi, @michaelbromley, I'm up for PayPal and stripe integration. I've already integrated PayPal and Stripe into our project and vendure, so I hope I can contribute to PayPal and Stripe. I've also created PayPal and Stripe plugins separately and I'll push the updated vendure-plugins this week.

Let me know if I can be of further assistance.

Hi, Sorry to disturb but any chance of some light on the PayPal integration even for a donation? Thanks LW

michaelbromley commented 1 year ago

Hi @eshopsoftware

I do not personally have time to work on that. But there might well be Vendure developers who do!

I would suggest you join our Slack workspace at vendure.io/slack and you can make a post to see if anyone is willing to help out on this.