mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
238 stars 63 forks source link

mollie in angular #179

Closed jailendrarajawat121 closed 4 years ago

jailendrarajawat121 commented 4 years ago

Can I use Mollie in angular2+(client side). As I need to setup SDK on client side. is it possible

Pimm commented 4 years ago

Although possible, we strongly recommend you do not do this.

Calling the Mollie server from the client means the API key is communicated between the client and the Mollie server. Thereby it ends up in the hands of your users.

With your API key, anyone can make requests to Mollie on your behalf. There is no way for Mollie to distinguish valid payments coming from your app from malicious requests coming from someone who extracted your API key. They could issue refunds, or extract private information of your customers. That is a major security issue.

The secure option is to set up a Node.js server. This server will include this library, and will have access to the API key. From your Angular app, rather than calling mollieClient.payments.create directly, you'll make a request to your server and your server will in turn call mollieClient.payments.create.

Alternatively, you can set up a PHP, Ruby, or Python server instead of a Node.js one.