When Salesforce Commerce Cloud doesn’t speak to an AI agent natively, you build the interpreter yourself. This is that story.
The Problem Space
The challenge was bridging three systems that were not designed to talk to each other:
- Gemini AI — the orchestration brain, issuing natural-language tool calls
- SFCC (Storefront Reference Architecture) — a complex B2C commerce platform
- Adyen — the payment processor requiring PCI-compliant token flows
Architecture Overview
Here is a look at the middleware in action. Notice how we decouple the intent from the execution:
export class UcpMiddleware { async handleIntent(intent: CheckoutIntent) { // 1. Verify token with Adyen const token = await this.adyen.verifyToken(intent.paymentData);
// 2. Hydrate SFCC basket const basket = await this.sfcc.hydrateBasket(intent.basketId);
if (!token.valid) { throw new PaymentVerificationError("Token failed 3DSecure"); }
return this.sfcc.submitOrder(basket, token); }}A standard format for exchanging multi-stage, state-dependent transactional payloads between a non-deterministic agentic system and a deterministic legacy commerce engine.
This ensures that the state transition remains fully observable and reversible by the agent if Adyen rejects the payload.