Skip to main content
Version: Live

Transaction

Transactions are a data object that can represent a payment, failed or successful, or a refund.


The Transaction Object​

{
account_code: String
ach_return_details: AchReturnDetails
authorization_id: String!
avs_status: String
currency: String
dispute_status: DisputeStatus
failure_reasons: [String]
fee_mode: FeeMode
fees: Int
flag_for_review: TransactionReviewStatus
invoice: Invoice
is_settled: Boolean
gross_amount: Int
merchant: ListMerchant
merchant_uid: String
metadata: AWSJSON
net_amount: Int
parent_id: String
payment_method: PaymentMethodToken
recurring: RecurringPayment
reference: String
refund_reason: RefundReason
refund_voidable: Boolean
refunded_amount: Int
sale_id: String
settlement_batch: Int
splits: [Split]
status: TransactionStatus
timezone: String
transaction_date: AWSDateTime
transaction_id: String
transaction_type: TransactionType
updated_row_at: AWSDateTime
}
Keytypedescription
account_codeStringCustomer defined account code for the transaction.
ach_return_detailsAchReturnDetailsThe details of the ACH return if any.
authorization_idStringThe authorization id for the transaction.
avs_statusStringThe AVS status for the transaction.
currencyStringThe type of currency for the transaction.
dispute_statusDisputeStatusThe status of the dispute if any.
failure_reasons[String]List of strings, if any, detailing the reason a transaction failed. See Failure Codes for a complete list of failure codes and descriptions.
fee_modeFeeModeThe fee mode on the transaction.
feesIntThe amount of the fees charged for the transaction.
flag_for_reviewTransactionReviewStatusA status indiciator for any transactions that are in review. When a transaction is in review the funds will not settle to the merchant until resolved.
invoiceInvoiceThe invoice object for the transaction if any.
is_settledBooleanWhether the transaction has been settled.
gross_amountIntThe total amount of the transaction.
merchantListMerchantThe merchant object of the merchant the transaction belongs to.
merchant_uidStringThe Pay Theory unique identifier for the merchant the transaction is for.
metadataAWSJSONCustom defined JSON object to be stored with the transaction.
net_amountIntThe total amount of the transaction after fees.
parent_idStringThe Pay Theory unique identifier for the parent transaction if any.
payment_methodPaymentMethodTokenThe payment method used to make the transaction.
recurringRecurringPaymentThe recurring payment that the transaction belongs to if any.
referenceStringCustomer defined reference for the transaction.
refund_reasonRefundReasonThe reason for the refund if any.
refund_voidableBooleanWhether the refund can be voided.
refunded_amountIntThe amount of the transaction that has been refunded if any.
sale_idStringThe sale id for the transaction if any.
settlement_batchIntThe unique settlement batch number the transaction belongs to if settled.
splits[Split]An array of split objects associated with this transaction, if any.
statusTransactionStatusThe status of the transaction.
timezoneStringThe timezone the transaction was made in.
transaction_dateAWSDateTimeThe date the transaction was made.
transaction_idStringThe Pay Theory unique identifier for the transaction.
transaction_typeTransactionTypeThe type of transfer that was made.
updated_row_atAWSDateTimeThe date and time the transaction was last updated.

Ach Return Details​

{
return_code: String
return_details: String
transfer_type: AchReturnTransferType
}
Keytypedescription
return_codeStringThe return code for the ACH return.
return_detailsStringThe details of the ACH return.
transfer_typeAchReturnTransferTypeThe type of transfer that the ACH return is for.

Ach Return Transfer Type​

  • DEBIT - The ACH return is going to debit the merchant funds.
  • CREDIT - The ACH return is going to credit the merchant funds.

Refund Reason​

{
reason_code: RefundReasonCode
reason_details: String
}
Keytypedescription
reason_codeRefundReasonCodeThe reason code for the refund.
reason_detailsStringThe details of the refund reason.

Refund Reason Code​

  • DUPLICATE
  • FRAUDULENT
  • OTHER
  • REQUESTED_BY_CUSTOMER

