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 with refresh payments 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.
You can see all the available REST methods via our Swagger at rest.policypay.io or uat-rest.policypay.io
User Credentials
Email: ***
Password: ***
Public Key: ***
Secret Key: ***
Swagger API Endpoint Definitions
Once logged in with your given credentials, navigate to /loans /refresh-loan/create.
Selecting Try it out will bring up the request body for your API endpoint definitions. Once filled in completely, selecting Execute will run the API.
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.
Your API endpoint definitions will vary and be custom for your specific needs. The following is an example.
Variable | Type | Required | Notes |
---|---|---|---|
loanId | String | Yes | ******* |
paymentId | String | Yes | Id of payment |
amount | String | Yes | Loan amount |
paymentMethod | String | Yes | Method of payment |
nameOnCard | String | Yes | Name of applicant on credit card |
expiry | String | Yes | Expiration date of card |
cvv | String | Yes | CVV code |
accHolder | String | Yes | Holder of account |
bankAccount | String | Yes | Bank account number |
routingNumber | String | Yes | Routing account number |
bankName | String | Yes | Name of bank |
accountType | String | Yes | Type of bank account |
checkNo | String | Yes | Checking number |
Postman API Link
An alternate way of using our API is with your given Postman link. The link will take you to your already configured endpoint for you to fill out. In the Body section on Postman, you will find your configured endpoints. Once filled, selecting Send will execute the API call.
Congratulations! You have successfully created your loan.
Sample JSON Payload
Your unique loanId is required.
{
"loanId": "string",
"paymentId": "string",
"amount": 0,
"paymentMethod": "credit card",
"nameOnCard": "string",
"cardNumber": "string",
"expiry": "string",
"cvv": "string",
"accHolder": "string",
"bankAccount": "string",
"routingNumber": "string",
"bankName": "string",
"accountType": "checking",
"checkNo": "string"
}
Sample 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"
}
]
}
}
Response Codes
Code | Description |
---|---|
200 | Loan created successfully |
400 | Failed to create loan |
422 | Unprocessable entry |
500 | Internal server error |