Integrating the Mobile SDK for Android into your app

The Prosper Borrower SDK is a native SDK that allows your users to apply for a loan within your app in a seamless and convenient way.

With the Prosper Borrower SDK, you can refer your users to receive loan offers through Prosper. After receiving the loan offers, the customer can select an offer, create a Prosper account, and complete a loan application immediately. After the loan application has been completed, Prosper initiates loan verification and generates a loan listing for funding by investors.

Prosper Borrower SDK requirements

The Prosper Borrower SDK supports Android 3.0 API level 11 and higher versions.

The SDK uses the Google Places service to auto-complete addresses when your user starts entering information. If you would like to use this time-saving functionality, you’ll need to get a Google Places API key for your app here:

https://developers.google.com/places/

This release contains the following:

  • ProsperBorrowerSDK – The library containing the ProsperBorrowerSDK distribution that you can integrate into your app.
  • ProsperBorrowerSDKSample – A sample app that demonstrates how to invoke the Prosper Borrower SDK from an app to get loan offers and apply for a loan.

Before you get started…

There are just a couple of things you need to do before you can go live with the Prosper Borrower SDK. It’s not much, but it’ll make your experience easier.

  1. Get client keys from Prosper.
    These are available for approved partners only. To become a Prosper partner, just contact us at [email protected] to apply and request keys for testing the SDK with your app.

    After approval, we’ll reply with the following keys that you will need when integrating and testing the SDK with your app. The keys work on both the Android and iOS versions of the Prosper Borrower SDK.

    • Client_Id
    • Client_Secret
    • Ref_AC
    • Ref_MC

    The first two keys are tied to your app when making API calls. They are used to authenticate your app.
    The last two keys associate your app as the referring partner when we generate a loan listing. Without these keys, you will not be able to integrate. We’ll show you where to set them a little later in this guide.

  2. Follow the instructions for installing and integrating the SDK in this guide.
  3.  

  4. Test your integration on the Prosper Sandbox environment.

    The keys you received in step 1 work on the Prosper Sandbox environment. All of your initial testing will happen on our Sandbox environment, which is a mirror of our Production environment.

    Once you have gotten everything to work end to end, send us another email ([email protected]) with a request for Production keys to go live! This new set of keys will be configured to work on the Prosper Production environment. Again, these keys will work for both the Android and iOS versions of the Prosper Borrower SDK.

  5. Update your new Production keys in the SDK settings to go live on the Production environment.

SDK User Flows

User flow one: Prosper Borrower SDK displays loan offers after collecting user info

The diagram below shows the flow between your app and the Prosper Borrower SDK throughout the loan offer and application process. In this flow, your app does not collect the user information required to generate loan offers through Prosper. Instead, your app launches the Borrower SDK, leaving user information collection and loan offer display and selection to the Prosper Borrower SDK.

Note: in this flow, you may have some information about the user that you can send to Prosper, but you may not have all required information to generate offers and display them within your app.

User flow one: Prosper Borrower SDK displays loan offers after collecting user info

User flow two: Your app collects user information and displays loan offers

The diagram below shows the flow between your app and the Prosper Borrower SDK throughout the loan offer and application process. In this flow, your app collects user information required to generate loan offers through Prosper. You pass this user information to the Prosper Borrower SDK. Prosper generates a list of personalized loan offers you can present to the user. You then launch the Borrower SDK when the user selects from the list of personalized loan offers.

User flow two: Your app collects user information and displays loan offers

Consumer experience in your app with the Prosper SDK

The following screenshots show the flow of the Prosper Borrower SDK on Android. The first image represents an app displaying a list of personalized loan offers to a customer. Once the customer selects a loan offer, your app launches the Prosper Borrower SDK, allowing the customer to complete the loan application.

Prosper Borrower SDK for Android Screenshots


Installing the Prosper Borrower SDK and configuring your project

