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 webhooks 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: Handle return and chargeback webhooks
/// OverviewGet notified when an ACH debit is returned or a card payment is charged back by subscribing to the receivedachreturn and receivedchargeback webhooks. Payabli posts a payload to your server for each event so you can respond.
/// 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 webhooks quickstart for tunneling setup.
- The
ownerIdof the organization or paypoint that owns the transactions, plus its matchingownerType:0for organization or2for paypoint.
/// Step 1: Subscribe to the ACH return and chargeback events
Register a webhook for each event. Send the request once with eventType set to receivedachreturn, then again with receivedchargeback.
Send a POST request to /api/Notification.
Each call returns its notificationId in responseData. Save both so you can update or delete the subscriptions later.
See Create notification for the full API reference.
/// Step 2: Handle the payloads
Payabli sends the ReceivedAchReturn payload when an ACH debit is returned, and the ReceivedChargeBack payload when a card payment is charged back. In both, ReasonCode and Reason carry the return or chargeback reason, transId references the original transaction, and chargebackID identifies the case.
An ACH return payload carries the Nacha return code in ReasonCode (for example, R01 for insufficient funds), and the case ID in chargebackID.
A chargeback payload carries the card network’s reason code in ReasonCode, a description in Reason, and the case ID in chargebackID.
Respond with a 200 status code to acknowledge receipt. If your server doesn’t acknowledge, Payabli retries delivery.
See the webhooks reference for the full API reference.
/// What’s next
You’re now notified of returns and chargebacks in real time. Next, retrieve and manage chargebacks with the API, or learn how to respond to ACH returns.
Recipe: Set up payment notification webhooks
/// OverviewGet notified as a payment moves through its lifecycle by subscribing to Payabli’s payment webhooks. Payabli posts a payload to your server for each event, so you can track approvals, declines, settlement, and funding in real time.
/// 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 webhooks quickstart for tunneling setup.
- The
ownerIdof the organization or paypoint that owns the transactions, plus its matchingownerType:0for organization or2for paypoint.
/// Step 1: Subscribe to each payment event
Register a webhook for each event you want to receive. Send the request once per eventType. The core payment lifecycle events are:
approvedpayment— a payment is approveddeclinedpayment— a payment is declinedsettledpayment— a payment settles in a batchfundedpayment— Payabli deposits the funds to the paypoint
Send a POST request to /api/Notification.
Each call returns its notificationId in responseData. Save these so you can update or delete the subscriptions later.
See Create notification for the full API reference.
/// Step 2: Handle the payload
Payabli sends a payload matching each event. Branch on the Event field to tell which lifecycle stage fired, and use transId to reference the transaction. Approval and decline payloads also carry ResultCode (A0000 means approved). This example shows the ApprovedPayment payload.
Respond with a 200 status code to acknowledge receipt. If your server doesn’t acknowledge, Payabli retries delivery.
See the webhooks reference for the full API reference.
/// What’s next
You’re now tracking payments in real time. Subscribe to related events such as authorizedpayment and refundedpayment the same way, or manage your 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.
Recipe: Track processing stats over time
/// OverviewPull processing statistics over time for an organization or paypoint. The Basic statistics endpoint returns one row per time bucket, covering approved-transaction counts and volume (net of fees), so you can build a processing trend.
/// Prerequisites
Before you start, make sure you have the following:
- Your
orgId(forlevel=0) orpaypointId(forlevel=2) - An OAuth2 access token for the organization or paypoint. See the authentication recipe for help.
- A
modefor the date range (such asm12for the last 12 months) and afreqto group the buckets (m,w,d, orh)
/// Get processing stats over time
Send a GET request to /api/Statistic/basic/{mode}/{freq}/{level}/{entryId}. This example pulls monthly buckets for the last 12 months of an organization (mode=m12, freq=m, level=0).
The response is an array with one object per time bucket. Each bucket carries about 40 fields. The abbreviated example below shows the key ones. statX is the bucket label (YYYY-MM for monthly), the in* fields cover Pay In counts and volume, and the out* fields cover Pay Out.
The array continues with one bucket per period: m12 returns 13 (the last 12 months plus the current partial month). Sort or chart the buckets by statX to plot the trend.
See Get stats for an org or paypoint for the full API reference.
/// What’s next
Switch level to 2 with a paypointId to trend a single paypoint, or change freq to d or w for finer buckets. For a single-period snapshot instead, see Roll up stats across an organization.