Skip to Content
🚀Agentic Commerce Protocol is now live! Instant Checkout is available in ChatGPT. Learn more →
DocumentationAPI ReferenceError Codes

Error Codes

Reference for all error codes returned by the ACP API.

Error Response Format

{ "error": { "code": "error_code", "message": "Human-readable description", "details": {} } }

Authentication Errors (4xx)

CodeHTTP StatusDescription
invalid_signature401Request signature verification failed
missing_signature401Required signature header missing
expired_timestamp401Timestamp outside acceptable window
invalid_agent403Agent not authorized for this merchant

Example

{ "error": { "code": "invalid_signature", "message": "The request signature could not be verified" } }

Session Errors

CodeHTTP StatusDescription
session_not_found404Checkout session does not exist
session_expired410Session has expired
session_cancelled410Session was cancelled
invalid_session_state400Operation not valid for current state

Example

{ "error": { "code": "session_expired", "message": "This checkout session has expired", "details": { "expired_at": "2024-01-15T10:30:00Z" } } }

Cart Errors

CodeHTTP StatusDescription
product_not_found400Product ID does not exist
product_unavailable400Product not available for purchase
insufficient_inventory400Not enough stock
invalid_quantity400Quantity must be positive integer
cart_empty400Cart has no items

Example

{ "error": { "code": "insufficient_inventory", "message": "Only 2 items available", "details": { "product_id": "prod_123", "requested": 5, "available": 2 } } }

Payment Errors

CodeHTTP StatusDescription
payment_declined400Payment was declined
invalid_payment_token400Payment token is invalid or expired
payment_amount_mismatch400Token amount doesn’t match total
payment_currency_mismatch400Token currency doesn’t match
payment_already_captured400Token has already been used

Example

{ "error": { "code": "payment_declined", "message": "The payment method was declined", "details": { "decline_code": "insufficient_funds" } } }

Shipping Errors

CodeHTTP StatusDescription
shipping_address_required400Shipping address needed
shipping_address_invalid400Address validation failed
shipping_not_available400Cannot ship to this address
shipping_option_invalid400Selected shipping option not valid

Example

{ "error": { "code": "shipping_not_available", "message": "We cannot ship to this address", "details": { "country": "XX", "supported_countries": ["US", "CA", "GB"] } } }

Rate Limit Errors

CodeHTTP StatusDescription
rate_limit_exceeded429Too many requests

Example

{ "error": { "code": "rate_limit_exceeded", "message": "Rate limit exceeded. Retry after 60 seconds", "details": { "retry_after": 60 } } }

Server Errors

CodeHTTP StatusDescription
internal_error500Unexpected server error
service_unavailable503Service temporarily unavailable

Handling Errors

JavaScript/TypeScript

try { const session = await createCheckoutSession(cart); } catch (error) { if (error.code === 'insufficient_inventory') { // Show user available quantity const available = error.details.available; showMessage(`Only ${available} items available`); } else if (error.code === 'payment_declined') { // Request different payment method requestNewPaymentMethod(); } else { // Generic error handling showError(error.message); } }

Python

try: session = create_checkout_session(cart) except ACPError as e: if e.code == 'insufficient_inventory': available = e.details['available'] print(f"Only {available} items available") elif e.code == 'payment_declined': request_new_payment_method() else: print(f"Error: {e.message}")

Specification maintained by OpenAI and Stripe

AboutPrivacyTermsRSS

Apache 2.0 · Open Source