Transaction Status​

  • PENDING - The transaction is succesfull pending capture. This is what will be returned for all transactions that did not fail.
  • SUCCEEDED - The transaction has been captured.
  • FAILED - The transaction failed to pass initial checks and authorization was not successful.
  • SETTLED - The transaction has been added to a settlement batch and will settle to the merchant.
  • REFUNDED - The transaction has been fully refunded.
  • PARTIALLY_REFUNDED - The transaction has been refunded for a portion of the amount.
  • VOIDED - The transaction has been voided which means it was never captured and will not be settled.
  • RETURNED - The transaction is an ACH transaction that has had an ACH_RETURN created for it.

Transaction Review Status​

  • EXCEEDS_AUTH - Transaction was flagged for greatly exceeding the auth amount.
  • EXCEEDS_THRESHOLD - Transaction was flagged for exceeding the threshold set on the merchant account by Pay Theory.
  • POTENTIAL_DUPLICATE - Transaction was flagged for being a potential duplicate based on settings configured in the partner environment.

Transaction Type​

  • ACH_RETURN - The transaction is an ACH return for an ACH Debit or Reversal. Check parent_id to find origin.
  • DEBIT - The transaction is a debit to a payors payment method.
  • FAILURE - The transaction is a failed debit to a payors payment method.
  • REVERSAL - The transaction is a reversal on a debit to a payors payment method. Check parent_id to find origin.

Query Transactions​

{
transactions(
direction: FORWARD
limit: 10
offset: ""
offset_id: ""
query: SqlQuery
) {
items {
account_code
currency
dispute_status
failure_reasons
fee_mode
fees
gross_amount
is_settled
merchant_uid
metadata(query_list: [])
net_amount
parent_id
payment_method(query_list: []) {
payment_method_id
payor(query_list: []) {
payor_id
}
}
recurring {
recurring_id
}
reference
refund_reason {
reason_code
reason_details
transfer_type
}
refunded_amount
settlement_batch
splits {
id
amount
account_code
reference
metadata
merchant {
merchant_uid
}
}
status
timezone
transaction_date
transaction_id
transaction_type
}
total_row_count
}
}

Arguments

Keytypedescription
directionMoveDirectionThe direction of the pagination. Makes sure the results are returned in the correct order.
limitIntThe number of transactions to return.
offsetStringThe value of the offset item for which the list is being sorted.
offset_idStringThe transaction_id of the offset item.
querySqlQueryThe query to filter the transactions with based on Pay Theory defined data. Detailed information about the query object can be found here.

Nested Queries Transactions can also be filtered by passing a query_list to the metadata, payment method, or payor tied to the payment method.

This will only return Transactions that have Metadata, Payment Methods, or Payors that match these queries. Detailed information about the query list can be found here.

Returns

{
"data": {
"transactions": {
"items": [
{
"transaction_id": "pt-start-paytheorylab-rbdg98004adg"
},
{
"transaction_id": "pt-start-paytheorylab-rbdgaf004adh"
},
...
],
"total_row_count": 256
}
}
}
Keytypedescription
items[Transaction]The list of transactions that are returned from the query.
total_row_countIntThe total number of transactions that match the query. Used to help with pagination.

Create Transaction​

mutation {
createTransaction(
amount: Int
merchant_uid: String
payment_method_id: String
payment_method: PaymentMethodInput
account_code: String
currency: String
fee: Int
fee_mode: FeeMode
invoice_id: String
metadata: JSON
one_time_use_token: Boolean
receipt_description: String
recurring_id: String
reference: String
send_receipt: Boolean
split: [SplitInput]
) {
account_code
currency
dispute_status
failure_reasons
fee_mode
fees
gross_amount
is_settled
merchant_uid
metadata
net_amount
parent_id
payment_method {
payment_method_id
payor {
payor_id
}
}
recurring {
recurring_id
}
reference
refund_reason {
reason_code
reason_details
transfer_type
}
refunded_amount
settlement_batch
splits {
id
amount
account_code
reference
merchant {
merchant_uid
}
metadata
}
status
timezone
transaction_date
transaction_id
transaction_type
}
}

Arguments