To include the Prosper Borrower SDK in your project:

  1. Download the ProsperBorrowerAndroidSDK library from https://github.com/prosperllc/Prosper-Android-SDK, unzip and place the “prosper” directory in your local Maven repository in the file system path at $HOME/.m2/com/ repository.

    If you don’t already have a local maven repository, you can create a new .m2 repository and place the “prosper” directory within the .m2/com/ directory.

  2. Modify your project’s build.gradle file to include local Maven repositories by adding the following lines:
       repositories {     
         mavenLocal()
       }
    
  3. Add client keys provided by Prosper to your app’s build.gradle file.

    When invoked, the Prosper Borrower SDK will use these keys to authenticate your client. These keys also associate your client as the referring partner when we generate a loan listing.

    • Client_Id
    • Client_Secret
    • Ref_AC
    • Ref_MC

    Note: Optionally, you can add your Google Places key if you want the Prosper Borrower SDK to auto-complete addresses that users enter to speed data entry. You can get a Google Places API key here – https://developers.google.com/places/

       android {
       compileSdkVersion 23
       buildToolsVersion "23.0.1"
        
       defaultConfig {
         applicationId "com.prosper.prosperborrowersdksample"
         minSdkVersion 11
         targetSdkVersion 23
           /* Add your values here */
            buildConfigField "String", "PROSPER_CLIENT_ID", "\"obtainedFromPropser\""
            buildConfigField "String", "PROSPER_CLIENT_SECRET", "\"obtainedFromProsper\""
            buildConfigField "String", "PROSPER_REF_AC", "\"obtainedFromProsper\""
            buildConfigField "String", "PROSPER_REF_MC", "\"obtainedFromProsper\""
           /* Add your Google Places API credentials. Assists in auto-complete 
              when users enter a street address. */
           resValue "string", "google_api_name", "com.google.android.geo.API_KEY"
           resValue "string", "google_api_key", "\"obtainedFromGoogle\""
         } 
       }  
    
  4. Add the following dependencies to your project’s build.gradle file:
      dependencies { 
         compile (name: 'com.prosper.widget:borrowerwidget:[email protected]') {        
         transitive = true;     
        }  
     }   
     
  5. Add required Prosper Borrower SDK permissions within your manifest file:
       <uses-permission android:name="android.permission.INTERNET" />
       <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     
  6. Define the ProsperActivity class in your manifest file:
       <activity android:name="com.prosper.widget.ui.ProsperActivity" android:label="Prosper" android:theme="@style/Prosper.AppTheme" tools:replace="theme" />
    
  7. Add the Prosper.AppTheme to your style.xml file:
      <style name = "Prosper.AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
         <item name="colorPrimary">@color/prosperPrimaryColor</item>   
         <item name="colorPrimaryDark">@color/prosperPrimaryColorDark</item>
         <item name="colorAccent">@color/prosperAccentColor</item>
         <item name="android.windowContentOverlay">@null</item>
      </style>
     
  8. Perform a gradle sync in your project to pick up your gradle.build file updates.

Configure ProGuard for Prosper Borrower SDK files

If you are using the ProGuard tool for optimization and obfuscation of your project, you must update the ProGuard configuration with rules to ensure Prosper Borrower SDK classes are handled correctly.

Add the following lines to your ProGuard configuration:

 -keep class com.prosper.androidsdk.external.** { *; } 
 -keep class retrofit.** { *; }
 -keep class com.squareup.okhttp.** { *; }
 -keep interface com.squareup.okhttp.** { *; }
 
 -dontwarn okio.** 
 -dontwarn retrofit.** 
 -dontwarn com.adobe.**

Configure your Prosper Client_Id and Client_Secret

When you became a registered referral partner with Prosper, you should have received a client id and client secret in your welcome email. You should have also received two other codes from Prosper (Ref_AC and Ref_MC) that represent partner referral identity when a loan listing is generated.

The Prosper Borrower SDK contains an SDK configuration file named ProsperConfig.java. You must set your Client_Id, Client_Secret, and partner referral codes within this configuration file.

When launched, the Prosper Borrower SDK will use the settings in this configuration file to authenticate your client. These settings also associate your client as the referring partner when we generate a loan listing.

ProsperConfig.CLIENT_ID_PROVIDED = BuildConfig.PROSPER_CLIENT_ID;
ProsperConfig.CLIENT_SECRET_PROVIDED = BuildConfig.PROSPER_CLIENT_SECRET;
ProsperConfig.REF_AC = BuildConfig.PROSPER_REF_AC;
ProsperConfig.REF_MC = BuildConfig.PROSPER_REF_MC;

Initialize the Prosper Borrower SDK

Initialize the Prosper Borrower SDK in your Application.OnCreate() method.

    ProsperConfig.init(getApplicationContext(), new ProsperConfig.InitCallback() {         
            @Override
            public void success() {
               Log.d(TAG, "init success");             
            }              

            @Override
            public void failure(String errorMessage) {
               Log.d(TAG, "init failure");
            }
        });

Collecting user details for loan offers

To generate personalized loan offers for a user, Prosper requires 12 pieces of information about the loan applicant.

We’ll show you how to send this information to the SDK a bit later, but this list can help you decide whether you want to collect this information from your app, or let the SDK collect the information. Even if you have a small subset of this information, it may help to pass it to the SDK to speed the loan application process.

User info required to generate loan offers:

  • Loan Amount
  • Loan Purpose
  • First Name
  • Last Name
  • Date Of Birth (DOB)
  • Email
  • Street Address
  • City
  • State
  • Zip code
  • Employment Status
  • Annual Income

To speed up the creation of a loan listing, Prosper can also accept additional information about the loan applicant:

  • Primary phone number
  • Secondary phone number
  • Employer name
  • Employer phone number
  • Work phone number
  • Employer start date
  • Occupation type
  • Social security number
  • Bank account number
  • Bank routing number

