# Personal Loans

## Overview

This documentation covers installation, required prerequisites, configuration properties currently surfaced (channel, zone, experience), and a basic usage example.

## Setup Instructions

You’ll need the correct `channel` and `zone` values for your integration. Ask your Partner Manager to provide these values for Flutter Personal Loans.

### Step 1: Request and API Token

Before you can use the Engine SDK, you'll need to request an API token from your Partner Manager. This token is used to authenticate with the Engine API and provides access to different financial institutions. You may want to use multiple API tokens depending on how many entry points your app has into the SDK.

### Step 2: Confirm Software Requirements

* Flutter 3.0.0 or higher
* Dart 3.10.7 or higher

### Step 3: Install the SDK

Add the dependency to your **pubspec.yaml**:

```yaml
dependencies: engine_mobile_flutter_sdk: ^0.0.3
```

Note: This installs the latest compatible SDK version. For a specific version, pin it explicitly in pubspec.yaml.

Then install the dependency:

```bash
flutter pub get
```

### Step 4: Initialize the SDK

Add the following import to any Dart file where you want to use the SDK:

```dart
import 'package:engine_mobile_flutter_sdk/engine_mobile_flutter_sdk.dart';
```

### Basic Example

Place the `EngineSDK` widget anywhere in your widget tree to render the Personal Loan flow.

```dart
EngineSDK(
  channel: 'your-channel',
  zone: 'your-zone',
  experience: 'search',
)
```

## Properties

Pass these properties to `EngineSDK`:

* `channel` (String, required)\
  Identifies your integration in Engine. **Provided by your Partner Manager.**\
  Example: `'direct'`
* `zone` (String, required)\
  Identifies the placement or distribution surface for the SDK. **Provided by your Partner Manager.**\
  Example: `'marketplace'`
* `experience` (String, required)\
  Selects the product flow variant. Use `'search'` for Personal Loans unless instructed otherwise.\
  Example: `'search'`

## User Experience Demo

The SDK renders a complete Personal Loans journey inside your app. It collects any missing user inputs, submits the lead, and then displays offers.

Typical flow:

1. Landing screen
2. Loan and personal details form
3. Review / confirm details
4. Offer results

<div><img src="/files/8ug0LESamEWmVYp6JMLy" alt="Landing Screen" width="324"> <img src="/files/rgguYbsNE9pWsOvZaoyX" alt="Loan Details" width="324"></div>

<div><figure><img src="/files/kJdg4DAex5WcU2nWbgHb" alt="" width="324"><figcaption><p>Personal Details</p></figcaption></figure> <figure><img src="/files/VxLRpCmpYPfgmgSJQIUO" alt="" width="324"><figcaption><p>Personal Details</p></figcaption></figure></div>

<div align="center"><figure><img src="/files/5Nrj4A8elyoER31bWNks" alt="" width="324"><figcaption><p>Personal Details</p></figcaption></figure> <figure><img src="/files/Q4p00Akpb3JUdMD1ngLK" alt="" width="324"><figcaption><p>Personal Details</p></figcaption></figure></div>

## Client Tags for Reporting

The Engine Flutter SDK supports adding your unique Client Tags to track performance of specific campaigns or users. All Client Tag data is attributed to the lead level.

Client Tags can be added by including a **clientTags** attribute at the top level of the EngineSDK widget, where the value is a **Map\<String, List\<String>>**.&#x20;

We strongly recommend including only one element per list for ease of reporting and attribution—if you want two separate tags, include the second tag under a different key. There is no limit to the number of keys in the **clientTags** map

### Example

```dart
EngineSDK( 
bearerToken: '{your_token}', 
channel: '{your_channel}', 
zone: '{your_zone}', 
experience: '{your_experience}', 
prefilledData: // ...any data you don't want to ask for again 
clientTags: const { 
'clientId': ['client1'], 
'trafficsource': ['email'], 
'campaignId': ['campaign1'], 
}, 
// ...optional Event Handlers, please see Event Handler section 
)
```

**Note**: Client Tags are only sent when both prefilledData and bearerToken are provided.

### Supported Client Tag Keys for Reporting

If you plan for the Engine team to set up reporting (i.e., you do not plan to hit the Analytics API), these are the only keys that are currently fully supported. If a different key is needed, please reach out to your partner manager—we may be able to accommodate, but adding nonstandard keys will increase the time it takes Engine to report Client Tag values back to you and is therefore not recommended.

* agentId
* campaignId
* clientId
* deviceid
* medium
* sourceId
* subid
* subid1
* subid2
* subid3
* target
* trafficsource
* userid