Keytypedescription
amountInt!The amount of the transaction. If the FeeMode is SERVICE_FEE, this is the amount of the transaction before fees.
merchant_uidString!The Pay Theory unique identifier for the merchant the transaction is for.
payment_method_idStringThe Pay Theory unique identifier for the payment method the transaction will be charged to.
payment_methodPaymentMethodInputThe payment method to be used for the transaction. This is required if you are not passing in a payment_method_id.
account_codeStringCustomer defined account code for the transaction.
currencyStringThe type of currency for the transaction. Defaults to USD.
feeIntThe amount of the fee that will be charged to the payor for the transaction if the FeeMode is SERVICE_FEE.
fee_modeFeeModeThe fee mode on the transaction. SERVICE_FEE charges the fees to the payor. MERCHANT_FEE charges the fees to the merchant. Options are:
invoice_idStringThe Pay Theory unique identifier for the invoice the transaction is for.
metadataJSONCustom defined JSON object to be stored with the transaction.
one_time_use_tokenBooleanIf the payment method token should be used for a single transaction. Defaults to false. If set to true the is_active flag on the payment method will be set to false after the transaction
receipt_descriptionStringThe description of the transaction that will be displayed on the receipt.
recurring_idStringThe Pay Theory unique identifier for the recurring payment the transaction is for.
referenceStringCustomer defined reference for the transaction.
send_receiptBooleanIf the receipt should be sent to the payor. Defaults to false. It is sent to the email address on file with the payment method.
split[SplitInput]An array of split objects to distribute the transaction amount to different accounts. The sum of all split amounts must equal less than or equal to the amount of the transaction.

Returns

This call will return a Transaction object with the details of the transaction that was created.


Create Wallet Transaction​

This call is used to create a transaction for a wallet payment via Apple Pay or Google Pay. It works in conjunction with our SDKs to allow you to create a transaction via our API.

mutation {
createWalletTransaction(
app_id: String,
merchant_uid: String!,
wallet_type: WalletType,
digital_wallet_payload: String!,
amount: Int,
fee: Int,
billing_address: BillingAddressInput,
payor_id: String,
payor: PayorInput,
recurring_id: String,
invoice_id: String,
account_code: String,
reference: String,
send_receipt: Boolean,
receipt_description: String,
metadata: AWSJSON,
health_expense_type: HealthExpenseType,
additional_purchase_data: AdditionalPurchaseDataInput,
split: [SplitInput]) {
account_code
currency
dispute_status
failure_reasons
fee_mode
fees
gross_amount
is_settled
merchant_uid
metadata
net_amount
parent_id
payment_method {
payment_method_id
payor {
payor_id
}
}
recurring {
recurring_id
}
reference
refund_reason {
reason_code
reason_details
transfer_type
}
refunded_amount
settlement_batch
status
timezone
transaction_date
transaction_id
transaction_type
}
}

Arguments

Keytypedescription
app_idStringThe Pay Theory unique identifier for the application.
merchant_uidString!The Pay Theory unique identifier for the merchant the transaction is for.
wallet_typeWalletTypeThe type of digital wallet being used. Can be one of: APPLE_PAY, GOOGLE_PAY, CLICK_TO_PAY, SAMSUNG_PAY, VISA_STAGED
digital_wallet_payloadString!The encrypted payload from the PayTheory SDK containing payment information.
amountIntThe amount of the transaction in cents.
feeIntThe amount of the service fee in cents. Required if fee_mode is SERVICE_FEE.
billing_addressBillingAddressInputThe billing address information for the transaction.
payor_idStringThe Pay Theory unique identifier for the payor making the payment.
payorPayorInputThe payor information if a new payor needs to be created.
recurring_idStringThe Pay Theory unique identifier for the recurring payment the transaction is for.
invoice_idStringThe Pay Theory unique identifier for the invoice the transaction is for.
account_codeStringCustomer defined account code for the transaction.
referenceStringCustomer defined reference for the transaction.
send_receiptBooleanIf the receipt should be sent to the payor. Defaults to false. It is sent to the email address on file with the payment method.
receipt_descriptionStringThe description of the transaction that will be displayed on the receipt.
metadataAWSJSONCustom defined JSON object to be stored with the transaction.
health_expense_typeHealthExpenseTypeThe type of health expense for the transaction. Can be one of: CLINICAL, COPAY, DENTAL, HEALTHCARE, RX, TRANSIT, VISION
additional_purchase_dataAdditionalPurchaseDataInputAdditional purchase data for Level 3 processing requirements.
split[SplitInput]An array of split objects to distribute the transaction amount to different accounts. The sum of all split amounts must equal the transaction amount.

