Filtering

Filters narrow a list to the objects you need, such as successful payments of $50 or more in a date range. Every list endpoint accepts a filters parameter, and its reference lists the fields it can filter on.

A filter object maps fields to conditions. An object matches when every condition matches.

const payments = await bias.payments.list({
    filters: {
        status: "succeeded",
        amount: { gte: 5000 },
        created_at: { gte: 1750000000000, lt: 1752600000000 },
    },
});

Over HTTP, filters is a URL-encoded JSON query parameter. The SDKs encode it for you.

curl -G https://api.biaspay.com/v1/payments \
    -H "Authorization: Bearer YOUR_API_KEY" \
    --data-urlencode 'filters={"status":"succeeded","amount":{"gte":5000}}'

Combine conditions with and and or

or takes a list of filter objects and matches objects that meet any of them. and takes a list of filter objects and or groups and matches objects that meet all of them.

// Failed payments, or payments that were disputed
const flagged = await bias.payments.list({
    filters: { or: [{ status: "failed" }, { disputed: true }] },
});

// Payments over $100 for either of two customers
const large = await bias.payments.list({
    filters: {
        and: [
            { amount: { gt: 10000 } },
            { or: [{ customer: "cus_aB4DEXqbFGOlpEOxwp0Fx1" }, { customer: "cus_Xm3pQ8vT2nLw9kRb4sYd7e" }] },
        ],
    },
});

A single field also takes or with a list of conditions on that field, such as { amount: { or: [{ lt: 500 }, { gt: 10000 }] } }.

Conditions

Each field takes one kind of condition, shown in its type. A plain value matches exactly. An object of operators matches when all of its operators match.

Equality filters

ID and enum fields, such as customer, status and type.

OperatorMatches
eqThe value.
not_eqAnything but the value.
inAny value in the list.
not_inAny value not in the list.
existstrue if the field is set, false if it’s null.

not_eq and not_in don’t match objects where the field is null.

Number filters

Amounts and counts, such as amount and amount_refunded. Amounts are in cents.

OperatorMatches
eqThe value.
gt, gte, lt, lteGreater than, at least, less than, at most.
existstrue if the field is set, false if it’s null.

Timestamp filters

Dates, such as created_at, in milliseconds since the Unix epoch. The operators are the same as for number filters.

String filters

Text fields, such as a customer’s name or email. A plain string matches exactly, including case. Operators ignore case unless case_sensitive is true.

OperatorMatches
eqThe value.
containsText containing the value.
starts_withText starting with the value.
ends_withText ending with the value.
case_sensitivetrue to match case.
existstrue if the field is set, false if it’s null.

A condition uses only one of eq, contains, starts_with and ends_with. To combine them, use and or or.

Boolean filters

Fields that are true or false. They take the value, or { eq: value }.