
Security News
TeamPCP and BreachForums Launch $1,000 Contest for Supply Chain Attacks
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.
Official TypeScript/JavaScript client for Payrolla Payroll Calculation Service
Official TypeScript/JavaScript client for the Payrolla Payroll Calculation Service.
npm install payrolla
import { PayrollaClient } from 'payrolla';
// Create client with API key
const client = new PayrollaClient({
apiKey: 'pk_live_xxxxx', // Get from your Payrolla dashboard
});
// Calculate net monthly payroll (Primary TR DSL - Recommended)
const result = await client
.netMonthly(100_000) // Net monthly wage
.forPeriod(2025, 1) // January 2025
.regularDays(26, { name: 'Mesai' })
.overtime(10, 1.5) // 10 hours with 1.5x coefficient
.calculate();
console.log('Total cost:', result.totalcost);
console.log('Net wage:', result.payrolls[0].payrollResult.totalNet);
The client uses API key authentication via the x-api-key header.
const client = new PayrollaClient({
apiKey: 'pk_live_xxxxx', // Get from your Payrolla dashboard
});
All requests automatically go to https://api.payrolla.app and include your API key in the headers.
Payrolla client provides three API surfaces to match your coding style and use case:
Opinionated, concise, Turkey-focused API. Best for most use cases.
// Net monthly wage
await client
.netMonthly(100_000)
.forPeriod(2025, 1)
.calculate();
// Gross daily wage
await client
.grossDaily(3_500)
.forPeriod(2025, 1)
.regularDays(22)
.calculate();
// Net hourly wage
await client
.netHourly(450)
.forPeriod(2025, 1)
.regularHours(160)
.calculate();
More explicit control over all parameters.
await client
.newCalculation()
.setMonthlyWage(100_000, 'Net')
.forPeriod(2025, 1)
.withMinWageExemption(true)
.use30DayMonth()
.calculate();
Direct API access with complete WageCalculationModel.
await client.calculate({
calcDate: '2025-01-01',
wageAmount: 100_000,
cumulativeIncomeTaxBase: 0,
cumulativeMinWageIncomeTaxBase: 0,
ssiType: SSIType.S4A,
wageCalculationType: CalculationType.Net,
wagePeriodType: PaymentPeriodType.Monthly,
periodCount: 1,
periodLengthType: PeriodLengthType.Month,
// ... other fields
});
const result = await client
.netMonthly(100_000)
.forPeriod(2025, 1)
.regularDays(26, { name: 'Mesai', ref: '1' })
.regularDays(5, { name: 'Hafta sonu', ref: '2' })
.extraPayNet(50_000, { name: 'Bonus', ref: '3' })
.calculate();
const result = await client
.grossMonthly(150_000)
.forPeriod(2025, 1)
.withTransferredSSI({ base1: 40000, base2: 200000 })
.calculate();
import { Predefined } from 'payrolla';
const result = await client
.netMonthly(60_000)
.forPeriod(2025, 1)
.socialAid(3_000, Predefined.ChildAid) // Exemptions resolved by date
.calculate();
const result = await client
.netMonthly(100_000)
.forPeriod(2025, 1)
.use30DayMonth() // Use 30-day month instead of calendar days
.calculate();
const builder = client
.netMonthly(100_000)
.forPeriod(2025, 1);
// Validate without executing
const validation = builder.validate();
if (!validation.isValid) {
console.error('Validation errors:', validation.errors);
return;
}
// Execute calculation
const result = await builder.calculate();
// Get the model synchronously without making API call
const model = client
.netMonthly(100_000)
.forPeriod(2025, 1)
.build();
console.log('Model:', model);
// Use the model later or pass it to another function
const client = new PayrollaClient({
apiKey: 'pk_live_xxxxx', // API key (required)
timeout: 60000, // Optional timeout in ms (default: 30000)
});
Enable debug logging for troubleshooting:
# Set environment variable
export PAYROLLA_DEBUG=true
# Or in .env file
PAYROLLA_DEBUG=true
netMonthly(amount) - Start with net monthly wagegrossMonthly(amount) - Start with gross monthly wagenetDaily(amount) - Start with net daily wagegrossDaily(amount) - Start with gross daily wagenetHourly(amount) - Start with net hourly wagegrossHourly(amount) - Start with gross hourly wagenewCalculation() - Start with empty builderforPeriod(year, month) - Set calculation periodwithSSIType(type) - Set SSI type (S4A, S4B, S4C)withMinWageExemption(enabled?) - Enable/disable min wage exemptionwithTransferredSSI({ base1?, base2? }) - Set transferred SSI baseswithDisabilityDiscount(amount) - Set disability discountuse30DayMonth() - Use 30-day monthuseCalendarDayMonth() - Use calendar day monthregularDays(days, opts?) - Add regular payment by daysregularHours(hours, opts?) - Add regular payment by hoursovertime(hours, coeff?, opts?) - Add overtime paymentextraPayNet(amount, opts?) - Add extra net paymentextraPayGross(amount, opts?) - Add extra gross paymentsocialAid(amount, predefined?, opts?) - Add social aidvalidate() - Validate builder state (synchronous)build() - Build WageCalculationModel (synchronous)calculate() - Execute calculation (async)All TypeScript types and enums are exported:
import {
PayrollaClient,
SSIType,
CalculationType,
PaymentPeriodType,
PaymentType,
PaymentDetailType,
MonthDayCount,
Predefined,
WageCalculationModel,
WageResultModel,
// ... and more
} from 'payrolla';
import { ApiError, AuthenticationError, NetworkError } from 'payrolla';
try {
const result = await client
.netMonthly(100_000)
.forPeriod(2025, 1)
.calculate();
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Authentication failed:', error.message);
} else if (error instanceof ApiError) {
console.error('API error:', error.message, error.statusCode);
} else if (error instanceof NetworkError) {
console.error('Network error:', error.message);
} else {
console.error('Unknown error:', error);
}
}
For issues and questions, please visit: https://github.com/runpayrolla/payrolla-node/issues
MIT License - see LICENSE file for details
FAQs
Official TypeScript/JavaScript client for Payrolla Payroll Calculation Service
The npm package payrolla receives a total of 32 weekly downloads. As such, payrolla popularity was classified as not popular.
We found that payrolla demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.

Research
GemStuffer abuses RubyGems as an exfiltration channel, packaging scraped UK council portal data into junk gems published from new accounts.