> For the complete documentation index, see [llms.txt](https://popin.gitbook.io/popin-developer-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://popin.gitbook.io/popin-developer-hub/passing-logged-in-customer-details.md).

# Passing Logged-In Customer Details

## **Passing Logged-In Customer Details to Popin**

This document explains how to programmatically pass logged-in customer information to the **Popin** widget to streamline the user experience by skipping the initial data entry screen.

***

### **📋 When to Use This**

Use this method if:

* The customer is already logged in.
* You have access to their **name** and **either a mobile number or email**.
* You want the Popin widget to **open directly**, bypassing the customer detail form.

***

### **🛠️ Required Fields**

Use the `Popin("captured", {...})` function to pass customer details to the widget.

| Field     | Required | Description                                                                   |
| --------- | -------- | ----------------------------------------------------------------------------- |
| `name`    | ✅ Yes    | Full name of the customer. **Mandatory**.                                     |
| `mobile`  | ⚠️ Yes\* | Required if `email` is not provided. Must be passed **without** country code. |
| `email`   | ⚠️ Yes\* | Required if `mobile` is not provided.                                         |
| `country` | ❌ No     | Optional. Defaults to **+91 (India)** if not specified.                       |

> 🔔 **Important:**
>
> * `name` is always required.
> * You must provide **either** `mobile` or `email`.
> * `mobile` must be sent **without** the country code prefix (`+`).

***

### **🧩 Implementation**

Invoke the `Popin("captured", {...})` method **before** calling `Popin("open")`.

#### ✅ Example:

```javascript
Popin("captured", {
  name: data["contact[full-name]"],           // Required
  mobile: data["contact[phone]"],             // Optional if email is provided
  email: data["contact[email]"],              // Optional if mobile is provided
  country: data["contact[country-code]"]?.trim() // Optional (defaults to +91)
});

Popin("open"); // Opens the widget directly
```

***

### **🔁 Sample Scenarios**

#### **Case 1: Name and Mobile Provided**

```javascript
Popin("captured", {
  name: "Ravi Kumar",
  mobile: "9876543210"
});
Popin("open");
```

#### **Case 2: Name and Email Provided**

```javascript
Popin("captured", {
  name: "Meera Das",
  email: "meera@example.com"
});
Popin("open");
```

#### **Case 3: Full Info with Country Code**

```javascript
Popin("captured", {
  name: "Arjun Mehta",
  mobile: "9123456789",
  email: "arjun@example.com",
  country: "971" // UAE
});
Popin("open");
```

***

### **📌 Notes**

* If `country` is omitted, it defaults to **+91 (India)**.
* Ensure `mobile` is passed **without** the country code.
* Calling `Popin("open")` after `Popin("captured")` will **bypass the customer input form** and load the widget directly to the next screen.
