Dependency inversion principle
Also called: DIP
The D in SOLID: business code defines the interfaces it needs, and details like databases and vendors implement them.
Definition
High-level code should not depend on low-level details; both should depend on an abstraction owned by the high-level side. At runtime checkout still calls the payment provider, but in the source code the provider's adapter depends on checkout's PaymentGateway interface, not the other way round. Dependency injection is a common way to supply the implementations.
In practice
CheckoutService asks for a PaymentGateway; a StripeGateway class in the infrastructure layer implements it.
Learn it in context
Lessons that use this term.