-
Notifications
You must be signed in to change notification settings - Fork 6
AgenticCheckout
KristofersOzolinsMagebit edited this page Oct 14, 2025
·
1 revision
- Create/Retrieve/Update/Complete/Cancel checkout sessions
- Custom router with configurable base path (default
checkout_sessions) - Idempotency, API version and request ID headers in responses
- Delegated payment storage endpoint
- Webhook dispatch for order events (created/updated)
- Configurable links (ToS/Privacy/etc.) attached to session responses
- Overview
- Endpoints and routes
- Request/response schema overview
- Checkout session flow
- Delegated payments
- Idempotency and compliance
- Configuration
- Extension points
- References
This guide explains how the Agentic Checkout API is implemented in Magento 2 using the Magebit Agentic Commerce module, aligned with the ACP spec. It covers endpoints, request/response objects, routing, idempotency, and extension points for payments and validation.
Base frontName: agentic_commerce with a configurable router base path.
- Router base path: configurable, default
checkout_sessions - Effective paths (examples shown with default):
- Create checkout session:
POST /checkout_sessions→agentic_commerce/checkout_sessions/index - Retrieve session:
GET /checkout_sessions/{session_id}→agentic_commerce/checkout_sessions/retrieve - Update session:
POST /checkout_sessions/{session_id}→agentic_commerce/checkout_sessions/update - Complete session:
POST /checkout_sessions/{session_id}/complete→agentic_commerce/checkout_sessions/complete - Cancel session:
POST /checkout_sessions/{session_id}/cancel→agentic_commerce/checkout_sessions/cancel - Delegated payment store:
POST /agentic_commerce/delegate_payment/index
- Create checkout session:
Notes:
- The router parses the base path and infers action by method or suffix.
- The module sets
session_idautomatically from the URL segment when applicable.
- Requests are validated and transformed into typed objects:
- Create:
CreateCheckoutSessionRequestInterface - Update:
UpdateCheckoutSessionRequestInterface - Complete:
CompleteCheckoutSessionRequestInterface - Delegated Payment:
DelegatePaymentRequestInterface
- Create:
- Responses:
-
CheckoutSessionResponseInterface(includes line items, totals, fulfillment options, payment provider, buyer, currency, links, messages, status)
-
- Create session
- Call create to obtain
session_id(masked guest cart id). - Provide items, buyer, fulfillment address as available; totals and options are computed.
- Update session (optional, repeatable)
- Send changes (items, address, fulfillment option id) to recalc totals and options.
- Retrieve session (optional)
- Get current state for UI/agent display (messages, status, totals, options).
- Complete session
- Provide
payment_data.token(vault/payment method token) and optional billing address and buyer. - Module places order, maps order to session, sets success message, and dispatches webhook.
- Cancel session (optional)
- Deactivates cart if not already placed.
See the detailed guide: DelegatedPayments.md
- Incoming requests validated with
ComplianceService(API token, allowed headers, etc.). - Idempotency is handled using key and cached response storage; headers are echoed in responses:
-
Idempotency-Key,API-Version,Request-Id
-
- Errors are normalized via
ErrorResponseInterface.
Admin: Stores -> Settings -> Configuration -> Magebit -> Agentic Commerce
- Agentic Checkout
- Router Base Path (default
checkout_sessions) - API Token (optional)
- Order Success Page (redirect target for
agentic_commerce/checkout/order) - Checkout Session Links (array)
- Enable Webhooks (on/off)
- Order status mapping to ACP lifecycle
- Router Base Path (default
- Validation:
CartValidatorInterfaceand composite - Payment vaulting:
PaymentMethodVaultHandlerInterfaceandPaymentHandlerPool - Session response building: converters like
CartItemToLineItem,CartToFulfillmentOptions,CartToTotals,CartToPaymentProvider,CartToBuyer - Webhooks:
WebhookServiceand data mappers (e.g.,OrderToOrderCreatedUpdatedWebhook) - Routing: base path via config, custom controller actions if needed
- ACP Checkout concepts:
https://developers.openai.com/commerce/guides/key-concepts