Skip to main content

Events API

Overview

The Events API allows external integrations to push data updates into Paystar. This is useful for syncing customer information changes or managing autopay enrollment from your own systems.

Two event types are currently supported:

  • Accounts.ManageCustomer — Create or update customer account information
  • Accounts.UnenrollAutopay — Unenroll a customer from autopay

Authentication

All requests must include your API key in the X-Paystar-Api-Key header.

X-Paystar-Api-Key: your-api-key-here

Endpoints

EnvironmentURL
PRODhttps://gateway.paystar.io/integrations/events
DEVhttps://dev-gateway.paystar.io/integrations/events

Request Format

All requests are sent as POST with a JSON body containing three fields:

FieldTypeDescription
eventTypestringThe event type (e.g. Accounts.ManageCustomer)
payloadstringA serialized JSON string containing event data
businessUnitSlugstringThe slug identifying the target business unit
info

The payload field must be a serialized JSON string, not a raw JSON object. You must JSON.stringify() (or equivalent) your payload object before including it in the request body.

Accounts.ManageCustomer

Creates or updates a customer account in Paystar. If an account with the given accountNumber already exists, it will be updated; otherwise, a new account is created.

Payload Fields

FieldTypeRequiredDescription
accountNumberstringYesThe customer's account number
subAccountNumberstringYesSub-account number (use empty string "" if not applicable)
firstNamestringYesCustomer's first name
lastNamestringYesCustomer's last name
emailAddressstringYesCustomer's email address
originalEmailAddressstringNoPrevious email address (used when updating an email)
note

originalEmailAddress is only needed when changing a customer's email. It identifies the existing record to update. Omit it when creating a new customer or when the email is not changing.

Accounts.UnenrollAutopay

Unenrolls a customer from autopay for a given account.

Payload Fields

FieldTypeRequiredDescription
accountNumberstringYesThe customer's account number
subAccountNumberstringYesSub-account number (use empty string "" if not applicable)
note

If the business unit does not use sub-account numbers, pass an empty string "" for subAccountNumber.

Examples

Accounts.ManageCustomer
curl -X POST https://gateway.paystar.io/integrations/events \
-H "Content-Type: application/json" \
-H "X-Paystar-Api-Key: your-api-key-here" \
-d '{
"eventType": "Accounts.ManageCustomer",
"businessUnitSlug": "water-bill-pay",
"payload": "{\"accountNumber\":\"12345\",\"subAccountNumber\":\"\",\"firstName\":\"John\",\"lastName\":\"Smith\",\"emailAddress\":\"[email protected]\"}"
}'
Accounts.UnenrollAutopay
curl -X POST https://gateway.paystar.io/integrations/events \
-H "Content-Type: application/json" \
-H "X-Paystar-Api-Key: your-api-key-here" \
-d '{
"eventType": "Accounts.UnenrollAutopay",
"businessUnitSlug": "water-bill-pay",
"payload": "{\"accountNumber\":\"12345\",\"subAccountNumber\":\"\"}"
}'

See the Events API Spec for the full OpenAPI specification.