San Francisco based provider of payment processing with customer engagement tools has raised $40m in funding, led by Franklin Templeton.