Skip to main content
Version: Live

Webhooks

Pay Theory webhooks send an HTTP POST to your application when a Pay Theory event happens. Use them when your system needs to react after the payment flow, such as syncing merchants, transactions, settlements, payors, saved payment methods, or disputes.

For copy/paste JSON payloads, see Webhook Sample Payloads.


Before You Start​

Make sure you have:

  • A public HTTPS endpoint that Pay Theory can reach.
  • A server route that accepts POST requests.
  • JSON body parsing enabled on that route.
  • A way to return a quick 2xx response after receiving the event.
  • Retry-safe handling so duplicate deliveries do not create duplicate side effects.
  • Separate webhook URLs for sandbox/testing and production.
  • Basic logging for webhook request bodies while testing.

If you are testing locally, use a public tunnel such as ngrok or a request inspection tool such as RequestBin. A localhost URL will not work because Pay Theory cannot reach your machine directly.


How It Works​

  1. An event happens in Pay Theory.
  2. Pay Theory sends your endpoint an HTTP POST.
  3. Your endpoint reads the JSON body.
  4. Your endpoint returns a 2xx response.
  5. Your application processes the event.

Process the event idempotently. In practice, that means your code should be safe if the same payload is received more than once.


Webhook Request Shape​

Every Pay Theory webhook uses this top-level shape:

FieldTypeDescription
eventstringThe event family, such as MERCHANT, TRANSACTION, or PAYMENT_METHOD.
subtypestringThe event action or state, such as CREATED or UPDATED.
payloadobjectThe event-specific data object.

Example:

{
"event": "PAYOR",
"subtype": "CREATED",
"payload": {
"payor_id": "payor_123",
"merchant_uid": "mer_123",
"email": "pat@example.com"
}
}

Use event and subtype to route the webhook in your application. Use payload for the event data.


Create A Webhook​

You can manage webhooks from the Pay Theory portal or through the GraphQL API.

When creating a webhook, provide:

  • endpoint: the HTTPS URL Pay Theory should call.
  • name: a human-readable name for the webhook.

API references:


Event Types​

The currently confirmed webhook event families are:

EventDocumented subtypesDescription
AUTHORIZATIONCREATED, UPDATEDAuthorization activity was emitted.
MERCHANTCREATED, UPDATEDA merchant record was created or updated.
SETTLEMENTCREATED, UPDATEDSettlement activity was emitted.
TRANSACTIONCREATED, UPDATEDTransaction activity was emitted.
SPLIT_FUNDINGCREATED, UPDATEDSplit funding activity was emitted.
PAYORCREATED, UPDATEDA payor record was created or updated.
PAYMENT_METHODCREATED, UPDATEDA payment method token record was created or updated.
DISPUTECREATED, UPDATEDDispute activity was emitted.

See Webhook Sample Payloads for documented field tables and JSON examples.


Testing Webhooks​

Use this checklist when testing:

  • Create a webhook that points to a test endpoint.
  • Trigger an event in the sandbox environment.
  • Confirm your endpoint receives a POST.
  • Confirm the body has event, subtype, and payload.
  • Return a 2xx response from your endpoint.
  • Check webhookEvents if you need delivery history.
  • Confirm your application does not duplicate work if the same event is processed more than once.

Troubleshooting​

ProblemWhat to check
You are not receiving eventsConfirm the webhook is active and the endpoint is public HTTPS.
Local testing does not workUse a public tunnel or request inspection URL instead of localhost.
Pay Theory reports delivery failuresConfirm your endpoint returns a 2xx response without timing out.
The payload is not what you expectedCheck the event and subtype, then compare against the sample payload page.
Your system creates duplicatesAdd idempotency handling before creating records or triggering side effects.