Software Design

Adapter Pattern: Isolating Third-Party APIs

UML Class Diagrams · made in Skemio

UML class diagram displaying CheckoutService using PaymentGateway interface, implemented by StripeAdapter which delegates to legacy StripeApi.
UML class diagram displaying CheckoutService using PaymentGateway interface, implemented by StripeAdapter which delegates to legacy StripeApi.

What it shows

  • Wraps awkward external interfaces into a domain-controlled contract.
  • Shields domain services from third-party breaking API updates.
  • Enables instant swapping or mock testing of external payment vendors.

The takeaway

Never let third-party vendor schemas leak into your domain; isolate them behind an adapter.

More uml class diagrams