This paper provides efficient solutions to maximize profit for commercial ridesharing services, under a pricing model with detour-based discounts for passengers. We propose a greedy heuristic for real-time ride matching and compare with other heuristics. We study the trade-offs between optimality and execution time that the solutions offer. Simulations on New York City (NYC) taxi trip data show that our heuristics are up to 93% optimal and 105 times faster than the exponential-time optimal algorithm. Commercial ridesharing service providers generate significant savings by matching multiple ride requests, which are typically shared between the service provider (increased profit) and the ridesharing passengers (discounts). It is not clear apriori how to split, since higher discounts would encourage more ridesharing, thereby increasing total savings, but the fraction of savings taken as profit is reduced. We simulate a scenario where the decisions of the passengers to opt for ridesharing depend on the discount offered by the provider. We provide an adaptive learning algorithm IDFLA that learns the optimal profit-maximizing discount factor for the provider. An evaluation over NYC data shows that IDFLA, on average, learns the optimal discount factor under 16 iterations. Finally, we investigate the impact of imposing a detour-aware routing assuring sequential individual rationality which offers a better ride experience and increasing the provider's market share, but at the cost of decreased average per-ride profit due to the reduced number of matched rides. We construct a model that captures these opposing effects, wherein simulations on NYC data show that 7% increase in market share would suffice to offset the decreased average per-ride profit.