Skip to main content
Once your ACP endpoints pass validation in staging, the final step is connecting real-time event handling and verifying your integration is resilient under production load. This guide covers webhook setup for Stripe (and Razorpay for India), the idempotency middleware pattern that prevents duplicate orders on retries, and a six-step checklist for going live safely.

Required endpoints

Your ACP integration needs exactly three endpoints. These map directly to the initiate_checkout and confirm_purchase tool calls in ChatGPT. See ACP tool endpoints reference for the full request and response schemas.

Webhooks

Configure webhooks so your backend receives real-time events from your PSP after payment completes or fails. Relying only on the synchronous /complete response is not sufficient — network failures can leave order state inconsistent.

Stripe

Always verify the Stripe signature before processing an event. Use stripe.webhooks.constructEvent — never trust the raw request body alone.

Razorpay (India)

For Indian merchants using Razorpay, subscribe to equivalent payment events in the Razorpay Dashboard and verify the X-Razorpay-Signature header on each webhook delivery using your webhook secret.

Events to handle

Idempotency

Idempotency is critical for ACP. If a network timeout causes an agent to retry a request, your server must return the same response instead of creating a duplicate order or charging the card twice. The middleware pattern below intercepts the response, caches it against the idempotency key in Redis, and returns the cached response on any repeat request.
Apply idempotency middleware to both /create and /complete. Missing it on either endpoint can result in duplicate sessions or duplicate charges when agents retry on timeout.

Production go-live checklist

1

Staging validation

Run the full checkout flow in staging using Stripe test tokens:
  • tok_visa — successful payment
  • tok_chargeDeclined — payment declined
  • tok_cvcCheckFail — CVC failure
Validate all state transitions and error responses before touching production credentials.
2

Load testing

Confirm your endpoints handle concurrent checkout requests without race conditions. Pay particular attention to inventory depletion — two agents must not be able to purchase the last unit simultaneously.
3

Webhook verification

Verify all Stripe webhook events are received and processed correctly in staging before switching to production. Use the Stripe CLI to replay events locally:
4

Register with OpenAI

Register your ACP tool definitions in the OpenAI platform when using GPT Actions, or pass them dynamically through the function calling API. Test the full conversation flow in ChatGPT’s sandbox environment before enabling for end users.
5

Run Asva validation

Use the ACP Validator for an automated check of all endpoint schemas and response shapes.
6

Go live

Switch to your PSP’s production credentials, deploy, and monitor these signals from day one:
  • Order success rate — target above 95%
  • Checkout session expiry rate — flag if above 5%
  • Payment failure rate — investigate if above 10%
  • Webhook delivery success rate — target 100%

Monitoring

Set up alerts for the following signals. These are the earliest indicators of a degraded ACP integration.
  • Checkout completion rate dropping below 90%
  • P95 checkout completion latency exceeding 5 seconds
  • Webhook delivery failures
  • Payment failure rate spikes