I have an Ionic2 Client that makes RESTful calls to a Tomcat Server running Spring/Java8 Services.
I would like to make use of the paypal-rest-sdk or something similar to send and receive paypal payments. I will also be implementing additional payment gateways (e.g. Stripe) in the future.
Question
My question is how should I architecturally design this?
PayPal provides a client_id
and client_secret
that obviously needs to remain secure. These need to be used when making calls to the PayPal api.
Should the client_id
and client_secret
be stored on the Client (Ionic App) or Server (Java/Spring)?
1. Stored on Client
If the client_id
and client_secret
are stored on everyones device, does this offer a potential security risk. Can someone obfuscate the code and steal them?
2. Stored on Server
What is stopping someone calling the RESTful Service with the correct parameters to execute an unauthorized payment? I am planning on adding Spring JWT to the RESTful Services. Is this enough?
Any advise appreciated.