Skip to main content
Some top-level API resources support retrieval with search API methods. You can use the search APIs to retrieve your PayNext objects in a flexible manner. Using search is a faster alternative to paginating through all resources with individual filter parameters. Search is available on the list endpoints — GET /payments, GET /customers, GET /subscriptions, and GET /plans — when you set the X-API-Version: 2.0.0 header. With this header, the endpoint parses the DSL from the query parameter, ignores the legacy filter query parameters, and returns the search envelope (object, url, has_more, next_page, total_count, data). Without the header, the endpoints keep their v1.x behavior and response shape. See Parameters and Response format below. To create a search query, review the search query language and reference the query fields of the resource:
Field names use dotted paths (for example payment_status, customer.email, payment_method.details.last4). Short aliases such as status, email, or card_last4 are not accepted and return an error. Always use the exact field names listed in the tables below.

Examples

Here are some examples of what you can do with the search APIs. Look up payments matching a custom metadata value.
curl
curl -G https://api.paynext.com/payments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Version: 2.0.0" \
  --data-urlencode "query=metadata['order_id']:'ord_abc123'"

Payments by status and amount

Look up settled payments over a specific amount.
curl
curl -G https://api.paynext.com/payments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Version: 2.0.0" \
  --data-urlencode "query=payment_status:'SETTLED' AND amount>=10000"
Look up customers matching an email substring.
curl
curl -G https://api.paynext.com/customers \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Version: 2.0.0" \
  --data-urlencode "query=email~'alice'"

Negation filter

Look up payments not in USD currency.
curl
curl -G https://api.paynext.com/payments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Version: 2.0.0" \
  --data-urlencode "query=-currency_code:'USD'"

Numeric filter

Filter payments with an amount greater than 10000.
curl
curl -G https://api.paynext.com/payments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Version: 2.0.0" \
  -d "query=amount>10000"

Combining multiple filters

Look up payments matching a combination of metadata and currency.
curl
curl -G https://api.paynext.com/payments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Version: 2.0.0" \
  --data-urlencode "query=metadata['campaign']:'summer_sale' AND currency_code:'USD'"

Search query language

Query structure and terminology

A query clause consists of a field followed by an operator followed by a value:
clausecustomer.email:"alice@example.com"
fieldcustomer.email
operator:
valuealice@example.com
You can combine up to 10 query clauses in a search by either separating them with a space, or using the AND or OR keywords (case insensitive). You cannot combine AND and OR in the same query. There is no option to use parentheses to give priority to certain logic operators. By default, the API combines clauses with AND logic. On the Payments and Customers endpoints, all clauses in an OR query must target the same field; the Subscriptions and Plans endpoints allow OR across different fields. The example query customer.email:"alice@example.com" metadata["tier"]:"premium" matches records where both the customer email is alice@example.com and the metadata includes tier with a value of premium.

Negation

You can negate query clauses using a - character. For example, the following search returns records that don’t match the currency USD: -currency_code:"USD"

Field types, substring matching, and numeric comparators

Each field has a type that defines the operations you can use on it. For a full list of available fields and their types, see supported query fields for each resource. Using an unsupported operator — such as specifying greater than (>) on a token field — returns an error.
TypeOperators
tokenexact match with : (case insensitive)
stringexact match with :, substring match with ~ (case insensitive). An exact match on a string type returns any record that contains all of the words from the query in the same order.
numericexact match with :, greater than / less than with >, <, >=, <=
dateexact match with :, range with >, <, >=, <=. Accepts Unix seconds (e.g. 1620310503) or an RFC3339 timestamp (e.g. 2025-05-25T14:30:00Z)
booleanexact match with : against true / false

Quotes

You must use quotation marks around string values. Quotation marks are optional for numeric values. For example:
  • currency_code:"USD" — quotes are required
  • amount:1000 — quotes are optional
You can escape quotes inside of quotes with a backslash (\): statement_descriptor:"the descriptor called \"My Store\""

Metadata

