preloader

Create a Payment

Explore a full, working code sample of a Payment integration with our Application Programming Interface (API). This documentation will outline the basic steps of creating an order or subscription depending upon program configuration. It will charge the order immediately if set to do so in the payment program. With your program set up in our production environment, it will be ready for live testing. When successful testing is completed, real Payments 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
accountNumber Number Yes *******
uniqueNumber String Yes
itemName String Yes
orig_amount Number Yes
name String Yes
address1 String Yes
address2 String Yes
city String Yes
state String Yes
zip String Yes
email String Yes
phone String Yes
programId String Yes
paymentMethod String Yes
nameOnCard String Yes
cardNumber String Yes
expiry String Yes
cvv String Yes
accHolder String Yes
bankAccount String Yes
routingNumber String Yes
bankName String Yes
accountType String Yes
checkNo String Yes
abbr String Yes
extra Object Yes
createLoan Boolean Yes
restLoanPayload Object Yes
autoPay Boolean Yes
installmentDueDate String Yes
finProAgency Object Yes
searchCode String Yes
name String Yes
phone String Yes
email String Yes
address1 String Yes
address2 String Yes
city String Yes
state String Yes
zip String Yes
policies Array Yes
policyEffDate String Yes
policyNo String Yes
coverageType String Yes
premium Number Yes
fees Number Yes
taxes Number Yes
brokerFee Number Yes
inspectionFee Number Yes
insuranceCompany.searchCode String Yes
insuranceCompany.name String Yes
insuranceCompany.phone String Yes
insuranceCompany.email String Yes
insuranceCompany.address1 String Yes
insuranceCompany.address2 String Yes
insuranceCompany.city String Yes
insuranceCompany.state String Yes
insuranceCompany.zip String Yes
generalAgency Object Yes
searchCode String Yes
name String Yes
phone String Yes
phone String Yes
email String Yes
address1 String Yes
address2 String Yes
city String Yes
state String Yes
zip String Yes
broker Object Yes
searchCode String Yes
name String Yes
phone String Yes
phone String Yes
email String Yes
address1 String Yes
address2 String Yes
city String Yes
state String Yes
zip String Yes

Congratulations! You have successfully created your payment.


Sample JSON Payload ACH


{
  "uniqueNumber": "",
  "itemName": "This is a test Payment for insurance",
  "orig_amount": 150.22,
  "name": "Sample Insured",
  "address1": "1234 Main St",
  "address2": "Suite 2C",
  "city": "San Diego",
  "state": "CA",
  "zip": "92101",
  "email": "[email protected]",
  "phone": "6192221111",
  "programId": "5ee9af4f34411d39a9d9c064",
  "paymentMethod": "check/ach",
  "accHolder": "Namaste Derek",
  "bankAccount": "000123456789",
  "routingNumber": "121000358",
  "bankName": "Bank Of America",
  "accountType": "checking",
  "checkNo": "12345",
  "extra": {},
  "createLoan": false
 }

Sample JSON Response ACH


{
    "status": "success",
    "message": "Order created Successfully",
    "order": {
        "_id": "67b5890061f2c7a8db38e618",
        "status": "Paid",
        "paymentMethod": "check/ach",
        "uniqueNumber": "FA7OW2ADTNYQXE0Q",
        "amount": "151.72",
        "fee": "1.5",
        "orig_amount": "150.22",
        "billingInfo": {
            "name": "Sample Insured",
            "phone": "6192221111",
            "email": "[email protected]",
            "address1": "1234 Main St",
            "address2": "1234 Main St",
            "zip": "92101",
            "city": "San Diego",
            "state": "CA"
        },
        "itemInfo": {
            "name": "This is a test Payment for insurance",
            "price": "150.22"
        },
        "extra": {
            "process_date": "2025-02-19T07:32:16.908Z",
            "invoiceDocument": "http://files.pdfdoc.io/2025/2/67b58901c741b9da33965e13.pdf",
            "digitallySigned": ""
        }
    },
    "errors": [],
    "error": null
}


Sample JSON Payload CC


{
  "uniqueNumber": "",
  "itemName": "This is a test Payment for insurance",
  "orig_amount": 150.22,
  "name": "Sample Insured",
  "address1": "1234 Main St",
  "address2": "Suite 2C",
  "city": "San Diego",
  "state": "CA",
  "zip": "92101",
  "email": "[email protected]",
  "phone": "6192221111",
  "programId": "5ee9af4f34411d39a9d9c064",
  "paymentMethod": "credit card",
  "nameOnCard": "Jim Smith",
  "cardNumber": "4111111111111111",
  "expiry": "11/29",
  "cvv": "123",
  "extra": {},
  "createLoan": false
 }

Sample JSON Response CC


{
    "status": "success",
    "message": "Order created Successfully",
    "order": {
        "_id": "67b5896061f2c7a8db38e622",
        "status": "Paid",
        "paymentMethod": "credit card",
        "uniqueNumber": "D15MYH8L867LZOW8",
        "amount": "155.85",
        "fee": "5.63",
        "orig_amount": "150.22",
        "billingInfo": {
            "name": "Sample Insured",
            "phone": "6192221111",
            "email": "[email protected]",
            "address1": "1234 Main St",
            "address2": "1234 Main St",
            "zip": "92101",
            "city": "San Diego",
            "state": "CA"
        },
        "itemInfo": {
            "name": "This is a test Payment for insurance",
            "price": "150.22"
        },
        "extra": {
            "process_date": "2025-02-19T07:33:52.525Z",
            "invoiceDocument": "http://files.pdfdoc.io/2025/2/67b58961c741b9da33965e14.pdf",
            "digitallySigned": ""
        }
    },
    "errors": [],
    "error": null
}

Response Codes


Code Description
200 Payment created successfully
400 Failed to create Payment
422 Unprocessable entry
500 Internal server error