Commerce payment architecture and payment framework responsibilities
Key Takeaway
The Commerce payment framework does the common payment work, so your Apex Payment Adapter only has to handle communication with a specific gateway.
Commerce payment architecture is how a B2B or B2C store takes payment at checkout. The architecture combines checkout APIs, a payment gateway, and an integrated payment package, all built on the Commerce payment framework. The line between the framework's work and your code decides what you build.
What the framework does and what you write
The Commerce payment framework is the shared payment foundation in Salesforce. Store checkout uses it, and so do Revenue Cloud and Order Management.
The work is split between you and the framework. You author an Apex Payment Adapter, an Apex class that acts between Salesforce and the payment gateway. The framework handles the common work in a secure, PCI-compliant way:
- Creating the payment-specific records in Salesforce
- Logging calls to the gateway for auditing
- Handling idempotency
Because the framework handles that work, your adapter only needs to implement the communication with your specific gateway.
Picture a shopper named Noor paying by card in a store with a custom adapter. The adapter posts a request to the gateway and reads the reply. The framework logs that call for auditing and creates the payment-specific records in Salesforce. The store's developer wrote code for the exchange with the gateway, not for the logging or the records.