You can perform searches on metadata that you’ve added to objects that support it. Use either bracket or dotted syntax to construct a clause for a metadata search: metadata["<field>"]:"<value>" or metadata.<field>:"<value>". The metadata key must consist of [a-zA-Z0-9_] characters. The following clause demonstrates how to query for records with an order ID of ord_abc123: metadata["order_id"]:"ord_abc123" You can query for the presence of a metadata key on an object. The following clause matches all records where order_id is a metadata key: -metadata["order_id"]:null Some resources also expose scoped metadata fields for related objects — for example customer.metadata["<key>"] on payments and subscriptions, or plan.metadata["<key>"] on subscriptions. These are listed in each resource’s field tables.

Null operator

The null keyword checks for field presence or absence:
QueryMeaning
customer.phone:nullField is empty or not set
-customer.phone:nullField is present and has a value
:null is supported on token, string, and date fields. It is not supported on numeric fields.

Search syntax

The following table lists the syntax that you can use to construct a query.
SyntaxUsageDescriptionExamples
:field:valueExact match operator (case insensitive)currency_code:"EUR" returns records where the currency is exactly EUR
AND, andfield:value1 AND field:value2Both clauses must match (case insensitive)payment_status:"SETTLED" AND amount:500
OR, orfield:value1 OR field:value2Either clause matches (case insensitive). On Payments and Customers, all OR clauses must target the same field.currency_code:"USD" OR currency_code:"EUR"
--field:valueReturns records that don’t match the clause-currency_code:"JPY" returns records not in JPY
NULL, nullfield:nullA special token used for field presence (case insensitive)customer.phone:null returns records where phone is empty
\"\"\"Escape quotes within quotesstatement_descriptor:"called \"My Store\""
~field~valueSubstring match operator (minimum 3 characters)customer.email~"ali" returns matches for alice@example.com
>, <, >=, <=field>value, field>=valueGreater than/less than operatorsamount>=1000 returns objects with amount 1000 or greater

Supported query fields for each resource

Query fields for Payments

Core

FieldUsageType
idid:"pay_e8a1..."token
payment_statuspayment_status:"SETTLED"token
payment_typepayment_type:"CIT"token
transaction_typetransaction_type:"Auth"token
currency_codecurrency_code:"USD"token
amountamount>1000numeric
amount_usdamount_usd>=5000numeric
statement_descriptorstatement_descriptor~"MY COMPANY"string
created_atcreated_at>1620310503date
updated_atupdated_at>1620310503date

Customer

FieldUsageType
customer.idcustomer.id:"cus_a1b2..."token
customer.emailcustomer.email~"alice"string
customer.full_namecustomer.full_name~"John"string
customer.phonecustomer.phone:"+15551234567"string
customer.external_idcustomer.external_id:"ord_001"string
customer.created_atcustomer.created_at>1620310503date
customer.updated_atcustomer.updated_at>1620310503date
customer.address.countrycustomer.address.country:"US"token
customer.address.statecustomer.address.state:"CA"token
customer.address.postal_codecustomer.address.postal_code:"94105"token
customer.address.citycustomer.address.city~"Francisco"string
customer.address.line1customer.address.line1~"Market"string
customer.address.line2customer.address.line2~"Suite"string

Subscription

FieldUsageType
subscription.idsubscription.id:"sub_d1e2..."token
subscription.statussubscription.status:"active"token
subscription.created_atsubscription.created_at>1620310503date
subscription.updated_atsubscription.updated_at>1620310503date
subscription.current_period_startsubscription.current_period_start>1620310503date
subscription.current_period_endsubscription.current_period_end<1620310503date
subscription.next_billing_datesubscription.next_billing_date>1620310503date

Processor

FieldUsageType
processor.idprocessor.id:"prc_f1a2..."token
processor.typeprocessor.type:"stripe"token

Payment method and card

FieldUsageType
payment_method.typepayment_method.type:"CARD"token
payment_method.details.binpayment_method.details.bin:"411111"token
payment_method.details.last4payment_method.details.last4:"4242"token
payment_method.details.exp_monthpayment_method.details.exp_month:12numeric
payment_method.details.exp_yearpayment_method.details.exp_year:2028numeric
payment_method.details.bin_data.brandpayment_method.details.bin_data.brand:"visa"token
payment_method.details.bin_data.countrypayment_method.details.bin_data.country:"US"token
payment_method.details.bin_data.fundingpayment_method.details.bin_data.funding:"credit"token
payment_method.details.bin_data.issuerpayment_method.details.bin_data.issuer~"Chase"string

