Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payments plugin #1087

Closed
michaelbromley opened this issue Sep 14, 2021 · 20 comments
Closed

Payments plugin #1087

michaelbromley opened this issue Sep 14, 2021 · 20 comments
Labels
contributions welcome design 📐 This issue deals with high-level design of a feature type: feature ✨

Comments

@michaelbromley
Copy link
Member

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:

  • 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
@michaelbromley michaelbromley added contributions welcome design 📐 This issue deals with high-level design of a feature type: feature ✨ labels Sep 14, 2021
@tomsvogel
Copy link

@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
Copy link
Contributor

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
Copy link
Contributor

Draykee commented Sep 14, 2021

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
Copy link

SharmaPawan11 commented Sep 14, 2021 via email

@stefanvanherwijnen
Copy link
Contributor

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
Copy link

gaiusmathew commented Sep 16, 2021

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 added a commit that referenced this issue Sep 16, 2021
@michaelbromley
Copy link
Member Author

OK, thanks for all the great feedback so far!

So far we have the following offers of help:

  • Stripe: @gaiusmathew, @filipproch. A starting point might be to compare who has the most complete implementation and base it on that?
  • Paypal: @gaiusmathew
  • Braintree: I will do this since I already worked on it, plus I'll be using it in prod soon.
  • Mollie/Adyen: @martijnvdbrug do you have any input on Mollie vs Adyen? Advantage of Mollie is that we have an existing plugin to base it on, plus actual production use.

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
Copy link
Collaborator

@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
Copy link
Member Author

@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
Copy link
Collaborator

@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
Copy link
Contributor

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 👍 .

@martijnvdbrug
Copy link
Collaborator

@michaelbromley

The important things for an "official" plugin is that:
...
3. 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
Copy link
Contributor

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
Copy link
Member Author

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
Copy link
Member Author

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

@eshopsoftware
Copy link

Has anyone done PayPal integration please?

@michaelbromley
Copy link
Member Author

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

@eshopsoftware
Copy link

@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
Copy link

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
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome design 📐 This issue deals with high-level design of a feature type: feature ✨
Projects
None yet
Development

No branches or pull requests

9 participants