How to Add Paystub in Check

How to Add Paystub in Check

The ZilMoney OCW platform provides comprehensive paystub integration through the voucher system. Here's the complete implementation guide:

1. Create Paystub/Voucher for Check

Use the voucher endpoint to add detailed paystub information to checks:

POST /api/v3/checks/{checkId}/voucher

2. Payload Parameters

Main Voucher Fields:

Parameter 
Type 
Required 
Description 
`date`String (YYYY-MM-DD)
Optional
Voucher date. Defaults to current date
`memo`
String 
Optional 
Description/notes for the voucher 
`voucherNumber`
String 
**Required** 
Unique voucher identifier 
`voucherItems`
Array 
**Required** 
Array of line items for the paystub 

Voucher Item Fields:

Parameter 
Type Required Description 
`invoiceNumber` String OptionalReference invoice number 
`name` String **Required** Name of the item/service 
`description` String Optional Detailed description 
`quantity` Integer **Required** Number of units 
`unitCost` 
Decimal 
**Required** 
Cost per unit 
`total` 
Decimal 
**Required** 
Line item total (quantity × unitCost) 


3. Retrieve Paystub/Voucher

Get existing voucher data for a check:

GET /api/v3/checks/{checkId}/voucher

Sample Response

json
{
    "success": true,
    "data": {
        "voucher_info": {
            "id": 123,
            "voucher_number": "PAY-2024-001",
            "voucher_date": "2024-01-15",
            "total_amount": 5100.00,
            "memo": "Employee Payroll - January 2024",
            "payee_id": 456,
            "cheque_id": 789
        },
        "voucher_items": [
            {
                "id": 1,
                "product_name": "Base Salary",
                "product_description": "Monthly base salary payment",
                "quantity": 1,
                "unit_cost": 4000.00,
                "total_amount": 4000.00,
                "invoice_number": "INV-001"
            },
            {
                "id": 2,
                "product_name": "Overtime Pay",
                "product_description": "Overtime hours compensation",
                "quantity": 8,
                "unit_cost": 75.00,
                "total_amount": 600.00,
                "invoice_number": "INV-002"
            }
        ]
    }
}

4. Update Paystub/Voucher

Modify existing voucher data:

PUT /api/v3/checks/{checkId}/voucher

5. Delete Paystub/Voucher

Remove voucher data from a check:

DELETE /api/v3/checks/{checkId}/voucher

6. Implementation Details

Error CodeDescription
`404`Check not found
`422`
Voucher already exists for check
`422`
Validation errors in payload
`-1`
Check not found (internal code)
`-2`
Voucher already exists or not found (internal code)