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

EventDescription
vendor.createdA new vendor was created
vendor.updatedA vendor's profile was updated
vendor.deletedA 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 type vendor.
  • 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

FieldTypeDescription
objectstringAlways "vendor"
idintegerPelcro user ID
balanceintegerAccount balance in cents
createdstringISO 8601 creation timestamp
currencystring | nullThree-letter currency code (e.g., "usd")
datesobjectNested object with unix timestamps
dates.created_atintegerUnix timestamp of record creation
dates.updated_atintegerUnix timestamp of last update
default_source_idinteger | nullDefault payment source ID
delinquentbooleanWhether the vendor has past-due payments
display_namestring | nullDisplay name
emailstringVendor email address
email_confirmboolean | nullWhether email is confirmed
email_hardbouncebooleanWhether email has hard bounced
first_namestringFirst name
has_passwordinteger1 if vendor has a password, 0 otherwise
languagestring | nullPreferred language code
last_login_methodstring | nullLast login method: "email", "auth0", "google", or "facebook"
last_namestringLast name
mail_marketingboolean | nullMail marketing opt-in status
metadataobject | nullCustom key-value metadata
object_idstring | nullPayment gateway customer ID (e.g., "cus_...")
password_last_updated_atstring | nullTimestamp of last password change
phonestring | nullPhone number
phone_confirmboolean | nullWhether phone is confirmed
salutationstring | nullSalutation (e.g., "Mr.", "Ms.")
tele_marketingboolean | nullTelemarketing opt-in status
titlestring | nullJob title or professional title
usernamestring | nullUsername