Explore a full, working code sample of a loan integration with our Application Programming Interface (API). This documentation will outline the basic steps of fetching both a single loan by id or reference number and multiple loans by an account number 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 retrieved.
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/loan/single/{ref} or uat-rest.policypay.io/loan/single/{ref}.
User Credentials
Email: ***
Password: ***
Public Key: ***
Secret Key: ***
URL: /loan/single/{ref}
A response payload will be returned which includes your API endpoints along with a successul 200 code displayed. See Response Codes below for further details.
To fetch a single loan, use a reference id or account_number input.
Variable | Type | Required | Notes |
---|---|---|---|
ref (path) | String | Yes | |
account_number (path) | String | Yes |
Sample ref JSON Response
{
"status": "success",
"message": "string",
"loan": {
"status": "Inactive",
"paymentMethod": "credit card",
"uniqueNumber": "string",
"insuredName": "string",
"email": "string",
"phone": "string",
"ext": "string",
"address1": "string",
"address2": "string",
"city": "string",
"state": "string",
"zip": "string",
"notes": "string",
"amountFinanced": 0,
"agencyId": "string",
"agencyName": "string",
"agentId": "string",
"agentName": "string",
"agentEmail": "string",
"downPayment": 0,
"noOfInstallments": 0,
"payments": [
{
"_id": "string",
"uniqueNumber": "string",
"amount": 0,
"status": "Pending",
"type": "Down Payment",
"toBeChargedAt": "2023-11-29"
}
]
}
}
Sample account_number JSON Response
{
"status": "success",
"message": "string",
"paymentDetails": {
"accountNumber": "string",
"downPaymentDue": {
"date": "2023-11-29",
"amount": 0,
"status": "string",
"paymentId": "string"
},
"programs": [
{
"date": "2023-11-29",
"amount": 0,
"status": "string",
"paymentId": "string"
}
],
"loanId": "string"
}
}
Response Codes
Code | Description |
---|---|
200 | Loan retrieved successfully |
400 | Failed to create loan |
422 | Unprocessable entry |
500 | Internal server error |