See the [GET Lead Client Tags](https://engine.tech/docs/api-reference/#get-lead-client-tags) endpoint for information on attributing lead analytics to your own client tags, if you decide to hit the Analytics API for reporting.

## Prefilling Lead Data

This sections describes how to prefill any user data you already have into your Flutter SDK implementation.

### PrefilledData Example

Here is a full code snippet of how you might implement the Flutter SDK into your app, with all `prefilledData` fields populated:

```dart
EngineSDK(
 bearerToken: '{your_token}', 
 channel: '{your_channel}', 
 zone: '{your_zone}', 
 experience: '{your_experience}', 
 prefilledData: LeadPrefillData( 
 firstName: 'Bob', 
 lastName: 'Dylan', 
 email: 'bobdylan@gmail.com', 
 loanAmount: 7500,
 purpose: LoanPurpose.creditCardRefi,
 dateOfBirth: DateTime(1990,1,1), 
 address: const Address( 
 street: '1600 Pennsylvania Avenue', 
 city: 'Washington', 
 state: 'DC', 
 zip: '20500', 
 ),  
 primaryPhone: '2325624852', 
 phoneConsent: true,
 ssn: '512-54-7862', 
 creditRating: CreditRating.good,
 propertyStatus: PropertyStatus.ownWithMortgage,
 educationLevel: EducationLevel.associate,
 employmentStatus: EmploymentStatus.employedFullTime,
 annualIncome: 20000,
 hasDirectDeposit: false,
 bankRoutingNumber: '123456789', 
 bankAccountNumber: '55555555555', 
 payFrequency: 
 PayFrequency.biweekly,
 ), 
 clientTags: const { 
 'sdkVersion': ['0.0.1'],
 'platform': ['flutter'], 
}, 
)
```

The prefilledData object should include any fields you want the user to not have to answer themselves, if you already have that info available. You may prefill as many of these fields as desired.

**Important**: Do not prefill any fields that are empty or otherwise unavailable. If you do not have info for a particular field, omit that field from your prefilledData object.

For example, the following is **incorrect**:

```dart
LeadPrefillData( 
firstName: 'Bob', 
lastName: 'Dylan', 
email: 'bobdylan@gmail.com', 
address: const Address(), 
// Empty Address is prefilled, which prevents the user from submitting complete info 
)
```

This is **correct**:

```dart
LeadPrefillData( 
firstName: 'Bob', 
lastName: 'Dylan', 
email: 'bobdylan@gmail.com', 
// Address is omitted, forcing the user to input their address in the UI 
)
```

### PrefilledData Type Definitions

The data should follow the class/type schema described below in Dart:

```dart
class LeadPrefillData { 
    final String? firstName; 
    final String? lastName; 
    final String? email; 
    final int? loanAmount; // whole numbers only 
    final LoanPurpose? purpose; // enum below 
    final DateTime? dateOfBirth; 
    final Address? address; // class below 
    final String? primaryPhone; // leading 1 is fine, no "+" or "-" chars 
    final String? ssn; // 9 digits with or without hyphens 
    final CreditRating? creditRating; // enum below
    final PropertyStatus? propertyStatus; // enum below 
    final EducationLevel? educationLevel; // enum below 
    final EmploymentStatus? employmentStatus; // enum below 
    final int? annualIncome; // raw integer value (e.g. 20000, 60000) 
    final bool? phoneConsent; 
    final bool? hasDirectDeposit; 
    final String? bankRoutingNumber; // must be exactly 9 digits 
    final String? bankAccountNumber; 
    final PayFrequency? payFrequency; // enum below
```

### Enums/Accepted Values for Certain Fields

Certain fields must use one of the predefined Dart enum values. Here are those values:

```dart
class Address { 
 final String? street; // primary street address 
 final String? apartment; // optional apartment / suite 
 final String? city; 
 final String? state; // must be a valid 2-letter abbreviation 
 final String? zip; 
}

enum LoanPurpose { 
 LoanPurpose.debtConsolidation,
 LoanPurpose.creditCardRefi,
 LoanPurpose.homeImprovement,
 LoanPurpose.wedding,
 LoanPurpose.largePurchases,
 LoanPurpose.studentLoanRefi,
 LoanPurpose.autoPurchase,
 LoanPurpose.baby,
 LoanPurpose.boat,
 LoanPurpose.business,
 LoanPurpose.green,
 LoanPurpose.householdExpenses,
 LoanPurpose.medicalDental,
 LoanPurpose.movingRelocation,
 LoanPurpose.taxes,
 LoanPurpose.vacation,
 LoanPurpose.autoRefinance,
 LoanPurpose.studentLoan,
 LoanPurpose.carRepair,
 LoanPurpose.cosmetic,
 LoanPurpose.emergency,
 LoanPurpose.engagement,
 LoanPurpose.homePurchase,
 LoanPurpose.homeRefi,
 LoanPurpose.lifeEvent,
 LoanPurpose.motorcycle,
 LoanPurpose.rv,
 LoanPurpose.specialOccasion,
 LoanPurpose.other,
 } 

 enum CreditRating { 
  CreditRating.excellent,
  CreditRating.good,
  CreditRating.fair,
  CreditRating.poor,
  CreditRating.limited,
 } 

 enum PropertyStatus { 
   PropertyStatus.ownOutright,
   PropertyStatus.ownWithMortgage,
   PropertyStatus.rent,
 } 

 enum EducationLevel { 
  EducationLevel.highSchool,
  EducationLevel.associate,
  EducationLevel.bachelors,
  EducationLevel.masters,
  EducationLevel.doctorate,
  EducationLevel.stillEnrolled,
 } 

 enum EmploymentStatus { 
  EmploymentStatus.employedFullTime,
  EmploymentStatus.employedPartTime,
  EmploymentStatus.selfEmployed,
  EmploymentStatus.military,
  EmploymentStatus.notEmployed,
  EmploymentStatus.other,
 } 

 enum PayFrequency { 
  PayFrequency.biweekly,
  PayFrequency.monthly,
  PayFrequency.twiceMonthly,
  PayFrequency.weekly,
 }
```

### PrefilledData Sanitization

Prefilled data must align with the type definitions above, and any fields with an accepted-value enum must use a valid enum value. If you prefill user data and any type/value is invalid, that attribute will be stripped and the lead will have to enter it again manually.

## Event Handlers Implementation

{% content-ref url="/pages/Booq3GhyFuTKYQBgQTXj" %}
[Flutter Callbacks Events for Tracking](/developer-center/embeddable-integrations/mobile-sdks/flutter/flutter-callbacks-events-for-tracking.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://even-financial.gitbook.io/developer-center/embeddable-integrations/mobile-sdks/flutter/personal-loans.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