Network token

FieldUsageType
payment_method.details.tokenpayment_method.details.token:"tok_..."token
payment_method.details.token_service_providerpayment_method.details.token_service_provider:"visa"token
payment_method.details.token_exp_monthpayment_method.details.token_exp_month:12numeric
payment_method.details.token_exp_yearpayment_method.details.token_exp_year:2028numeric
payment_method.details.network_token.binpayment_method.details.network_token.bin:"411111"token
payment_method.details.network_token.last4payment_method.details.network_token.last4:"4242"token
payment_method.details.network_token.expiry_monthpayment_method.details.network_token.expiry_month:"12"token
payment_method.details.network_token.expiry_yearpayment_method.details.network_token.expiry_year:"2028"token

PayPal payer info

FieldUsageType
payment_method.details.payer_info.emailpayment_method.details.payer_info.email~"alice"string
payment_method.details.payer_info.first_namepayment_method.details.payer_info.first_name~"Jane"string
payment_method.details.payer_info.last_namepayment_method.details.payer_info.last_name~"Doe"string
payment_method.details.payer_info.payer_idpayment_method.details.payer_info.payer_id:"1234567"token

Processor customer

FieldUsageType
payment_method.details.processor_customer_emailpayment_method.details.processor_customer_email~"alice"string
payment_method.details.processor_customer_idpayment_method.details.processor_customer_id:"cus_Stripe1"token
payment_method.details.processor_payment_method_idpayment_method.details.processor_payment_method_id:"pm_1Nx..."token

Refund

FieldUsageType
refund.is_refundedrefund.is_refunded:"true"boolean
refund.statusrefund.status:"REFUNDED"token
refund.amountrefund.amount>0numeric

Tax

FieldUsageType
tax.statustax.status:"calculated"token
tax.behaviortax.behavior:"EXCLUSIVE"token
tax.error.codetax.error.code:"calculation_failed"token
tax.error.messagetax.error.message:"invalid postal code"token

3-D Secure

FieldUsageType
three_d_secure.attemptedthree_d_secure.attempted:"true"boolean
three_d_secure.flowthree_d_secure.flow:"challenge"token
three_d_secure.statusthree_d_secure.status:"authenticated"token
three_d_secure.status_reasonthree_d_secure.status_reason:"card_not_enrolled"token
three_d_secure.liability_shiftthree_d_secure.liability_shift:"true"token
three_d_secure.eci_valuethree_d_secure.eci_value:"05"token
three_d_secure.eci_resultthree_d_secure.eci_result:"authenticated"token

Decline information

FieldUsageType
status_reason.statusstatus_reason.status:"declined"token
status_reason.decline_codestatus_reason.decline_code:"insufficient_funds"token
status_reason.messagestatus_reason.message~"expired"string

AVS / CVC checks

FieldUsageType
avs_check.result.postal_codeavs_check.result.postal_code:"match"token
avs_check.result.street_addressavs_check.result.street_address:"match"token
cvc_check.result.cvccvc_check.result.cvc:"match"token

Processor identifiers

FieldUsageType
payment_details.auth_codepayment_details.auth_code:"A1B2C3"token
payment_details.processor_transaction_idpayment_details.processor_transaction_id:"ch_3Nx..."token
payment_details.network_payment_idpayment_details.network_payment_id~"MCC1234"string
payment_details.arnpayment_details.arn:"74512345678901234567890"token

Fraud prevention

FieldUsageType
fraud_prevention-fraud_prevention:nulltoken (presence)
fraud_prevention.visa_order_insight.typefraud_prevention.visa_order_insight.type:"OI"token
fraud_prevention.visa_compelling_evidence.statusfraud_prevention.visa_compelling_evidence.status:"accepted"token
fraud_prevention.visa_rdr.statusfraud_prevention.visa_rdr.status:"accepted"token
fraud_prevention.visa_rdr.reason.codefraud_prevention.visa_rdr.reason.code:"10.4"token
fraud_prevention.visa_rdr.reason.namefraud_prevention.visa_rdr.reason.name:"..."token
fraud_prevention.visa_rdr.reason.categoryfraud_prevention.visa_rdr.reason.category:"fraud"token
fraud_prevention.mastercard_consumer_clarity.typefraud_prevention.mastercard_consumer_clarity.type:"DIGITAL"token

