# Initiate Recovery Outreach for Abandoned User Flows

This endpoint allows merchants to notify WHITELABEL's Recovery Agent when a user abandons their purchase flow, such as during product selection or after initiating checkout, before completing a payment. The submitted data enables WHITELABEL to follow up with the user via call or WhatsApp to encourage completion of the transaction.

## Security and compliance

- **Authentication**: API access requires a valid API key provided in the request headers.

- **Data Protection**: All data must be transmitted over HTTPS. WHITELABEL adheres to relevant data protection regulations, including **GDPR** and **LGPD**.

- **Data Usage**: Submitted data will be used solely for the purpose of customer engagement and will not be stored beyond the necessary duration.

<Note>
**Use Case Example**

A user named Jane Doe adds a pair of wireless headphones to her cart on a merchant's website but abandons the checkout process. The merchant's system detects this and sends the relevant payload to WHITELABEL’s Recovery Agent API. WHITELABEL then initiates a WhatsApp message to Jane, reminding her of the items left in her cart and offering assistance to complete the purchase.
</Note>

**POST** `/smart-support/external/payments`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Initiate Recovery Outreach for Abandoned User Flows

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)

## Body

Content type: `application/json`

- `customer` (object, required)
  - `full_name` (string, required)
    Customer's full name.
  - `phone_number` (string, required)
    Customer's phone number in E.164 format.
  - `email` (string<email>)
    Customer's email address.
  - `country_code` (string, required)
    ISO 3166-1 alpha-2 country code (e.g., "CO").
  - `language` (string)
    Preferred language for communication (e.g., "es", "en").
- `session` (object, required)
  - `abandonment_timestamp` (string<date-time>, required)
    Timestamp when the user abandoned the flow.
  - `flow_stage` ("product_selection" | "cart_review" | "checkout" | "payment", required)
    Stage where the user dropped off.
  - `platform` ("web" | "ios" | "android", required)
    User's platform.
  - `session_id` (string)
    Unique identifier for the user's session.
- `cart` (object)
  - `total_value` (number<float>)
    Total value of the cart.
  - `currency` (string)
    Currency code (e.g., "COP").
  - `items` (object[])
    List of items in the cart.
    - `name` (string)
      Item name.
    - `sku` (string)
      Stock Keeping Unit identifier.
    - `quantity` (integer)
      Number of units.
    - `price` (number<float>)
      Price per unit.
- `engagement` (object)
  - `preferred_channel` ("call" | "whatsapp" | "auto")
    Preferred communication channel.
  - `reason` (string)
    Reason for abandonment, if known.
  - `metadata` (object)
    Additional contextual information (e.g., UTM parameters, last user actions).

Example:

```json
{
  "customer": {
    "full_name": "Jane Doe",
    "phone_number": "+573001234567",
    "email": "jane.doe@example.com",
    "country_code": "CO",
    "language": "es"
  },
  "session": {
    "abandonment_timestamp": "2025-05-13T22:45:00Z",
    "flow_stage": "checkout",
    "platform": "web",
    "session_id": "sess_abc123xyz"
  },
  "cart": {
    "total_value": 149.99,
    "currency": "COP",
    "items": [
      {
        "name": "Wireless Headphones",
        "sku": "WH-1000XM5",
        "quantity": 1,
        "price": 149.99
      }
    ]
  },
  "engagement": {
    "preferred_channel": "auto",
    "reason": "user_abandoned_checkout",
    "metadata": {
      "utm_campaign": "spring_sale",
      "last_clicked_button": "Proceed to Payment"
    }
  }
}
```

## Responses

### 200

Successfully initiated recovery outreach.

### 400

Invalid request payload or validation error.

### 401

Unauthorized - missing or invalid API key.

### 500

Internal server error.