Pay Ops cookbook
Use these recipes to get started with Pay Ops features and functions. See Pay Ops overview for more.
New to the API? Start with the authentication guide on the cookbooks home.
Recipe: Subscribe to webhooks
/// OverviewRegister a webhook so Payabli notifies your server in real time when an event occurs. This recipe creates a single subscription for one event type.
/// Prerequisites
Before you start, make sure you have the following:
- A publicly accessible URL that accepts POST requests. Supported ports are 80, 443, 8080, and 4443. For local development, see the webhook quickstart for tunneling setup.
- An
eventTypeto subscribe to. See the webhook payloads reference for all available events. - The
ownerIdof the paypoint or organization that owns the notification, plus its matchingownerType:0for organization or2for paypoint.
/// Step 1: Create the webhook subscription
Register the webhook with Payabli. Set method to web and target to your server’s public URL.
Send a POST request to /api/Notification.
The response returns the notificationId in responseData. Save this — you need it to update or delete the subscription later.
See Create notification for the full API reference.
/// What’s next
You’re now subscribed. Trigger the event to see a payload land on your server. Learn more about webhook payloads and managing notifications.
Recipe: Retrieve ACH returns
/// OverviewRetrieve a list of ACH returns for a paypoint to monitor failed ACH debits and respond to return codes. The disputes endpoint returns both card chargebacks and ACH returns, so this recipe filters by payment method to return ACH-side records only.
/// Prerequisites
Before you start, make sure you have the following:
- Your paypoint’s
entrypointidentifier - An API token with access to the paypoint. See the authentication recipe for help
/// List ACH returns for the paypoint
Query the disputes endpoint with a method filter of ach to exclude card chargebacks from the results. Filtering on method (instead of status) keeps the request robust to the different status values an ACH return can carry, including R29 returns and any legacy records.
Send a GET request to /api/Query/chargebacks/{entry}.
The response includes one record per ACH return. The ReasonCode field contains the Nacha return code (for example, R01 for insufficient funds), Reason contains the human-readable explanation, and Transaction contains the original ACH transaction details.
See List disputes by paypoint for the full API reference, including all available filters and pagination options.
/// What’s next
You’ve retrieved ACH returns for a paypoint. To resolve them, see Managing merchant ACH debit failures and returns and the ACH return codes reference. To get notified when a return comes in, subscribe to the ReceivedAchReturn webhook event.
Recipe: Roll up stats across an organization
/// OverviewRoll up aggregate statistics for an organization in a single call. The response covers transaction counts and volume by method, chargebacks, returns, and new vs existing customers. Then drill into a single paypoint using the same endpoint. This recipe is for parent organizations managing multiple paypoints.
/// Prerequisites
Before you start, make sure you have the following:
- Your
orgId(the Payabli identifier for the organization) - An API token with access to the organization. See the authentication recipe for help.
- A
paypointIdfor one of the paypoints in the organization, if you plan to drill in (Step 2)
The endpoint uses a single path that flips between scopes via the level path parameter: 0 for an organization, 2 for a paypoint. The entryId segment is the corresponding orgId or paypointId.
/// Step 1: Get organization-level stats
Send a GET request to /api/Statistic/basic/{mode}/{freq}/{level}/{entryId} with level=0 and your orgId. This example pulls last month’s totals as a single bucket (mode=lastm, freq=m).
The response is an array with one entry per bucket. The in* fields aggregate Pay In activity across every paypoint in the organization; the out* fields aggregate Pay Out activity. Use these to compare volume by method, spot chargebacks and ACH returns, or feed dashboards.
Other modes you can swap in for lastm:
ytd(year to date)m12(last 12 months)d30(last 30 days)lastw(last week)yesterdaycustomwithstartDateandendDatequery parameters
Change freq to w, d, or h to break the same range into smaller buckets.
See Get stats for an org or paypoint for the full API reference.
/// Step 2: Drill into a single paypoint
For example, to investigate the paypoint driving most of the chargeback volume, change level to 2 and pass that paypoint’s paypointId as entryId. Every other parameter stays the same.
The response shape is identical to Step 1, scoped to the single paypoint. Compare values against the org-level roll-up to see how much of the total comes from this paypoint.
See Get stats for an org or paypoint for the full API reference.
/// What’s next
You’ve rolled up org-level stats and drilled into one paypoint. To learn how the statistics and query endpoints fit together, see Use reporting endpoints. For record-level investigation, try Query transactions with filters.