Returns

This call will return a Transaction object with the details of the transaction that was created.


Create Reversal​

This call will create a refund or a void for a transaction.

mutation {
createReversal(
amount: Int
refund_reason: { reason_code: RefundReasonCode, reason_details: String }
transaction_id: String
refund_email: String
) {
is_void
transaction_id
}
}

Arguments

Keytypedescription
amountIntThe amount of the refund. This must be less than or equal to the amount of the transaction.
refund_reasonRefundReasonThe reason for the refund. This is required for all refunds and is made up of the following.
transaction_idStringThe Pay Theory unique identifier for the transaction to refund.
refund_emailStringThe email address to send the refund receipt to. If not provided an email will not be sent out.

Returns

Keytypedescription
is_voidBooleanIf the reversal was a void. If true, the reversal was a void. If false, the reversal was a refund.
transaction_idStringThe Pay Theory unique identifier for the transaction that was created due to the call.
Understanding Create Reversal Return Values

The response will vary based on transaction timing and amount:

  1. Full void (before capture)

    • Returns: is_void: true, transaction_id: null
    • Result: Transaction completely voided, no funds movement or fees
  2. Partial void (before capture)

    • Returns: is_void: true, transaction_id: "pt_txn_..."
    • Result: Original transaction voided; returned transaction_id is the new transaction created for the adjusted amount and will settle
  3. Refund (after capture)

    • Returns: is_void: false, transaction_id: "pt_txn_..."
    • Result: New REVERSAL transaction created; both original and refund transactions will settle

Calculate Service Fee​

This call will allow you to calculate what the fee amount should be if using SERVICE_FEE for a transaction.

{
serviceFee(
amount: Int
merchant_uid: String
is_ach: Boolean
bank_id: String
payment_method_id: String
) {
adjusted_total
fee
fee_limit_reached
total
}
}

Arguments

Keytypedescription
amountIntThe amount of the transaction.
merchant_uidStringThe Pay Theory unique identifier for the merchant the transaction is for.
is_achBooleanIf the transaction is an ACH transaction.
bank_idStringThe first 6 to 8 digits of a card number. An error will be thrown if it is any other length.
payment_method_idStringThe Pay Theory unique identifier for a tokenized payment method to calculate fees for.

Returns

Keytypedescription
adjusted_totalIntThe total amount of the transaction after fees.
feeIntThe amount of the fees charged for the transaction.
fee_limit_reachedBooleanIf the fee limit has been reached for the transaction.
totalIntThe amount of the transaction before adding fees.

Send Transaction Receipt​

This call will send a receipt for a transaction to the email address on file with the payor or an email passed in.

mutation MyMutation(
$email: AWSEmail
$receipt_description: String
$transaction_id: String!
) {
createReceiptEmail(
transaction_id: $transaction_id
email: $email
receipt_description: $receipt_description
)
}

Arguments

Keytypedescription
transaction_idString!The Pay Theory unique identifier for the transaction to send the receipt for.
emailAWSEmailThe email address to send the receipt to. If not provided the email address on file with the payor will be used.
receipt_descriptionStringThe description of the transaction that will be displayed on the receipt. If not provided it will just say "Payment to merchant_name".

Returns

The call will return a boolean true if the receipt was sent successfully or errors if it fails.


Update Transaction In Review​

This call can be used by a partner to approve or decline a transcation that is in review for reason POTEENTIAL_DUPLICATE.

mutation MyMutation(
$action: TransactionReviewAction!
$transaction_id: String!
) {
updateTransactionInReview(action: $action, transaction_id: $transaction_id)
}

Arguments

Keytypedescription
actionTransactionReviewAction!The action to take on the transaction. Options are: ACCEPT or REJECT.
transaction_idString!The Pay Theory unique identifier for the transaction to accept or reject.

