AI IDE Integration

Let your AI coding assistant do the heavy lifting. Copy the prompt below into Cursor, Windsurf, or Copilot.

System Prompt for AI Assistants
This reference guide helps your AI understand exactly how to implement Retake correctly.
You are a Senior Full-Stack Engineer. Integrate Retake (Revenue Recovery) into the application.

## API Endpoint
POST https://retakeapi.com/api/v1/track
Header: X-API-Key: <YOUR_API_KEY>
Content-Type: application/json

## Intent Types (use the correct type for each scenario)
| Type           | When to Fire                                     | Business Type    |
|----------------|--------------------------------------------------|------------------|
| cart           | User adds items to cart                          | E-commerce       |
| checkout       | User enters checkout flow / payment page         | E-commerce/SaaS  |
| pricing        | User views pricing page                          | SaaS             |
| upgrade        | User clicks "Upgrade" or views upgrade modal     | SaaS             |
| trial_expiring | User's free trial is ending (fire via cron job)  | SaaS             |
| payment_failed | Recurring payment failed (fire via webhook)      | SaaS             |

## Events to Track

### 1. INTENT (Start tracking when user shows high-value intent)
{
  "event": "INTENT",
  "type": "cart",                       // See Intent Types table above
  "userId": "u_8823",                   // Required: Stable User ID
  "value": 249.00,                      // Value in currency (cart total, plan price)
  "currency": "USD",                    // Default: USD
  "name": "John Doe",                   // Optional: User name for email context
  "email": "[email protected]",           // Critical: Enables automated email recovery
  "items": [                            // Optional: Cart/plan items for email context
    {
      "id": "sku_123",
      "name": "Enterprise Plan",
      "price": 249.00,
      "quantity": 1
    }
  ],
  "metadata": {                         // Optional: Custom data for personalization
    "planName": "Pro",
    "daysRemaining": 3                  // For trial_expiring
  }
}

### 2. CONVERSION (Stop recovery when user converts)
Trigger: After successful payment, subscription activated, or order complete.
{
  "event": "CONVERSION",
  "userId": "u_8823",                   // Required: Same userId as INTENT
  "value": 249.00,                      // Final conversion value
  "transactionId": "tx_12345"          // Optional: Your order/transaction ID
}

## Implementation Rules
1. USER ID: Generate once per visitor (cookie/localStorage), reuse consistently.
2. EMAIL: Crucial for recovery emails - capture as early as possible.
3. DEBOUNCE: Avoid API spam. Debounce user inputs by 1-2s.
4. SERVER-SIDE: Keep API key on server, never expose to frontend.
5. ERROR HANDLING: Silently fail. Never block user flow if Retake is down.
6. CRON JOBS: For trial_expiring, run daily to track expiring trials.
7. WEBHOOKS: For payment_failed, fire from Stripe/Paddle webhook handlers.

## Response
Success: { "success": true, "intentId": "int_xxx" }
Error: { "error": "message" }
1

Copy Prompt

Click the copy button above.

2

Open Chat

Open Cursor/Copilot chat in your IDE.

3

Paste & Prompt

"Implement Retake tracking for my [page/component] styling."