Clinton Rocha uses a Laravel checkout example to explain how payment adapters can keep order rules stable when a product changes providers. His DEV article, Trocar de provedor não deveria ser uma dor de cabeça, follows a checkout that must accommodate Stripe and Mercado Pago.
Put the order state in the order model
The first design keeps external status names and payment identifiers close to the business rules. Rocha illustrates the cost with a product release operation that checks which provider handled the purchase before it can tell whether the order is paid. The refund operation has its own provider switch. Every new operation that follows this pattern needs to learn the provider vocabulary.
In his revised schema, an order carries a domain status, a provider name and a generic provider reference. The product release operation can check the order's paid state directly. The provider name still records where the payment took place, and the reference identifies the transaction in that provider's system.
Give each adapter its own translation
The proposed gateway contract covers charging, checking status and refunding. The Stripe example maps the payment intent status succeeded to the application's paid state. The Mercado Pago example maps approved to the same state. These are mappings in Rocha's examples, and the application decides which distinctions its domain needs to preserve. The canceled and pending states illustrate how the adapters give callers a shared vocabulary for the other outcomes.
The Laravel example binds the contract to an adapter selected by a configuration value and a resolver. That keeps the choice of default gateway near the application wiring. Adding a provider in this design means teaching the resolver about another adapter and extending the provider enum.
Keep older payments in view
The example also gives readers a concrete question to ask about switching defaults. Its refund operation passes the stored reference to the injected gateway, which the shown binding chooses from configuration. If orders made before the change still need refunds, the stored provider gives the application a way to select the adapter for that order. The distinction between selecting a provider for a new charge and finding the provider for an existing payment is where the schema and the wiring meet.