Skip to content

Payments Query

Note: The Teachify Admin API is currently under development and not yet available for public use. This documentation is provided for preview purposes only.

The Payments API allows you to retrieve information about payments in your school. Payments represent financial transactions made by users when purchasing courses, memberships, events, digital downloads, and other products. This API provides access to payment details, refund information, and filtering capabilities.

Returns a paginated list of payments for the authenticated school.

Parameters:

ParameterTypeDescription
filterAdminPaymentFilterFilter criteria (see Filtering)
pageIntPage number for pagination
perPageIntNumber of items per page (default: 20, max: 50)
limitIntAlternative to perPage

Returns:

  • AdminPaymentPage object with:
    • nodes: Array of AdminPayment objects
    • currentPage: Current page number
    • hasNextPage: Whether there are more pages
    • hasPreviousPage: Whether there are previous pages
    • nodesCount: Total number of items across all pages
    • totalPages: Total number of pages

Example:

query {
payments(
filter: {
paymentState: { eq: "paid" },
paidAt: { gte: 1704067200 }
},
page: 1,
perPage: 10
) {
nodes {
id
tradeNo
amount
currency
paymentType
paidAt
user {
id
email
name
}
lineitems {
name
amount
itemType
}
# Needs members:read (or students:read) besides orders:read
formSubmission {
answers {
label
fieldType
deleted
values
}
}
}
currentPage
hasNextPage
hasPreviousPage
nodesCount
totalPages
}
}

The AdminPayment object contains the following fields:

FieldTypeDescription
idString!Unique identifier
userAdminUser!The user who made the payment
tradeNoStringUnique trade/transaction number from the payment gateway
currencyString!Currency code (e.g., TWD, USD) in ISO 4217 format
currencySymbolString!Currency symbol (e.g., $, NT$)
amountFloat!Payment amount
refundedAmountFloatAmount that has been refunded
refundAmountFloat!Returns the refund amount if the payment is refunding, otherwise returns the refunded amount
discountAmountFloatDiscount amount applied to this payment
paymentTypeStringPayment method (e.g., credit, atm, cvs, web_atm, barcode, line_pay)
paidAtIntUnix timestamp when the payment was completed
refundedAtIntUnix timestamp when the payment was refunded
expiredAtIntUnix timestamp when the payment expired
affiliateCodeStringAffiliate tracking code, if applicable
remarkStringAdditional remarks or notes
lineitems[Lineitem]List of purchased items in this payment
invoiceInvoiceAssociated invoice, if issued
installmentIntInstallment period for credit card payments, if applicable
createdAtInt!Unix timestamp when the payment record was created
updatedAtInt!Unix timestamp when the payment record was last updated
formSubmissionAdminFormSubmissionAnswers the buyer submitted on the custom checkout form. null when the order has none. Requires members:read (or students:read) besides orders:read; without it the field is null and the response carries a scope error at its path

The answers a buyer submitted on the custom checkout form, as the school admin order page shows them.

FieldTypeDescription
idString!Unique identifier of the submission
formIdString!ID of the checkout form
answers[AdminFormAnswer!]!One entry per question, in the form’s order: every current question, plus deleted questions this submission answered
FieldTypeDescription
fieldIdString!ID of the form question
labelStringThe question as the form currently labels it
fieldTypeString!Question type: text, text_area, number, date, radio, multi_select, single_select, address, international_address or rating
deletedBoolean!True when the question has since been removed from the form. It is still listed because this submission answered it
values[String!]!Display values: option labels for radio and select questions; zip code, city, district and street as separate items for an address, in that order with blank parts left out. Empty when unanswered

The payments query supports filtering through the filter parameter. The following filter fields are available:

