Test and validate your ACP Agentic Checkout implementation
A CLI tool for testing ACP (Agentic Commerce Protocol) Agentic Checkout API endpoints against OpenAI's official specification. Perfect for merchants building AI-native checkout experiences for ChatGPT and other AI platforms.
- Full API Coverage: Tests all 5 ACP Checkout endpoints (CREATE, UPDATE, COMPLETE, CANCEL, GET)
- 151 Test Cases: Production-grade test suite covering happy paths, edge cases, and error scenarios
- Spec Compliance: Validates responses against OpenAI's official OpenAPI schema
- Automatic Schema Validation: Ensures your API responses match the ACP specification
- Totals Calculation Checks: Validates monetary calculations (subtotal, tax, fees, totals)
- State Management Testing: Verifies correct checkout session state transitions
- Idempotency Verification: Tests retry safety for CREATE and COMPLETE operations
- Clear Test Reports: See exactly what passed and what needs fixing
- Error Details: Detailed messages showing what went wrong and why
- Fast Execution: Runs 151 tests in seconds
- Config File: Use
acp.config.yamlfor persistent settings - CLI Arguments: Override config with command-line flags
- Interactive Mode: Prompts for missing required fields
- Node.js 20.0.0 or higher
- npm or yarn
npm install -g @nekuda/acp-testgit clone <repo-url>
cd acp-test-cli
npm install
npm run build
npm linkCreate a config file with your API details:
acp-test initThis creates acp.config.yaml:
checkoutUrl: https://your-api.com
apiKey: your_api_key_here
apiVersion: '2025-09-29'Run the full test suite against your API:
acp-test runOr specify options directly:
acp-test run \
--checkout-url https://your-api.com \
--api-key your_key_here \
--api-version 2025-09-29The CLI will show you test results in real-time:
β should create checkout session with items (125ms)
β should update session with shipping address (89ms)
β should select fulfillment option (76ms)
β should complete checkout with payment (152ms)
Test Files 1 passed (1)
Tests 151 passed (151)
Create or update your ACP test configuration file.
acp-test initExecute the full ACP compliance test suite.
acp-test run [options]Options:
-u, --checkout-url <url>- Your ACP Checkout API base URL-k, --api-key <key>- API key for authentication-v, --api-version <version>- ACP API version (default:2025-09-29)-c, --config <path>- Path to config file (default:acp.config.yaml)
Validate your ACP API implementation.
acp-test validate [options]Same options as run command.
Create acp.config.yaml in your project root:
# Required: Your ACP Checkout API endpoint
checkoutUrl: https://api.yourstore.com
# Required: Authentication key
apiKey: sk_test_abc123
# Optional: API version (defaults to latest)
apiVersion: '2025-09-29'
# Optional: Request timeout in milliseconds
timeout: 30000- β Session creation with/without addresses
- β Updating items, quantities, and customer details
- β Shipping address validation and fulfillment options
- β Fulfillment selection and cost calculation
- β Payment token handling
- β Session completion and order confirmation
- β Session cancellation
- β
Missing required fields (
missingerror code) - β
Invalid data formats (
invaliderror code) - β
Out of stock scenarios (
out_of_stockerror code) - β
Payment declines (
payment_declinederror code) - β Proper HTTP status codes (200, 201, 400, 409)
- β Currency format validation (ISO 4217)
- β Address format validation (ISO 3166)
- β Monetary calculations (amounts in minor units)
- β
Totals formula:
total = subtotal - discount + fulfillment + tax + fee - β
Line item calculations:
total = subtotal + tax,subtotal = base_amount - discount
- β Idempotency key handling
- β Request ID tracing
- β API versioning
- β Webhook payload validation
- β Links (ToS, Privacy Policy)
PASS src/tests/checkout.test.ts (4.2s)
Checkout Session Management
β should create session with single item
β should create session with multiple items
β should update session with buyer info
β should add shipping address
β should retrieve fulfillment options
β should select shipping method
β should complete checkout with payment
Idempotency
β should return same session for duplicate CREATE with same key
β should return 409 for same key with different body
β should return same result for duplicate COMPLETE
Error Scenarios
β should handle missing items field (400)
β should handle invalid postal code
β should handle out of stock items
β should handle payment declined
β 151 tests passed
Before going live with ChatGPT Instant Checkout:
- Run Full Test Suite: Ensure all 151 tests pass
- Review Error Handling: Verify all error codes are implemented
- Check Totals: Confirm monetary calculations are accurate
- Test Idempotency: Verify safe retry behavior
- Validate Webhooks: Ensure order events are emitted correctly
npm run buildOutputs compiled CLI to dist/cli.js with TypeScript declarations.
npm run typechecknpm run lint
npm run formatnpm testacp-test-cli/
βββ src/
β βββ cli.ts # Main CLI entry point
β βββ commands/ # CLI command implementations
β β βββ init.ts
β β βββ run.ts
β β βββ validate.ts
β βββ config/ # Configuration handling
β βββ tests/ # ACP test suite (151 tests)
β β βββ checkout.test.ts
β β βββ error-scenarios.test.ts
β β βββ idempotency.test.ts
β β βββ totals-validation.test.ts
β βββ types/ # TypeScript definitions
βββ spec/ # OpenAPI schema
βββ package.json
βββ tsup.config.ts # Build configuration
- ACP Documentation: https://agenticcommerce.dev/
- OpenAI Commerce Docs: https://developers.openai.com/commerce
- Apply for ChatGPT Merchants: https://chatgpt.com/merchants
- ACP GitHub: https://github.com/agentic-commerce-protocol/agentic-commerce-protocol
If you're interested in collaborating or contributing, get in touch at founder@nekuda.ai.
Licensed under the Apache 2.0 License.