Vendors
Overview
Vendor webhooks notify your application when vendor records change. Vendors are contributor-type users in Pelcro, typically representing freelancers, writers, or suppliers who receive payments (bills) from the publisher.
Use Cases
- Sync vendor records to your accounting or ERP system
- Track vendor onboarding and offboarding
- Update internal directories when vendor profiles change
- Trigger workflows when new vendors are added
Events
| Event | Description |
|---|---|
vendor.created | A new vendor was created |
vendor.updated | A vendor's profile was updated |
vendor.deleted | A vendor was deleted |
vendor.created
Triggered When
- A new vendor is created via the Core API (
POST /api/core/vendors).
Payload
{
"type": "vendor.created",
"id": "evt_a1b2C3d4E5f6g7H8i9J0k1L2",
"created": 1704067200,
"data": {
"object": {
"object": "vendor",
"id": 12345,
"balance": 0,
"created": "2024-01-01T00:00:00.000000Z",
"currency": null,
"dates": {
"created_at": 1704067200,
"updated_at": 1704067200
},
"default_source_id": null,
"delinquent": false,
"display_name": null,
"email": "[email protected]",
"email_confirm": null,
"email_hardbounce": false,
"first_name": "Jane",
"has_password": 0,
"language": null,
"last_login_method": null,
"last_name": "Doe",
"mail_marketing": null,
"metadata": null,
"object_id": "cus_1a2B3c4D5e6F7g",
"password_last_updated_at": null,
"phone": "5551234567",
"phone_confirm": null,
"salutation": null,
"tele_marketing": null,
"title": null,
"username": null
}
}
}vendor.updated
Triggered When
- A vendor's profile is updated (e.g., name, email, phone) and the
UserObserver::updated()method fires for a user of typevendor. - Updates can come from the Core API (
PUT /api/core/vendors/{id}) or any code path that updates the User model for a vendor-type user.
Payload
{
"type": "vendor.updated",
"id": "evt_b2C3d4E5f6g7H8i9J0k1L2m3",
"created": 1704067200,
"data": {
"object": {
"object": "vendor",
"id": 12345,
"balance": 0,
"created": "2024-01-01T00:00:00.000000Z",
"currency": null,
"dates": {
"created_at": 1704067200,
"updated_at": 1704153600
},
"default_source_id": null,
"delinquent": false,
"display_name": null,
"email": "[email protected]",
"email_confirm": null,
"email_hardbounce": false,
"first_name": "Jane",
"has_password": 0,
"language": null,
"last_login_method": null,
"last_name": "Doe",
"mail_marketing": null,
"metadata": null,
"object_id": "cus_1a2B3c4D5e6F7g",
"password_last_updated_at": null,
"phone": "5551234567",
"phone_confirm": null,
"salutation": null,
"tele_marketing": null,
"title": null,
"username": null
},
"previous_attributes": {
"email": "[email protected]"
}
}
}Previous Attributes
The previous_attributes object contains the field values before the update. Only fields that actually changed and are in the publishable set are included.
vendor.deleted
Triggered When
- A vendor is deleted via the Core API (
DELETE /api/core/vendors/{id}). - Deletion is blocked if the vendor has existing bills — a vendor with bills cannot be deleted.
- When deleted, the vendor record is removed and the underlying user is converted from vendor type to customer type.
Payload
{
"type": "vendor.deleted",
"id": "evt_c3D4e5F6g7H8i9J0k1L2m3N4",
"created": 1704067200,
"data": {
"object": {
"object": "vendor",
"id": 12345,
"balance": 0,
"created": "2024-01-01T00:00:00.000000Z",
"currency": null,
"dates": {
"created_at": 1704067200,
"updated_at": 1704153600
},
"default_source_id": null,
"delinquent": false,
"display_name": null,
"email": "[email protected]",
"email_confirm": null,
"email_hardbounce": false,
"first_name": "Jane",
"has_password": 0,
"language": null,
"last_login_method": null,
"last_name": "Doe",
"mail_marketing": null,
"metadata": null,
"object_id": "cus_1a2B3c4D5e6F7g",
"password_last_updated_at": null,
"phone": "5551234567",
"phone_confirm": null,
"salutation": null,
"tele_marketing": null,
"title": null,
"username": null
}
}
}Payload Reference
Vendor Object Fields
| Field | Type | Description |
|---|---|---|
object | string | Always "vendor" |
id | integer | Pelcro user ID |
balance | integer | Account balance in cents |
created | string | ISO 8601 creation timestamp |
currency | string | null | Three-letter currency code (e.g., "usd") |
dates | object | Nested object with unix timestamps |
dates.created_at | integer | Unix timestamp of record creation |
dates.updated_at | integer | Unix timestamp of last update |
default_source_id | integer | null | Default payment source ID |
delinquent | boolean | Whether the vendor has past-due payments |
display_name | string | null | Display name |
email | string | Vendor email address |
email_confirm | boolean | null | Whether email is confirmed |
email_hardbounce | boolean | Whether email has hard bounced |
first_name | string | First name |
has_password | integer | 1 if vendor has a password, 0 otherwise |
language | string | null | Preferred language code |
last_login_method | string | null | Last login method: "email", "auth0", "google", or "facebook" |
last_name | string | Last name |
mail_marketing | boolean | null | Mail marketing opt-in status |
metadata | object | null | Custom key-value metadata |
object_id | string | null | Payment gateway customer ID (e.g., "cus_...") |
password_last_updated_at | string | null | Timestamp of last password change |
phone | string | null | Phone number |
phone_confirm | boolean | null | Whether phone is confirmed |
salutation | string | null | Salutation (e.g., "Mr.", "Ms.") |
tele_marketing | boolean | null | Telemarketing opt-in status |
title | string | null | Job title or professional title |
username | string | null | Username |
Updated about 2 hours ago