Metadata

FieldUsageType
metadata["<key>"]metadata["order_id"]:"ord_123"token
customer.metadata["<key>"]customer.metadata["tier"]:"premium"token
subscription.metadata["<key>"]subscription.metadata["plan_tier"]:"gold"token
The payment_status field accepts the following values: PENDING, FAILED, AUTHORIZED, SETTLING, SETTLED, DECLINED, BLOCKED, CANCELLED.
The payment_method.type field accepts values like CARD, PIX, PAYPAL, CASHAPP, APPLEPAY, GOOGLEPAY, VENMO, AMAZONPAY.
The payment_token_type field accepts: CARD_PAN, NETWORK_TOKEN, PROCESSOR_TOKEN.
payment_method.details.bin_data.brand is the card network (for example visa, mastercard). payment_details.network_payment_id is the scheme-side network transaction identifier returned by the processor (for example, the Mastercard trace id or Visa transaction id) — they are different fields.
customer.email and customer.external_id on payments match against the customer associated with the payment.

Query fields for Customers

Core

FieldUsageType
idid:"cus_b8d0..."token
emailemail~"alice"string
full_namefull_name~"John"string
phonephone:"+15551234567"string
external_idexternal_id:"ext_001"token
created_atcreated_at>1620310503date
updated_atupdated_at>1620310503date
total_spendtotal_spend>10000numeric
first_payment_atfirst_payment_at>1620310503date
last_payment_atlast_payment_at>1620310503date

Address

FieldUsageType
address.countryaddress.country:"US"token
address.stateaddress.state:"CA"token
address.postal_codeaddress.postal_code:"94105"token
address.cityaddress.city~"Francisco"string
address.line1address.line1~"Market"string
address.line2address.line2~"Suite"string

Payment methods

FieldUsageType
payment_methods.typepayment_methods.type:"CARD"token
payment_methods.details.binpayment_methods.details.bin:"411111"token
payment_methods.details.last4payment_methods.details.last4:"4242"token
payment_methods.details.exp_monthpayment_methods.details.exp_month:12numeric
payment_methods.details.exp_yearpayment_methods.details.exp_year:2028numeric
payment_methods.details.token_exp_monthpayment_methods.details.token_exp_month:12numeric
payment_methods.details.token_exp_yearpayment_methods.details.token_exp_year:2028numeric
payment_methods.details.bin_data.brandpayment_methods.details.bin_data.brand:"visa"token
payment_methods.details.bin_data.countrypayment_methods.details.bin_data.country:"US"token
payment_methods.details.bin_data.fundingpayment_methods.details.bin_data.funding:"credit"token
payment_methods.details.bin_data.currency_codepayment_methods.details.bin_data.currency_code:"USD"token
payment_methods.details.bin_data.issuerpayment_methods.details.bin_data.issuer~"Chase"string
payment_methods.details.payer_info.emailpayment_methods.details.payer_info.email~"alice"string
payment_methods.details.payer_info.first_namepayment_methods.details.payer_info.first_name~"Jane"string
payment_methods.details.payer_info.last_namepayment_methods.details.payer_info.last_name~"Doe"string
payment_methods.details.payer_info.payer_idpayment_methods.details.payer_info.payer_id:"1234567"token
payment_methods.details.processor_customer_emailpayment_methods.details.processor_customer_email~"alice"string
payment_methods.details.processor_customer_idpayment_methods.details.processor_customer_id:"cus_Stripe1"token
payment_methods.details.processor_payment_method_idpayment_methods.details.processor_payment_method_id:"pm_1Nx..."token
payment_methods.details.tokenpayment_methods.details.token:"tok_..."token
payment_methods.details.token_service_providerpayment_methods.details.token_service_provider:"visa"token
payment_methods.details.network_token.binpayment_methods.details.network_token.bin:"411111"token
payment_methods.details.network_token.last4payment_methods.details.network_token.last4:"4242"token
payment_methods.details.network_token.expiry_monthpayment_methods.details.network_token.expiry_month:"12"token
payment_methods.details.network_token.expiry_yearpayment_methods.details.network_token.expiry_year:"2028"token