Returns

The call will return a boolean true if the transaction was updated successfully or errors if it fails.


AdditionalPurchaseDataInput Object​

The additional purchase data input object is used to provide Level 3 processing data for transactions. This data is typically required for commercial card transactions to qualify for lower interchange rates.

input AdditionalPurchaseDataInput {
level3_data_line_item: [Level3DataLineItemInput]
level3_data_summary: Level3DataSummaryInput
}
Keytypedescription
level3_data_line_item[Level3DataLineItemInput]Array of line item details for the transaction
level3_data_summaryLevel3DataSummaryInputSummary data for the entire transaction

Level3DataLineItemInput Object​

The Level 3 line item data provides detailed information about individual items in a transaction.

input Level3DataLineItemInput {
item_code: String
item_description: String
item_qty_exp: Int
prod_code: String
qty: Int
tax_amount: Int
tax_ind: TaxIndicatorType
tax_rate: Int
tax_rt_exp: Int
tax_type_id: TaxType
unit_cost: Int
unit_of_msure: String
}
Keytypedescription
item_codeStringThe merchant's unique identifier for the item
item_descriptionStringA description of the item
item_qty_expIntThe exponent for the item quantity (e.g., 2 for hundredths)
prod_codeStringThe product code for the item
qtyIntThe quantity of the item purchased
tax_amountIntThe tax amount for this line item in cents
tax_indTaxIndicatorTypeIndicates how tax is applied to this item
tax_rateIntThe tax rate applied to this item
tax_rt_expIntThe exponent for the tax rate (e.g., 4 for ten-thousandths)
tax_type_idTaxTypeThe type of tax applied
unit_costIntThe unit cost of the item in cents
unit_of_msureStringThe unit of measure for the item (e.g., "EA" for each, "LB" for pounds)

Level3DataSummaryInput Object​

The Level 3 summary data provides high-level information about the entire transaction.

input Level3DataSummaryInput {
dest_postal_code: String
discnt_amt: Int
duty_amt: Int
frght_amt: Int
order_num: String
prod_desc: [String]
purch_idfr: String
tax_amt: Int
tax_ind: TaxIndicatorType
}
Keytypedescription
dest_postal_codeStringThe postal code of the destination for shipped goods
discnt_amtIntThe total discount amount in cents
duty_amtIntThe total duty amount in cents
frght_amtIntThe total freight/shipping amount in cents
order_numStringThe merchant's order number
prod_desc[String]Array of product descriptions included in the transaction
purch_idfrStringThe purchase identifier
tax_amtIntThe total tax amount for the transaction in cents
tax_indTaxIndicatorTypeIndicates how tax is applied to the transaction

TaxIndicatorType Enum​

The tax indicator type specifies how tax information is provided for a transaction or line item.

enum TaxIndicatorType {
NO_TAX_INFO_PROVIDED
NOT_TAXABLE
TAX_AMOUNT_PROVIDED
}
Valuedescription
NO_TAX_INFO_PROVIDEDNo tax information is being provided
NOT_TAXABLEThe item or transaction is not subject to tax
TAX_AMOUNT_PROVIDEDTax amount is included in the transaction data

TaxType Enum​

The tax type identifies the specific type of tax being applied.

enum TaxType {
CITY_SALES
ENERGY
GST
LOCAL_SALES
MUNICIPAL_SALES
NATIONAL_SALES
NOT_SUPPORTED
OTHER
PST
ROOM
OCCUPANCY
STATE_SALES
UNKNOWN
VAT
}
Valuedescription
CITY_SALESCity sales tax
ENERGYEnergy tax
GSTGoods and Services Tax (Canada)
LOCAL_SALESLocal sales tax
MUNICIPAL_SALESMunicipal sales tax
NATIONAL_SALESNational sales tax
NOT_SUPPORTEDTax type not supported
OTHEROther tax type
PSTProvincial Sales Tax (Canada)
ROOMRoom tax (hotels)
OCCUPANCYOccupancy tax
STATE_SALESState sales tax
UNKNOWNUnknown tax type
VATValue Added Tax