Find subscriptions
Find subscriptions 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) | status:"active" |
~ | Substring match (min 3 chars, case-insensitive) | plan.name~"pro" |
> | Greater than | next_billing_date>"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 | next_billing_date<="2025-12-31T23:59:59Z" |
- | Negation (prefix) | -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. Numeric values do not require quotes. Escape quotes with a backslash.
Metadata
Query metadata fields using bracket notation: metadata["key"]:"value".
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 fields using dot notation. Examples:
customer.email:"jane@example.com"plan.type:"recurring"plan.price.amount>=1999past_due.attempt_count>=3
Searchable Subscription Fields
Top-level fields:
| Field | Type | Operators |
|---|---|---|
id | token | : |
status | string (trial/active/past_due/cancelled/scheduled_for_cancellation) | : |
created_at | date (ISO 8601) | :, >, >=, <, <= |
updated_at | date (ISO 8601) | :, >, >=, <, <= |
current_period_start | date (ISO 8601) | :, >, >=, <, <= |
current_period_end | date (ISO 8601) | :, >, >=, <, <= |
next_billing_date | date (ISO 8601) | :, >, >=, <, <= |
metadata["key"] | string | : |
Nested customer fields:
| Field | Type | Operators |
|---|---|---|
customer.id | token | : |
customer.email | string | :, ~ |
customer.full_name | string | :, ~ |
customer.phone | string | :, ~ |
customer.external_id | token | : |
customer.created_at | date (ISO 8601) | :, >, >=, <, <= |
customer.updated_at | date (ISO 8601) | :, >, >=, <, <= |
customer.metadata["key"] | string | : |
customer.address.country | string (ISO-2) | : |
customer.address.city | string | :, ~ |
customer.address.state | string | : |
customer.address.postal_code | string | : |
customer.address.line1 | string | :, ~ |
customer.address.line2 | string | :, ~ |
Nested plan fields:
| Field | Type | Operators |
|---|---|---|
plan.id | token | : |
plan.name | string | :, ~ |
plan.type | string (recurring/one-off) | : |
plan.interval | string (days/months/years) | : |
plan.interval_count | numeric | :, >, >=, <, <= |
plan.trial_interval | string (days/months/years) | : |
plan.trial_interval_count | numeric | :, >, >=, <, <= |
plan.archived_at | date (ISO 8601, nullable) | :, >, >=, <, <= |
plan.price.currency | string (ISO 4217) | : |
plan.price.amount | numeric (minor units) | :, >, >=, <, <= |
plan.trial_price.currency | string (ISO 4217) | : |
plan.trial_price.amount | numeric (minor units) | :, >, >=, <, <= |
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. 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 subscriptions. If no subscriptions match the query, the resulting array will be empty.
String representing the object's type. Value is always subscriptions.
subscriptions "subscriptions"
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/subscriptions"
An array of up to limit subscriptions that match the query. Each entry in the array is a separate subscription object. If no subscriptions 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