Documentation

Javascript SDK Integration Guide

Simple steps for the seamless integration

Overview

Welcome to the Financing Widget Javascript SDK Integration Guide. This documentation will guide you through the process of integrating our Financing SDK into your application.

The Financing Javascript SDK comprises two main components:

  1. Financing Javascript SDK: The script must be included in your application to communicate with the Financing Widget.
  2. Financing Widget: The application responsible for processing Financing operations.

Prerequisites

Before you begin the integration, ensure you have the credentials from GrailPay to access the widget for your desired environment (sandbox or production).

Environment Options

The GrailPay Financing Widget supports two environments: sandbox and production. The sandbox environment is ideal for testing and development, allowing you to ensure everything works smoothly before going live. On the other hand, the production environment is used for the live version of your platform, where the actual bank account linking process takes place.

Integration Steps

To integrate the Financing Javascript SDK into your application, follow these simple steps:

Sandbox Environment

Include the following script in your HTML file to use the sandbox environment:

<script type="text/javascript" src="https://financing-sdk-sandbox.grailpay.com/sdk.js"></script>

Production Environment

When you are ready to move to the live environment, switch to the production script URL as follows:

<script type="text/javascript" src="https://financing-sdk.grailpay.com/sdk.js"></script>

Asynchronous Loading (Alternative)

If you prefer to dynamically create the script element after the page has rendered and utilize the onload event for better control over the loading process, you can use the following approach:

const sdk = 'https://financing-sdk-sandbox.grailpay.com/sdk.js';
const script = document.createElement('script');

script.setAttribute('src', sdk);

// Add an onload event listener to handle script loading completion
script.onload = () => {
  // SDK has been successfully loaded, initialize and use it as needed
};

// Append the script element to the head of the document
document.head.appendChild(script);

Usage

To initialize the GrailPay Financing Widget and enable your users to access the Financing functionality seamlessly, you will need to utilize the window.gp__fnc.init(initProps) method. This method allows you to pass the necessary configuration options and will trigger the widget.

Here's a breakdown of the available types and the required parameters for successful initialization:

interface PayeeAccount {
  uuid: string;
  aggregator_type: 'plaid' | ' manual' | 'bank_link';
}

interface InitProps {
  amount: number;
  vendor_token: string;
  payee_uuid: string;
  payer_uuid?: string;
  payee_account?: PayeeAccount;
}


type init = (props: InitProps) => void;

gp__fnc.init({
  vendor_token: 'vendor_token',
  payee_uuid: 'your-payee-uuid',
  payer_uuid: 'business-uuid',
  amount: 100,000,
  payee_account: {
    uuid: 'your-account-uuid',
    aggregator_type: 'manual', // 'plaid', 'bank_link', or 'manual'
  },
});

Initialization Parameters

  • vendor_token: The authentication token for the vendor enables financing capabilities.
  • payee_uuid: The unique identifier for the payee.
  • payer_uuid: The unique identifier for the business that is applying for the loan.
  • amount: The amount for the transaction in cents.
  • payee_account: Optional Information about the payee's account.
    uuid: The UUID of the payee's account.
    aggregator_type: The type of aggregator used.

Troubleshooting

If you encounter issues while integrating or using the GrailPay Financing Widget, try the following:

  • Check the browser console: The browser console may display error messages or warnings that can help you identify and resolve issues.
  • Verify your token and uuid: Ensure that you have provided valid credentials during initialization.
  • Inspect network requests: Use the browser's developer tools to inspect network requests made by the GrailPay API. This can help you identify issues with the API endpoints or data being sent.
  • Ask GrailPay support If the above-mentioned options can't help you, don't hesitate to contact our support team at [email protected]

Standard underwriting requirements:

  • We require a physical address for the business (i.e., no PO boxes)
  • Businesses must be at least one year old (some exceptions allowed)
  • No bankruptcies in the past three years
  • No material tax liens or judgments

Common decline reasons:

  • Limited or no credit bureau history with no other additional data sources
  • Significant active tax lien, judgments, or collection accounts on bureau reports
  • Negative cash flow from operations or negative profitability without explicit access to cash reserves
  • High, growing and/or unsustainable levels of debt or debt service payments
  • History of struggling to pay bills on time

Credit limit policy notes:

There are line policies designed to provide businesses access to working capital financing. Working capital needs arise as a business looks to balance the timing of incoming sales revenue payments months after sales are complete and the purchases of inventory and supplies to perform those sales activities (often months before a sale is complete). Especially as businesses grow, the gap in this timing of cash collection vs. cash requirements can significantly stress their cash position. Financing options are designed to help businesses bridge this gap to generate profitable growth.

Given the objectives of this type of financing, credit lines are determined by a combination of the overall creditworthiness of the business, their proven history of repayment, and sized to meet working capital needs appropriately. This size is typically a function of business revenue, with lending starting as a fraction of monthly revenue and potentially rising to an entire month’s worth of revenue.

This type of financing works best if customers take advantage of it selectively to complement existing working capital within the business. We do not want our borrowers to become addicted to this financing, so it becomes a constant tax on their sales activity. We want to be careful that our borrowers aren’t excessively using this financing to fund other long-term growth efforts with less reliable outcomes. They should use other forms of equity and debt for those activities.