Filter FieldTypeDescription
idStringOperatorFilter by payment ID
amountFloatOperatorFilter by payment amount
paymentStateStringOperatorFilter by payment state (not_paid, paid, expired, failed, manual_enrolled, refunding, refunded)
paidAtIntOperatorFilter by payment timestamp (Unix timestamp)
refundedAtIntOperatorFilter by refund timestamp (Unix timestamp)
createdAtIntOperatorFilter by creation timestamp (Unix timestamp)
tradeNoStringOperatorFilter by trade/transaction number
OperatorDescriptionExample
eqEqual to{ tradeNo: { eq: "T20250101001" } }
neqNot equal to{ paymentState: { neq: "expired" } }
inIn a list of values{ paymentState: { in: ["paid", "refunding"] } }
ninNot in a list of values{ paymentState: { nin: ["expired", "failed"] } }
likeContains substring (case-sensitive){ tradeNo: { like: "T2025" } }
containsContains substring (case-insensitive){ tradeNo: { contains: "T2025" } }
OperatorDescriptionExample
eqEqual to{ paidAt: { eq: 1704067200 } }
gtGreater than{ paidAt: { gt: 1704067200 } }
gteGreater than or equal{ paidAt: { gte: 1704067200 } }
ltLess than{ paidAt: { lt: 1735689600 } }
lteLess than or equal{ paidAt: { lte: 1735689600 } }
OperatorDescriptionExample
eqEqual to{ amount: { eq: 999.0 } }
gtGreater than{ amount: { gt: 500.0 } }
gteGreater than or equal{ amount: { gte: 500.0 } }
ltLess than{ amount: { lt: 2000.0 } }
lteLess than or equal{ amount: { lte: 2000.0 } }

Find all paid payments in a date range:

query {
payments(
filter: {
paymentState: { eq: "paid" },
paidAt: { gte: 1704067200, lte: 1735689600 }
}
) {
nodes {
id
tradeNo
amount
currency
paidAt
user {
id
email
}
}
}
}

Find refunded payments in a specific period:

query {
payments(
filter: {
paymentState: { eq: "refunded" },
refundedAt: { gte: 1704067200, lte: 1735689600 }
}
) {
nodes {
id
tradeNo
amount
refundedAmount
refundedAt
user {
id
email
}
}
}
}

Look up a specific payment by trade number:

query {
payments(
filter: {
tradeNo: { eq: "T20250101001" }
}
) {
nodes {
id
tradeNo
amount
currency
paymentType
paidAt
}
}
}

Find high-value payments:

query {
payments(
filter: {
paymentState: { in: ["paid", "refunding"] },
amount: { gte: 10000.0 }
}
) {
nodes {
id
amount
currency
paymentType
user {
id
name
email
}
}
}
}

The Payment API relates to:

  • Users: Each payment belongs to a user
  • Lineitems: A payment contains one or more line items representing purchased products
  • Invoices: A payment may have an associated invoice
  • Form submissions: A payment may carry the buyer’s answers to the custom checkout form

Below is a comprehensive view of fields available in the payments query:

query {
payments(
filter: {
id: { eq: "payment_123" } # Filter by ID (StringOperator)
amount: { gte: 100.0 } # Filter by amount (FloatOperator)
paymentState: { eq: "paid" } # Filter by state (StringOperator)
paidAt: { gte: 1704067200 } # Filter by paid timestamp (IntOperator)
refundedAt: { gte: 1704067200 } # Filter by refund timestamp (IntOperator)
createdAt: { gte: 1704067200 } # Filter by creation timestamp (IntOperator)
tradeNo: { eq: "T20250101001" } # Filter by trade number (StringOperator)
},
page: 1, # Page number (Int)
perPage: 20 # Items per page (Int)
) {
nodes {
id # Unique identifier (String!)
tradeNo # Trade/transaction number (String)
# Financial information
amount # Payment amount (Float!)
currency # Currency code (String!)
currencySymbol # Currency symbol (String!)
discountAmount # Discount applied (Float)
refundedAmount # Amount refunded (Float)
refundAmount # Current refund amount (Float!)
# Payment details
paymentType # Payment method (String)
installment # Credit card installment period (Int)
affiliateCode # Affiliate tracking code (String)
remark # Additional notes (String)
# Timestamps (Unix)
paidAt # When payment was completed (Int)
refundedAt # When payment was refunded (Int)
expiredAt # When payment expired (Int)
createdAt # When record was created (Int!)
updatedAt # When record was last updated (Int!)
# Related objects
user { # Payment user (AdminUser!)
id
email
name
}
lineitems { # Purchased items ([Lineitem])
name
amount
itemType
}
invoice { # Associated invoice (Invoice)
id
number
state
}
formSubmission { # Checkout form answers (AdminFormSubmission); needs members:read or students:read besides orders:read
id
formId
answers { # ([AdminFormAnswer!]!)
fieldId
label
fieldType
deleted
values
}
}
}
# Pagination information
currentPage # Current page number (Int!)
hasNextPage # Whether there are more pages (Boolean!)
hasPreviousPage # Whether there are previous pages (Boolean!)
nodesCount # Total number of items across all pages (Int!)
totalPages # Total number of pages (Int!)
}
}