Prompt
How do I debug a payment API integration that works in test but not live?
Latest observation
A good way to debug this is to treat test vs live as two separate systems and compare them step by step.
1) Start with the exact failure
Figure out:
- Which call fails: tokenization, payment intent creation, capture, webhook, refund, etc.
- The exact error code/message
- Whether the request reaches the provider
- Whether the failure is client-side or server-side
Log:
- endpoint
- request ID / correlation ID
- HTTP status
- response body
- timestamps
- environment used
2) Verify environment-specific configuration
Test and live often differ in more than one way:
- API keys
- merchant/account IDs
- webhook secrets
- base URLs
- allowed origins / callback URLs
- feature flags
- product or plan IDs
- live-mode permissions
Common mistake: using a test key with a live endpoint or vice versa.
3) Compare the request payloads
Make sure the live request is truly identical where it should be:
- currency
- amount formatting
- customer fields
- billing/shipping details
- country codes
- card/payment method IDs
- metadata
- idempotency keys
Watch for:
- different validation rules in live
- stricter required fields
- locale/currency mismatches
- unsupported test-only values
4) Inspect authentication and permissions
Live accounts may require:
- additional activation
- 2FA/admin approval
- KYC/verification
- specific scopes/permissions
- production webhook registration
- IP allowlisting
If auth succeeds in test but not live, check:
- key type
- key expiration/rotation
- whether the account is fully enabled for live charges
5) Check webhook differences
A lot of “payment failed” issues are actually webhook issues. Confirm:
- live webhook endpoint is configured
- live signing secret matches
- endpoint is publicly reachable
- TLS certificate is valid
- firewall/WAF/CDN isn’t blocking the provider
- your handler responds quickly enough
Also compare:
- event names in test vs live
- retry behavior
- duplicate event handling
6) Look for sandbox-only assumptions in code
Examples:
- hardcoded test card numbers
- test merchant IDs
- mock responses
- skipping 3DS/SCA in test
- assuming zero fees or instant settlement
- relying on fake success statuses
Search the codebase for:
- “test”
- “sandbox”
- hardcoded keys/IDs
- environment branches
7) Check live-only payment requirements
Live transactions may trigger:
- 3D Secure / SCA
- fraud checks
- AVS/CVV validation
- address verification
- velocity limits
- issuer declines
- country restrictions
- minimum/maximum amount rules
A payment that “works in test” can fail in live because the real card issuer or fraud system declines it.
8) Reproduce with provider tooling
Use:
- API logs in the payment dashboard
- request/response traces
- webhook delivery logs
- replay tools if available
- a cURL/Postman reproduction
If possible, compare:
- a working test request
- a failing live request
- the provider’s internal log entry for each
9) Validate your production infrastructure
Sometimes the API is fine, but prod environment breaks it:
- outbound firewall blocks provider
- DNS issues
- proxy strips headers
- TLS/cipher incompatibility
- clock skew affecting signatures
- load balancer timeouts
- request body truncation
- different JSON serialization in prod
10) Check idempotency and retries
Live systems often retry more aggressively. Make sure:
- idempotency keys are unique and stable
- retries don’t create conflicting states
- duplicate payment attempts are handled safely
11) Compare business rules and account status
Live accounts may have:
- delayed capture restrictions
- partial capture not enabled
- manual review requirements
- settlement hold
- currency not enabled
- region-specific constraints
12) Use a minimal live test
Try the smallest possible live transaction:
- lowest allowed amount
- simplest payment method
- minimal metadata
- known-good customer data
- direct API call outside your app
This helps isolate whether the issue is:
- account/config
- code
- infrastructure
- customer/payment data
A practical debugging workflow
- Capture the exact live request and response.
- Confirm live keys, endpoints, and webhook secrets.
- Reproduce with cURL/Postman.
- Check provider dashboard logs.
- Compare against a successful test call.
- Inspect webhooks and asynchronous steps.
- Review account restrictions and fraud/3DS behavior.
- Test from production infrastructure with minimal payload.
If you want to speed this up
Send me:
- the provider name
- the failing step
- the HTTP status/error message
- whether webhooks are involved
- a redacted test request and live request
and I can help you narrow it down quickly.