Payments Debt Collection Quickstart#
When tenants default on payments, CasaPay connects you with licensed debt collection partners. Preview eligibility and pricing, submit cases, and track progress through our API.
Step 1: Preview a Case#
Before submitting, check eligibility and get pricing:
curl https://api.casapay.com/v1/collection_case_previews \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{
"amount_to_recover": 360000,
"currency": "eur",
"debtor": {
"type": "private",
"name": "John Smith",
"email": "john.smith@example.com",
"country": "DE"
},
"due_date": "2024-11-01"
}'{
"is_eligible": true,
"partner_assignment": {
"partner_id": "cp_partner_de_01",
"partner_name": "CollectMax GmbH",
"partner_country": "DE"
},
"required_actions": [],
"pricing_preview": {
"base_success_fee_pct": 12.5,
"age_surcharge_pct": 2.0,
"total_success_fee_pct": 14.5
}
}Step 2: Submit a Collection Case#
curl https://api.casapay.com/v1/collection_cases \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{
"amount_to_recover": 360000,
"currency": "eur",
"debtor": {
"type": "private",
"name": "John Smith",
"email": "john.smith@example.com",
"phone": "+49 170 1234567",
"address": {
"line1": "Friedrichstraße 123",
"city": "Berlin",
"postal_code": "10117",
"country": "DE"
}
},
"creditor_reference": "INV-2024-0892",
"due_date": "2024-11-01",
"metadata": {
"property_id": "prop_456",
"tenant_id": "ten_789"
}
}'{
"id": "dc_a1b2c3d4",
"object": "collection_case",
"reference": "Q8OAXF3W",
"status": "active",
"amount_to_recover": 360000,
"remainder": 360000,
"currency": "eur",
"debtor": {
"type": "private",
"name": "John Smith",
"country": "DE"
},
"collection_partner": {
"name": "CollectMax GmbH"
},
"created": 1706140800
}Step 3: Upload Supporting Documents#
curl https://api.casapay.com/v1/collection_cases/dc_a1b2c3d4/files \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
-F "file=@invoice.pdf" \
-F "document_type=original_invoice" \
-F "description=Original unpaid invoice INV-2024-0892"Step 4: Track Progress#
Monitor case progress via webhooks and timeline:
app.post('/webhooks/casapay', async (req, res) => {
const event = req.body;
switch (event.type) {
case 'collection_case.updated':
const caseObj = event.data.object;
console.log(`Case ${caseObj.reference}: ${caseObj.status}`);
break;
case 'debt_payment.created':
const payment = event.data.object;
console.log(`Payment received: ${payment.amount / 100} ${payment.currency}`);
break;
case 'collection_case.closed':
const closed = event.data.object;
console.log(`Case closed: ${closed.close_code}`);
break;
}
res.status(200).send();
});# Get case timeline
curl https://api.casapay.com/v1/collection_cases/dc_a1b2c3d4/timeline \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"{
"data": [
{
"date": 1706140800,
"type": "case_created",
"title": "Case submitted",
"description": "Collection case created and assigned to CollectMax GmbH"
},
{
"date": 1706227200,
"type": "demand_letter_sent",
"title": "Demand letter sent",
"description": "First demand letter sent to debtor via registered mail"
}
]
}That's it!
You've submitted a debt collection case. The collection partner will handle communication with the debtor while you track progress through the API.