Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 3 layered application.

  • Presentation Layer (PL): ASP.NET MVC app
  • Business Logic Layer (BLL) project
  • Data Access Layer (DAL) project

I need to add a Web Reference to a service for a payment gateway. Where does it go? PL or BLL?

P.S. Before using the Web service I need to retrieve some data from database and send that data to web service.

share|improve this question
up vote 7 down vote accepted

Since the actual operation isn't something the user needs to see then Presentation is out. What we have left is the Data Access and the Business layers. Since you aren't actually manipulating data from the payment gateway it's more of an external business process, which makes the Business layer the logical home for it.

share|improve this answer
Don't actually reference it from your BLL though. That will introduce a concete dependency, and you don't want that because you might want to stub it for testing, or the vendor might introduce a new version of the API, and then you'll need to have both versions in your code for a time. I normally give proxies to external services their own project, and code to them by interface. – Mr Cochese Dec 19 '13 at 11:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.