Select the user flow that best matches your development needs.

There are two user flows to choose from, described previously:

  • Prosper Borrower SDK displays loan offers after collecting borrower info – You either cannot or do not want to collect the 12 required pieces of information from users within your app. You are OK with relinquishing control to the Prosper Borrower SDK for collecting this information, and displaying the personalized loan offers to the user.

    In this case, you will initialize the Prosper Borrower SDK, calling the static method ProsperIntent.getCollectUserInfoIntent(context) . The Prosper Borrower SDK takes care of the rest.

    Note: If your app has collected a subset of the 12 required fields (or additional fields), you can pass them to the SDK, and the SDK will collect any missing information.

  • Your app collects user information and displays loan offers – You may want to have tight control over how (and how many) loan offers are presented to your users. Prosper provides the ProspectOffersService API to get a list of personalized loan offers you can present to your users.

    In this case, you will collect the information above, construct a PMIBorrowerInfo object with this information, and pass the object in a call to the ProspectOffersService API. You can then display one or more personalized loan offers returned by the API within your app. When a user selects the offer, you will launch the SDK with that selected loan offer. The Prosper Borrower SDK will take care of the rest.


Prosper Borrower SDK displays loan offers after collecting user info

If you cannot or do not want to collect the 12 pieces of user information to generate loan offers, you can launch the Borrower SDK, allowing Prosper to collect this information and present the loan offers to the user.

Passing no user information fields

The following example shows the first case, where you are passing no borrower info fields to the SDK.

Just invoke the Prosper Borrower SDK registering an intent, passing a null value for borrowerInfo, and 0 for the userSelectedOffer.

Intent prosperIntent = ProsperIntent.getCollectUserInfoIntent(MainActivity.this);
startActivityForResult(prosperIntent, ProsperActivity.LOAN_APPLICATION_REQUEST);

The Prosper Borrower SDK will then take control, guiding the user through several screens, collecting the 12 pieces of information, requesting that the user create a Prosper account, and presenting a set of pre-approved personalized loan offers the user can select from.

Passing some user information fields
In the case where you are passing some of the 12 user info fields (and possibly some additional fields), you will initialize the SDK passing a PMIBorrowerInfo object to the getPartialUserInfoProvidedIntent intent.

Once you collect this information from your user, you construct a PMIBorrowerInfo object for the loan applicant.

PMIBorrowerInfo borrowerInfo = new PMIBorrowerInfo.PMIBorrowerBuilder()
   // Full object with required 12 fields shown. 
   // In your case, only some of the required user info fields collected
   .setLoanAmount(35000)
   .setLoanPurpose(ProsperConfig.LoanPurpose.HOME_IMPROVEMENT)
   .setEmploymentStatusId(ProsperConfig.EmploymentStatusId.EMPLOYED)
   .setAnnualIncome(75000)
   .setEmail("[email protected]")
   .setFirstName("Carolyn")
   .setLastName("Brace")
   .setAddress1("3039 CANAL WALK RD")
   .setCity("HENDERSON")
   .setState("NV")
   .setZip("89052")
   .setDateOfBirth("01/01/1979")

   // You can also add ten additional pieces of information to the PMIBorrowerInfo object
   .setPrimaryPhone("4085550175")
   .setSecondaryPhone("4085550235")
   .setEmployerName("ACME") 
   .setEmployerPhone("4085550199")
   .setWorkPhone("4085550100")
   .setEmploymentStart("04/2010")
   .setOccupation(ProsperConfig.Occupation.PILOT_PRIVATE_OR_COMMERCIAL)
   .setSsn("666720553")
   .setAccountNumber("32423435345435")
   .setRoutingNumber("121000248")
   
   // Build the object
   .build();

Note: For a full list of values that can be entered for LoanPurpose and EmploymentStatus and Occupation, refer to the ProsperConfig.java file bundled with the Prosper Borrower SDK.

Next you pass the PMIBorrowerInfo object to the getPartialUserInfoProvidedIntent intent:

Intent prosperIntent = ProsperIntent.getPartialUserInfoProvidedIntent(MainActivity.this, borrowerInfo);
startActivityForResult(prosperIntent, ProsperActivity.LOAN_APPLICATION_REQUEST);

User selects and completes the loan offer

Pre-approved loan offers generated by the Prosper Borrower SDK require user consent and user acceptance of the Prosper Marketplace Terms and Conditions for the loan to become an active listing for funding.

Once the loan offer is selected, the Prosper Borrower SDK guides the user through the process, displaying Prosper Marketplace Terms and Conditions and requiring consent and acceptance as part of the user experience.


Your app collects user information and displays loan offers

The Prosper Borrower SDK provides an API to get a list of personalized loan offers for your users. Getting a list of loan offers is a two-step process.

