Documentation Index
Fetch the complete documentation index at: https://docs.revtain.com/llms.txt
Use this file to discover all available pages before exploring further.
API Errors
409 Conflict — Duplicate recovery request
idempotencyKey twice, OR the same card + amount within 5 minutes (velocity check).
Fix: This is expected and protects you from double-charging. Use the existingTransactionId to look up the original outcome — don’t retry. If your retry logic is firing duplicate calls, ensure idempotencyKey is generated once per logical retry attempt, not on every code path.
429 Too Many Requests — Rate limit exceeded
/tokenize).
Fix: Implement exponential backoff using the retryAfter value. If you’re consistently hitting this, contact support@revtain.com — we can raise limits for legitimate workloads.
403 Forbidden — Transaction blocked by risk engine
fraudulent, lost_card, pickup_card) indicates the issuer wants this card stopped.
Fix: Do not retry. Flag the customer account for review. Retrying these will trigger chargebacks and damage your merchant standing. See Decline Codes for the full list.
401 Unauthorized — Missing or invalid API key
Causes:
- API key not sent in the
X-API-KEYheader - API key is from a different environment (test key on production endpoint, etc.)
- API key was rotated
X-API-KEY (not Authorization or X-Api-Key). Check your environment variables. If rotated, update your secret store and redeploy.
202 Accepted — Queued for retry
insufficient_funds retried after payday).
Fix: This is expected — not an error. Wait for the webhook (recovery.success or recovery.failed) to confirm the final outcome. Don’t poll the status endpoint aggressively; the webhook is the source of truth.
202 Accepted with status: "unknown" — Ambiguous gateway response
Webhook Issues
Webhook returning 401 to my own endpoint
Cause: Signature mismatch. Either you’re hashing the wrong payload, or your webhookSigningSecret is wrong.
Fix:
- Confirm you’re using the
webhookSigningSecretfrom onboarding (starts withwhsec_), not the API key (starts withrev_). - Hash the raw request body (not parsed JSON) with HMAC-SHA256.
- Use a timing-safe comparison (e.g.,
crypto.timingSafeEqualin Node,hmac.compare_digestin Python). - See the Webhooks Guide for verified code samples.
Webhook never arrives
Causes & fixes:- Endpoint isn’t HTTPS → Revtain only delivers to HTTPS URLs.
- Endpoint returned non-200 → After 3 retries (0s, 2s, 8s), Revtain stops trying. Check your logs for failed deliveries.
- Endpoint took longer than 10 seconds → Treated as failure. Acknowledge the webhook with
200immediately, then process async. - Wrong URL registered → Re-check your onboarding settings.
Webhook arrives but content seems stale
Cause: You may be reading from a cached version, or the event was retried after a delay. Fix: Always trust therevtainTransactionId and look up current state via GET /api/recovery/status/:id if uncertain.
Connector Issues
Connector fires but no recovery happens
Cause: Revtain couldn’t extract the gateway token from your billing platform’s API. Common reasons:- API key has insufficient permissions (see your connector’s required permissions)
- Customer has no payment source on file
- Test/live mode mismatch (test webhook hitting live gateway, etc.)
Invoice not marked as paid after success
Cause: Revtain recovered the charge on a backup gateway, but the invoice on your billing platform is tracked against the primary gateway. Fix:- For Chargebee and Recurly, this is automatic via API.
- For Stripe Billing, the invoice is paid via Stripe’s
pay_invoiceAPI — check the invoice timeline in the Stripe Dashboard for confirmation. - For Braintree, the subscription auto-detects the recovered payment.
Testing Issues
simulateOutcome is being ignored
Cause: Your primary gateway is not a Test Gateway. The simulateOutcome parameter is only honoured with test gateways.
Fix: Onboard a test gateway (Revtain Test Gateway, Stripe sk_test_..., Braintree Sandbox) for sandbox testing. In production, simulateOutcome is silently ignored.
Test card declined but I expected success
Cause: Test cards (4111 1111 1111 1111, etc.) only succeed on test gateways. They’re rejected by live gateways.
Fix: Confirm your primary gateway is in test mode. See Testing Guide.
Still Stuck?
Email support@revtain.com with:- Your client ID (from onboarding)
- The
transactionId(if you have one) - The full request payload (redact card numbers)
- The full response body
- Approximate timestamp