HomeGuidesAPI Reference

If you're looking to add some quick coverage of student loan functionality to your product or platform, but aren't ready to spend the time designing, architecting, and building your own customized borrower experience, Nexus has you covered.

## What you'll need

  • A <<glossary:Nexus Key>>

  • A few lines of JavaScript

Don't have your Nexus Key?

Please contact [[email protected]](🔗) and we'll get that sorted.

## What we'll do

  • Add the Nexus script tag to a page in your site

  • Initialize Nexus to create a borrower record for you without our API

  • Add a click event listener to trigger the Nexus widget

  • Rely on Nexus to link servicers, provide an assessment, and enroll your borrower in an <<glossary:Income-Driven Repayment Plan>>

  • Do something meaningful with the results

# Let's get started

### Add the Nexus `script` tag

You must include the <<glossary:Nexus>> `script` tag in your app's markup. Where you place it in your markup is up to you, of course, but you must ensure it is included and loaded _before_ any event handlers are triggered.

Integration begins in the Payitoff Sandbox

For local development, staging, and testing environments, you'll want to include the **sandbox** version of Nexus.

Payitoff's Sandbox is your development playground—it will never connect to live <<glossary:Servicer>> websites, it won't submit real <<glossary:Enrollment Requests>>, it always returns dummy data where necessary, and you'll use a Sandbox <<glossary:Nexus Key>> that only works in our Sandbox environment.

## Initialize Nexus with your own Borrower IDs

The Nexus experience is unique to each of your borrowers based on their loan portfolios, so it requires a borrower identifier on init. To ease API-free integration, you can provide your own unique `borrower` identifier when initializing Nexus. If we've never seen that borrower before, Nexus will create a new `Borrower` record for you. If we have seen the borrower with your unique external ID before, Nexus will recognize that, find the borrower, and load workflows for their situation.

## Triggering Nexus on a click event

Let's assume we have a button in the page that is meant to trigger opening the Nexus widget:

Given this button-styled `a` tag in your page, let's write a simple `click` handler that can open Nexus, telling Nexus we want our borrower to be enrolled in an <<glossary:Income-Driven Repayment Plan>> of their choosing. To do this, we'll also want to provide an `onSuccess` and `onExit` callback function so we can inspect the response from Nexus when the borrower exits the widget.

## That's it!

When the Nexus widget is dismissed, it will call the `onSuccess` or `onExit` callback functions you provided—`onSuccess` if the borrower _completed_ the requested workflow, or `onExit` if they canceled out and dismissed the widget without completing or some other error occurs.

Ready to learn more about Nexus workflows, callbacks, and responses? Head over to our [Nexus](🔗) pages for all you need to know to better understand how Nexus works, and how you can put it to work in your products and platforms.