Find customers
Find customers you’ve previously created using PayNext’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind.
Search Query Language
Build a search query by combining one or more search clauses. A clause has the format field operator value where the operators are :, ~, >, <, >=, <=, or the prefix - for negation.
Operators
| Operator | Description | Example |
|---|---|---|
: | Exact match (case-insensitive) | email:"jane@example.com" |
~ | Substring match (min 3 chars, case-insensitive) | email~"jane" |
> | Greater than | created_at>"2025-01-01T00:00:00Z" |
>= | Greater than or equal | created_at>="2025-01-01T00:00:00Z" |
< | Less than | created_at<"2025-12-31T23:59:59Z" |
<= | Less than or equal | created_at<="2025-12-31T23:59:59Z" |
- | Negation (prefix) | -subscriptions.status:"cancelled" |
Logical Operators
Combine clauses with AND or OR. Clauses separated by a space default to AND logic. You cannot mix AND and OR in the same query. Maximum of 10 clauses per query.
Quoting
String values must be enclosed in single or double quotes: full_name:'Jane Doe' or full_name:"Jane Doe". Numeric values do not require quotes. Escape quotes with a backslash: full_name:"O\'Brien".
Metadata
Query metadata fields using bracket notation: metadata["key"]:"value". Check for the presence of a metadata key: -metadata["key"]:null.
Null Checks
Use field:null to find records where a field is empty or absent. Use -field:null to find records where a field is present.
Nested Fields
Access nested object and array fields using dot notation. When searching arrays (like payment_methods or subscriptions), the query matches customers who have at least one item satisfying the clause.
Examples:
address.country:"US"— customer’s billing countrypayment_methods.type:"CARD"— customer has at least one card payment methodsubscriptions.status:"active"— customer has at least one active subscriptionsubscriptions.plan.price.amount>=5000— customer has a subscription with plan price >= 5000 (minor units)
Searchable Customer Fields
Top-level fields:
| Field | Type | Operators |
|---|---|---|
id | token | : |
email | string | :, ~ |
full_name | string | :, ~ |
phone | string | :, ~ |
external_id | token | : |
created_at | date (ISO 8601) | :, >, >=, <, <= |
updated_at | date (ISO 8601) | :, >, >=, <, <= |
metadata["key"] | string | : |
total_spend | numeric | :, >, >=, <, <= |
first_payment_at | date (ISO 8601) | :, >, >=, <, <= |
last_payment_at | date (ISO 8601) | :, >, >=, <, <= |
Nested address fields:
| Field | Type | Operators |
|---|---|---|
address.country | string (ISO-2) | : |
address.city | string | :, ~ |
address.state | string | : |
address.postal_code | string | : |
address.line1 | string | :, ~ |
address.line2 | string | :, ~ |
Nested payment_methods fields — common:
| Field | Type | Operators |
|---|---|---|
payment_methods.type | string (CARD/PAYPAL/VENMO/CASHAPP/APPLEPAY/GPAY) | : |
When payment_methods.type:"CARD":
| Field | Type | Operators |
|---|---|---|
payment_methods.details.bin | string | : |
payment_methods.details.last4 | string | : |
payment_methods.details.exp_month | numeric | :, >, >=, <, <= |
payment_methods.details.exp_year | numeric | :, >, >=, <, <= |
payment_methods.details.bin_data.brand | string (visa/mastercard/american-express/discover/diners-club/jcb/unionpay) | : |
payment_methods.details.bin_data.country | string (ISO-2) | : |
payment_methods.details.bin_data.funding | string (debit/credit/prepaid/deferred-debit/charge) | : |
payment_methods.details.bin_data.issuer | string | :, ~ |
payment_methods.details.bin_data.currency_code | string (ISO 4217) | : |
When payment_methods.type:"PAYPAL":
| Field | Type | Operators |
|---|---|---|
payment_methods.details.payer_info.email | string | :, ~ |
payment_methods.details.payer_info.first_name | string | :, ~ |
payment_methods.details.payer_info.last_name | string | :, ~ |
payment_methods.details.payer_info.payer_id | token | : |
payment_methods.details.processor_customer_email | string | :, ~ |
payment_methods.details.processor_customer_id | token | : |
payment_methods.details.processor_payment_method_id | token | : |
When payment_methods.type:"VENMO":
| Field | Type | Operators |
|---|---|---|
payment_methods.details.processor_payment_method_id | token | : |
When payment_methods.type:"CASHAPP":
| Field | Type | Operators |
|---|---|---|
payment_methods.details.processor_customer_id | token | : |
payment_methods.details.processor_payment_method_id | token | : |
When payment_methods.type:"APPLEPAY" or payment_methods.type:"GPAY":
| Field | Type | Operators |
|---|---|---|
payment_methods.details.token | string | : |
payment_methods.details.token_exp_month | numeric | :, >, >=, <, <= |
payment_methods.details.token_exp_year | numeric | :, >, >=, <, <= |
payment_methods.details.token_service_provider | string | : |
Card network token fields (when present):
| Field | Type | Operators |
|---|---|---|
payment_methods.details.network_token.bin | string | : |
payment_methods.details.network_token.last4 | string | : |
payment_methods.details.network_token.expiry_month | string | : |
payment_methods.details.network_token.expiry_year | string | : |
Nested subscriptions fields:
| Field | Type | Operators |
|---|---|---|
subscriptions.id | token | : |
subscriptions.status | string (trial/active/past_due/cancelled/scheduled_for_cancellation) | : |
subscriptions.created_at | date (ISO 8601) | :, >, >=, <, <= |
subscriptions.updated_at | date (ISO 8601) | :, >, >=, <, <= |
subscriptions.current_period_start | date (ISO 8601) | :, >, >=, <, <= |
subscriptions.current_period_end | date (ISO 8601) | :, >, >=, <, <= |
subscriptions.next_billing_date | date (ISO 8601) | :, >, >=, <, <= |
subscriptions.metadata["key"] | string | : |
subscriptions.plan.id | token | : |
subscriptions.plan.name | string | :, ~ |
subscriptions.plan.type | string (recurring/one-off) | : |
subscriptions.plan.interval | string (days/months/years) | : |
subscriptions.plan.interval_count | numeric | :, >, >=, <, <= |
subscriptions.plan.trial_interval | string (days/months/years) | : |
subscriptions.plan.trial_interval_count | numeric | :, >, >=, <, <= |
subscriptions.plan.archived_at | date (ISO 8601, nullable) | :, >, >=, <, <= |
subscriptions.plan.price.currency | string (ISO 4217) | : |
subscriptions.plan.price.amount | numeric (minor units) | :, >, >=, <, <= |
subscriptions.plan.trial_price.currency | string (ISO 4217) | : |
subscriptions.plan.trial_price.amount | numeric (minor units) | :, >, >=, <, <= |
subscriptions.plan.tax.collect_tax | string (DEFAULT/COLLECT/DONT_COLLECT) | : |
Headers
Specifies the version of the API to use
2.0.0 Query Parameters
The search query string. Uses PayNext's Search Query Language. Supports exact match (:), substring match (~), numeric comparisons (>, >=, <, <=), negation (-), logical operators (AND, OR), and nested field access (dot notation). Field names use dotted paths (for example payment_status, customer.email, payment_method.details.last4); short aliases are not accepted. See the endpoint description for the full list of searchable fields and their types. String values must be quoted. Maximum 10 clauses per query.
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
1 <= x <= 100A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
Response
A dictionary with a data property that contains an array of up to limit customers. If no customers match the query, the resulting array will be empty.
String representing the object's type. Value is always customers.
customers "customers"
The accurate total number of records matching the query (not capped at 10,000). Returned alongside the cursor pagination fields.
142
The URL for accessing this list.
"/v1/customers"
An array of up to limit customers that match the query. Each entry in the array is a separate customer object. If no customers match the query, the resulting array will be empty.
Whether or not there are more elements available after this set. If false, this set comprises the end of the list.
false
A cursor for use in pagination. If has_more is true, you can pass the value of next_page to a subsequent call to fetch the next page of results.
null