Step 1: Collect loan applicant information

To generate the loan offers, Prosper requires 12 pieces of user information about the loan applicant:

User info required to generate loan offers:

  • Loan Amount
  • Loan Purpose
  • First Name
  • Last Name
  • Date Of Birth (DOB)
  • Email
  • Street Address
  • City
  • State
  • Zip code
  • Employment Status
  • Annual Income

To speed up the creation of a loan listing, Prosper can also accept additional information about the loan applicant:

  • Primary phone number
  • Secondary phone number
  • Employer name
  • Employer phone number
  • Work phone number
  • Employer start date
  • Occupation type
  • Social security number
  • Bank account number
  • Bank routing number

Once you collect this information from your user, you construct a PMIBorrowerInfo object for the loan applicant.

PMIBorrowerInfo borrowerInfo = new PMIBorrowerInfo.PMIBorrowerBuilder()
   // Full object with required 12 fields shown.
   .setLoanAmount(35000)
   .setLoanPurpose(ProsperConfig.LoanPurpose.HOME_IMPROVEMENT)
   .setEmploymentStatusId(ProsperConfig.EmploymentStatusId.EMPLOYED)
   .setAnnualIncome(75000)
   .setEmail("[email protected]")
   .setFirstName("Carolyn")
   .setLastName("Brace")
   .setAddress1("3039 CANAL WALK RD")
   .setCity("HENDERSON")
   .setState("NV")
   .setZip("89052")
   .setDateOfBirth("01/01/1979")
   
   // You can also add ten additional pieces of information to the PMIBorrowerInfo object
   .setPrimaryPhone("4085550175")
   .setSecondaryPhone("4085550235")
   .setEmployerName("ACME") 
   .setEmployerPhone("4085550199")
   .setWorkPhone("4085550100")
   .setEmploymentStart("04/2010")
   .setOccupation(ProsperConfig.Occupation.PILOT_PRIVATE_OR_COMMERCIAL)
   .setSsn("666720553")
   .setAccountNumber("32423435345435")
   .setRoutingNumber("121000248")
   
   // Build the object
   .build();

Note: For a full list of values that can be entered for LoanPurpose, EmploymentStatus and Occupation, refer to the ProsperConfig.java file bundled with the Prosper Borrower SDK.

Step 2: Call the ProspectOffersService to get loan offers

ProspectOffersService.getInstance().getOffers(borrowerInfo, new ProsperConfig.OffersCallback() {
        @Override
        public void success(PMIListedOffers offers) {
        Log.d(TAG, "Got offers");

        @Override
        public void failure(String s) {
        Log.d(TAG, "Failed to get offers");
      }

       });
  }

OffersCallback returns an Offers list array of offers. The list contains different loan offers that the user has been pre-approved for. These offers range between different interest, APRs and terms. It is up to your development team to determine the offers you want displayed to the user.

To access a particular offer by index, you can do something like this in the OffersCallback success:

 @Override
    public void success(PMIListedOffers offers) {
        Log.d(TAG, "Got offers");

        // choose the first offer
        PMIOffer offer = offers.getOffers().get(0);
        int userSelectedOffer = offer.getLoanOfferId();
    }

Invoke the Prosper Borrower SDK and complete the loan offer

Pre-approved loan offers generated by the Prosper Borrower SDK require user consent and user acceptance of the Prosper Marketplace Terms and Conditions for the loan to become an active listing for funding.

The Prosper Borrower SDK guides the user through the process, displaying Prosper Marketplace Terms and Conditions and requiring consent and acceptance as part of the user experience. You can invoke the Prosper Borrower SDK when a user selects an offer by registering an intent:

// start the Prosper SDK with this offer
Intent prosperIntent = ProsperIntent.getUserInfoProvidedIntent(MainActivity.this, borrowerInfo, userSelectedOffer);
startActivityForResult(prosperIntent, ProsperActivity.LOAN_APPLICATION_REQUEST);

In the above intent, the userSelectedOffer is the LoanOfferId, which is the loan offer your user selects from the loan offers list.


Activity result codes

The ProsperActivity will return the following result codes:

Code Description
Activity.RESULT_OK The user successfully completed the loan application process with Prosper.
Activity.RESULT_CANCELLED The user cancelled the loan application process.
ProsperActivity.RESULT_TIMED_OUT The user session timed out due to inactivity.

Sample app

A sample app can be found in the ProsperBorrowerSDKSample directory. The sample app demonstrates how you can integrate the Prosper Borrower SDK into your own app.

You can use the instructions within this guide to see how the SDK works. Remember to request app keys before trying out the sample app. You’ll need them to run the sample app.


Contact us

Do you have any questions, comments for us, or problems integrating the Prosper Borrower SDK into your app?

Contact us at [email protected]