Subscriptions

FieldUsageType
subscriptions.idsubscriptions.id:"sub_d1e2..."token
subscriptions.statussubscriptions.status:"ACTIVE"token
subscriptions.created_atsubscriptions.created_at>1620310503date
subscriptions.updated_atsubscriptions.updated_at>1620310503date
subscriptions.current_period_startsubscriptions.current_period_start>1620310503date
subscriptions.current_period_endsubscriptions.current_period_end<1620310503date
subscriptions.next_billing_datesubscriptions.next_billing_date>1620310503date

Subscription plan

FieldUsageType
subscriptions.plan.idsubscriptions.plan.id:"price_a5b8..."token
subscriptions.plan.namesubscriptions.plan.name~"Pro"string
subscriptions.plan.typesubscriptions.plan.type:"recurring"token
subscriptions.plan.intervalsubscriptions.plan.interval:"months"token
subscriptions.plan.interval_countsubscriptions.plan.interval_count:1numeric
subscriptions.plan.trial_intervalsubscriptions.plan.trial_interval:"days"token
subscriptions.plan.trial_interval_countsubscriptions.plan.trial_interval_count:14numeric
subscriptions.plan.archived_atsubscriptions.plan.archived_at:nulldate
subscriptions.plan.price.currencysubscriptions.plan.price.currency:"USD"token
subscriptions.plan.price.amountsubscriptions.plan.price.amount>1000numeric
subscriptions.plan.trial_price.currencysubscriptions.plan.trial_price.currency:"USD"token
subscriptions.plan.trial_price.amountsubscriptions.plan.trial_price.amount:0numeric
subscriptions.plan.tax.collect_taxsubscriptions.plan.tax.collect_tax:"true"token

Metadata

FieldUsageType
metadata["<key>"]metadata["tier"]:"enterprise"token
customer.metadata["<key>"]customer.metadata["tier"]:"enterprise"token
subscriptions.metadata["<key>"]subscriptions.metadata["plan_tier"]:"gold"token
The subscriptions.status field accepts values like ACTIVE, CANCELLED, PAST_DUE, PAUSED, TRIAL, SCHEDULED_FOR_CANCELLATION.

Query fields for Subscriptions

Core

FieldUsageType
idid:"sub_d1e2..."token
statusstatus:"active"token
created_atcreated_at>1620310503date
updated_atupdated_at>1620310503date
current_period_startcurrent_period_start>1620310503date
current_period_endcurrent_period_end<1620310503date
next_billing_datenext_billing_date>1620310503date

Customer

FieldUsageType
customer.idcustomer.id:"cus_a1b2..."token
customer.emailcustomer.email~"alice"string
customer.full_namecustomer.full_name~"John"string
customer.phonecustomer.phone:"+15551234567"string
customer.external_idcustomer.external_id:"ext_001"token
customer.created_atcustomer.created_at>1620310503date
customer.updated_atcustomer.updated_at>1620310503date
customer.address.countrycustomer.address.country:"US"token
customer.address.statecustomer.address.state:"CA"token
customer.address.postal_codecustomer.address.postal_code:"94105"token
customer.address.citycustomer.address.city~"Francisco"string
customer.address.line1customer.address.line1~"Market"string
customer.address.line2customer.address.line2~"Suite"string

Plan

FieldUsageType
plan.idplan.id:"price_a5b8..."token
plan.nameplan.name~"Pro"string
plan.typeplan.type:"recurring"token
plan.intervalplan.interval:"months"token
plan.interval_countplan.interval_count:1numeric
plan.trial_intervalplan.trial_interval:"days"token
plan.trial_interval_countplan.trial_interval_count:14numeric
plan.archived_atplan.archived_at:nulldate
plan.price.currencyplan.price.currency:"USD"token
plan.price.amountplan.price.amount>1000numeric
plan.trial_price.currencyplan.trial_price.currency:"USD"token
plan.trial_price.amountplan.trial_price.amount:0numeric
plan.tax.collect_taxplan.tax.collect_tax:"true"token

