This directory holds the code for the Agentic Commerce Tutorial.
You can either:
- install and use it as a Medusa application;
- or copy its source files into an existing Medusa application.
This example targets the published ACP 2026-04-17 Agentic Checkout and webhook schemas.
| Capability | Status | Production boundary |
|---|---|---|
| Product-feed generation | Example implementation | sendProductFeed only logs the generated feed. Implement authenticated transport and delivery monitoring. |
| Checkout session routes | Example implementation | Authentication is intentionally disabled in the sample middleware. Enable and test it before deployment. |
| POST idempotency | Partial | Routes pass the key to workflow context, but production deployments must enforce required, replay, in-flight, and payload-conflict behavior. |
| Delegated payment | Stripe example | Validate provider eligibility, failure recovery, reconciliation, and safe logging for your deployment. |
| Order webhooks | Schema-aligned payload example | Event names, order statuses, adjustments, and signing follow 2026-04-17; webhook delivery remains merchant-supplied. |
This compatibility statement describes the example's implementation surface. It is not a certification or a statement that a merchant is enabled in any host product, region, or rollout cohort.
Before using this example in production:
- enable and test bearer authentication;
- enforce the ACP version and required idempotency behavior;
- implement product-feed and webhook transport, retry, and monitoring;
- store signing secrets securely and rotate them through an approved process;
- validate checkout, payment, order, refund, and fulfillment scenarios for your business;
- compare the pinned ACP release with newer releases before upgrading.
- Clone the repository and change to the
agentic-commercedirectory:
git clone https://github.com/medusajs/examples.git
cd examples/agentic-commerce2. Rename the .env.template file to .env.
3. If necessary, change the PostgreSQL username, password, and host in the DATABASE_URL environment variable.
4. Set the following environment variables:
STRIPE_API_KEY=
AGENTIC_COMMERCE_SIGNATURE_KEY=Where:
STRIPE_API_KEYis the Secret API key from your Stripe account.AGENTIC_COMMERCE_SIGNATURE_KEYis the signature key from OpenAI.
5. Install dependencies:
yarn # or npm install6. Setup and seed the database:
npx medusa db:setup
yarn seed # or npm run seed7. Start the Medusa application:
yarn dev # or npm run devYou can then test out the integration with ChatGPT or other AI agents based on the details received from the agents. You'll need to update the service in src/modules/agentic-commerce/service.ts with the correct logic to send the product feed, and to send webhook events.
If you have an existing Medusa application, copy the following directories and files into your project:
src/apisrc/jobssrc/modules/agentic-commercesrc/subscriberssrc/workflows
Then, add the Agentic Commerce Module to medusa-config.ts with the Stripe Provider Module, which is the only supported method right now in ChatGPT:
module.exports = defineConfig({
// ...
modules: [
{
resolve: "./src/modules/agentic-commerce",
options: {
signatureKey: process.env.AGENTIC_COMMERCE_SIGNATURE_KEY || "supersecret",
}
},
{
resolve: "@medusajs/medusa/payment",
options: {
providers: [
{
resolve: "@medusajs/medusa/payment-stripe",
id: "stripe",
options: {
apiKey: process.env.STRIPE_API_KEY,
},
},
],
},
},
],
})Next, add the following environment variables:
STRIPE_API_KEY=
AGENTIC_COMMERCE_SIGNATURE_KEY=Where:
STRIPE_API_KEYis the Secret API key from your Stripe account.AGENTIC_COMMERCE_SIGNATURE_KEYis the signature key from OpenAI.
Start the Medusa application:
yarn dev # or npm run devYou can then test out the integration with ChatGPT or other AI agents based on the details received from the agents. You'll need to update the service in src/modules/agentic-commerce/service.ts with the correct logic to send the product feed, and to send webhook events.
- Medusa Documentation
- Agentic Commerce documentation
- ACP
2026-04-17Agentic Checkout schema - ACP
2026-04-17webhook schema - OpenAPI Spec file: Can be imported into tools like Postman to view and send requests to this project's API routes.