How to add discount with customers previous purchase

I would like to give Membership rewards to my customer. Each time customer is coming and indicating membership, 10% of the amount paid will be credited as fidelity points.

Example: Customer A is coming three times and spending 600, 1500, 900 Rs. Each time his account is credited by 600 x10% = 60 / 1500x10% = 150 / 900x10% =90… total is 60+150+90 = 300 fidelity points which is equal to 300Rs which can be spent in the restaurant without any condition.

How to achieve this?

Just search Loyalty there are a lot of topic already.

Read and follow those topics first if you stuck post detailed setup and screenshot will get more help.