I am setting up a new ecommerce project with angular 2 and firebase. My issue is how to integrate a paypal button and when customers click on it, they will be redirected to
After user finish paying in PayPal, you can send them back to your website, then put loading message on the screen. Meanwhile you will have interval that will ask your server if the transaction was completed.
Using PayPal IPN, PayPal will make http call to desired URL after a transaction was made, then you need to pick up the POST data that contain the info about the transaction, send it back to PayPal to verified that they send it, and after that do what you want with the information.
When you create the form for the PayPal button use 'custom' hidden fields for identification of the transaction (for example it can be user ID) PayPal we'll send this data back with the IPN so when you pick it up you can tie it to the correct user.
You need to define your IPN URL inside your PayPal settings
Thanks all for the solutions and here is our delayed solution: as Firebase controls the backend, it is impossible to setup a payment system on it, we setup a light-weight nodejs express server hosted on google cloud platform which can communicate with paypal to receive IPN data from paypal each time our customer makes a payment. The IPN data will be used to check with realtime data from Firebase and updates payment status to client side.