Explore a full, working code sample of a loan integration with our Application Programming Interface (API). This documentation will outline the basic steps of creating a loan from the policyPay system. With your program set up in our production environment, it will be ready for live testing. When successful testing is completed, real loans can be created.
Once you submit to the API, you can see the accounts in the UI at policypay.io by logging in with your given credentials.
We recommend using Postman for all of our API routes. Download our Postman collection using the link below: Download Postman Collection. Our respective Production and Sandbox URLs are the following: rest.policypay.io or uat-rest.policypay.io.
User Credentials
Email: ***
Password: ***
Public Key: ***
Secret Key: ***
API Endpoint Definitions
Your API endpoint definitions will vary and be custom for your specific needs. The following is an example.
Variable | Type | Required | Notes |
---|---|---|---|
programId | String | Yes | ******* |
insuredName | String | Yes | Name of Business on Policy |
String | Yes | Email of Applicant | |
phone | String | Yes | Phone of Applicant |
address1 | String | Yes | Mailing Address of Applicant |
address2 | String | Yes | Mailing Address of Applicant |
city | String | Yes | Mailing City of Applicant |
state | String | Yes | Mailing City of Applicant |
zip | String | Yes | Mailing Zip of Applicant |
notes | String | Yes | Pass blank string or you may add notes |
amountFinanced | Number | Yes | Amount the loan will be created for |
finProAgency | Object | Yes | Retail Agency on account |
finProAgency.searchCode | String | Yes | The Retail Agency's predefined code. ins123 for testing |
finProAgency.name | String | Yes | Not required if passing the search code |
finProAgency.phone | String | Yes | Not required if passing the search code |
finProAgency.email | String | Yes | Not required if passing the search code |
finProAgency.address1 | String | Yes | Not required if passing the search code |
finProAgency.address2 | String | Yes | Not required if passing the search code |
finProAgency.city | String | Yes | Not required if passing the search code |
finProAgency.state | String | Yes | Not required if passing the search code |
finProAgency.zip | String | Yes | Not required if passing the search code |
policies | Array | Yes | This is an array of policy objects |
policyEffDate | Date | Yes | Policy Effective date |
policyNo | String | Yes | Policy Number TBD is okay |
coverageType | String | Yes | Pulled form a list; Use General Liability for now |
premium | Number | Yes | Amount of total premium |
fees | Number | Yes | Amount of Policy Fees |
taxes | Number | Yes | Amount of Policy Taxes |
brokerFee | Number | Yes | Amount of Broker Fee |
inspectionFee | Number | Yes | Amount of Inspection Fee |
generalAgency | Object | Yes | General Agency on Policy |
generalAgency.searchCode | String | Yes | The General Agency’s predefined code; GA123 for testing |
generalAgency.name | String | Yes | Not required if passing the search code |
generalAgency.phone | String | Yes | Not required if passing the search code |
generalAgency.email | String | Yes | Not required if passing the search code |
generalAgency.address1 | String | Yes | Not required if passing the search code |
generalAgency.address2 | String | Yes | Not required if passing the search code |
generalAgency.city | String | Yes | Not required if passing the search code |
generalAgency.state | String | Yes | Not required if passing the search code |
generalAgency.zip | String | Yes | Not required if passing the search code |
broker | Object | No | The Broker that may be added; a double broker scenario; OPTIONAL |
broker.searchCode | String | No | Search code provided by policyPay; No Test code is provided |
broker.name | String | No | Not required if passing the search code |
broker.phone | String | No | Not required if passing the search code |
broker.email | String | No | Not required if passing the search code |
broker.address1 | String | No | Not required if passing the search code |
broker.address2 | String | No | Not required if passing the search code |
broker.city | String | No | Not required if passing the search code |
broker.state | String | No | Not required if passing the search code |
broker.state | String | No | Not required if passing the search code |
broker.zip | String | No | Not required if passing the search code |
Congratulations! You have successfully created your loan.
Sample JSON Payload
Your unique programId is required.
{
"insuredName": "Test Create from API",
"email": "[email protected]",
"phone": "6192061433",
"address1": "2445 Brant St",
"address2": "",
"city": "San Diego",
"state": "CA",
"zip": "92101",
"notes": "",
"programId": "6509e78e84338864075ff5a3",
"amountFinanced": "750.00",
"finProAgency": {
"searchCode": "test123",
"name": "",
"phone": "",
"email": "",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": ""
},
"policies": [
{
"policyEffDate": "2023-10-02",
"policyNo": "TBD",
"coverageType": "General Liability",
"premium": "1000",
"fees": "150",
"taxes": "50",
"brokerFee": "500",
"inspectionFee": "100",
"insuranceCompany": {
"searchCode": "INS123",
"name": "",
"phone": "",
"email": "",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": ""
},
"generalAgency": {
"searchCode": "GA123",
"name": "",
"phone": "",
"email": "",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": ""
},
"broker": {
"searchCode": "",
"name": "",
"phone": "",
"email": "",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": ""
}
}
]
}
Sample JSON Response
{
"status": "success",
"message": "Loan created successfully",
"loan": {
"_id": "67b5888b61f2c7a8db38e60d",
"insuredName": "Test Create from API",
"email": "[email protected]",
"uniqueNumber": "0NVwwvqvoB9wOEsR",
"phone": "6192061433",
"ext": null,
"address1": "2445 Brant St",
"address2": "",
"city": "San Diego",
"state": "CA",
"zip": "92101",
"notes": "",
"programId": "6509e78e84338864075ff5a3",
"amountFinanced": 750,
"paymentMethod": "credit card",
"status": "Inactive",
"agencyId": "654adfd15811236150aa520b",
"agencyName": "PPay TEST AGENCY",
"agentName": "Demo User",
"agentEmail": "[email protected]",
"downPayment": 1050,
"noOfInstallments": 9,
"document": "https://secure.financepro.net/financepro/quote/FinanceAgreement.aspx?auto=FC1oAiZe0UlzsYcFrkoAWvHI0Le7ZI8+v5KWNkyQnLALaWAJMu2CtTCpE82Hcr/pYP1/6oyUigg=",
"payments": [
{
"_id": "67b5888f61f2c7a8db38e611",
"uniqueNumber": "5NC5B79ad2GWC4zT",
"toBeChargedAt": "2023-10-02T00:00:00.000Z",
"amount": 1050,
"status": "Pending",
"type": "Down Payment"
}
],
"policies": [
{
"_id": "67b5888f61f2c7a8db38e610",
"policyEffDate": "2023-10-02T00:00:00.000Z",
"policyNo": "TBD",
"coverageType": "General Liability",
"premium": 1000,
"fees": 150,
"taxes": 50,
"brokerFee": 500,
"inspectionFee": 100,
"insuranceCompany": {
"searchCode": "INS123",
"name": "",
"phone": "",
"email": "",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": ""
},
"generalAgency": {
"searchCode": "GA123",
"name": "",
"phone": "",
"email": "",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": ""
},
"broker": {
"searchCode": "",
"name": "",
"phone": "",
"email": "",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": ""
},
"amountFinanced": 1800,
"expirationDate": "2024-10-02T00:00:00.000Z"
}
]
}
}
Response Codes
Code | Description |
---|---|
200 | Loan created successfully |
400 | Failed to create loan |
422 | Unprocessable entry |
500 | Internal server error |