Metadata

FieldUsageType
metadata["<key>"]metadata["plan_tier"]:"gold"token
plan.metadata["<key>"]plan.metadata["feature"]:"priority"token
customer.metadata["<key>"]customer.metadata["tier"]:"premium"token
The status field accepts values like ACTIVE, CANCELLED, PAST_DUE, PAUSED, TRIAL, SCHEDULED_FOR_CANCELLATION.

Query fields for Plans

FieldUsageType
idid:"price_a5b8..."token
namename~"Pro"string
typetype:"recurring"token
created_atcreated_at>1620310503date
updated_atupdated_at>1620310503date
archived_atarchived_at:nulldate
intervalinterval:"months"token
interval_countinterval_count:1numeric
trial_intervaltrial_interval:"days"token
trial_interval_counttrial_interval_count:14numeric
price.default.currencyprice.default.currency:"USD"token
price.default.amountprice.default.amount>1000numeric
trial_price.default.currencytrial_price.default.currency:"USD"token
trial_price.default.amounttrial_price.default.amount:0numeric
tax.collect_taxtax.collect_tax:"true"token
metadata["<key>"]metadata["feature"]:"priority"token
The interval and trial_interval fields accept days, months, years. The type field accepts recurring, one-off.

Parameters

All search endpoints accept the same parameters:
query
string
required
The search query string. See the search query language and the list of supported query fields for each resource.
limit
integer
default:"10"
A limit on the number of objects to return. Limit can range between 1 and 100, and the default is 10.
page
string
A 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 pages.

Response format

A dictionary with a data property that contains an array of up to limit results. If no objects match the query, the resulting array will be empty.
object
string
required
The resource collection name — one of payments, customers, subscriptions, or plans.
url
string
required
The URL of the search endpoint that was called.
has_more
boolean
required
Whether there are more results available beyond this page.
next_page
string
A cursor to use as the page parameter for the next request. null if there are no more results.
total_count
integer
required
The total number of objects matching the query.
data
array
required
An array of result objects matching the query. Each entry is a full resource object (the same shape returned by the corresponding GET /{resource}/{id} endpoint).
curl -G https://api.paynext.com/customers \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Version: 2.0.0" \
  --data-urlencode "query=full_name:'Alice Johnson' AND metadata['tier']:'premium'"
{
  "object": "customers",
  "url": "/customers",
  "has_more": false,
  "next_page": null,
  "total_count": 1,
  "data": [
    {
      "id": "cus_b8d0fe7e-3a7f-4b5f-a68b-d31358b49c3f",
      "created_at": "2025-05-28T14:00:00Z",
      "updated_at": "2025-05-28T14:05:00Z",
      "external_id": "ext_001",
      "full_name": "Alice Johnson",
      "email": "alice.johnson@example.com",
      "metadata": {
        "tier": "premium"
      },
      "address": {
        "city": "San Francisco",
        "country": "US",
        "line1": "123 Market Street",
        "line2": "Suite 400",
        "postal_code": "94105",
        "state": "CA"
      },
      "phone": "+1-555-123-4567"
    }
  ]
}

Limitations

Rate limits

Search endpoints are rate-limited to 20 requests per second per API key. For workloads requiring analytics or bulk data export, consider using webhooks or scheduled data pulls.

Data freshness

Don’t use search for read-after-write flows (for example, searching immediately after a payment is created) because the data may not be immediately available to search. Under normal operating conditions, data is searchable in under 1 minute. For read-after-write flows that require immediate data availability, use the standard list APIs with individual filter parameters.

Query constraints

  • Maximum 10 clauses per query
  • You cannot combine AND and OR in the same query
  • On Payments and Customers, all OR clauses must target the same field (Subscriptions and Plans allow OR across different fields)
  • No parentheses for operator precedence
  • Substring matching (~) requires a minimum of 3 characters
  • Space-separated clauses default to AND logic
In some cases, the data you use to find search results might not match the results that you receive. This can happen because the search index is slightly behind the latest state of the object.