The transactions model allows setting three parameters.
fields: a list of fields
filters: a dictionary of filters
sort: a list of sorting fields
fields
Fields allow you to select which columns to export in the report.
| Field |
id |
external_identifier |
status |
created_at |
updated_at |
authorized_at |
captured_at |
voided_at |
amount |
currency |
captured_amount |
refunded_amount |
method |
scheme |
payment_service_transaction_id |
payment_service_id |
payment_service_definition_id |
payment_service_display_name |
auth_response_code |
raw_response_code |
raw_response_description |
metadata |
is_subsequent_payment |
merchant_initiated |
payment_source |
three_d_secure_status |
three_d_secure_eci |
three_d_secure_auth_resp |
three_d_secure_method |
buyer_external_identifier |
billing_details_first_name |
billing_details_last_name |
billing_details_email_address |
billing_details_phone_number |
billing_details_address_city |
billing_details_address_country |
billing_details_address_postal_code |
billing_details_address_state |
billing_details_address_state_code |
billing_details_address_house_number_or_name |
billing_details_address_line1 |
billing_details_address_line2 |
billing_details_address_organization |
billing_details_tax_id |
billing_details_tax_id_kind |
authorized_amount |
intent_outcome |
gift_card_redemptions_amount |
gift_card_redemption_refunds_amount |
settled |
settled_currency |
settled_amount |
All fieldsIf all fields should be included in a report, just set fields as null
filters
Filters allow you to filter the transactions’ data to be exported.
| Value | Type | Validation |
authorized_at | dict[str, str] | See Date-time filter below for more details |
captured_at | dict[str, str] | See Date-time filter below for more details |
created_at | dict[str, str] | See Date-time filter below for more details |
currency | str | Valid ISO 4217 currency code |
metadata | list[dict[str, str]] | List of string-to-string dictionaries |
method | list[str] | List of valid methods |
scheme | list[str] | List of valid schemes |
status | list[str] | This should be a list |
is_subsequent_payment | bool | Boolean indicating transactions with subsequent payments |
merchant_initiated | bool | Boolean indicating transactions initiated by the merchant |
payment_source | list[str] | List of valid transaction sources |
three_d_secure_status | list[str] | List of valid 3DS statuses |
three_d_secure_eci | list[str] | This should be a list |
three_d_secure_auth_resp | list[str] | This should be a list |
updated_at | dict[str, str] | See Date-time filter below for more details |
voided_at | dict[str, str] | See Date-time filter below for more details |
No filtersIf no filters should be applied, just set filters as null
Date-time filter
A date-time filter could be defined as follows.
{
"start": str
"end": str
}
start and end allow three types of values:
- Valid ISO 8601 timestamp with or without timezone. UTC is assumed if the time zone is not specified.
- Date-time placeholder to be set dynamically
null: this represents an open range
The available placeholders for dynamic timestamps are:
day_start: replaced with the first instant of the day, for the period of time the execution is reading data from.
day_end: replaced with the last instant of the day, for the period of time the execution is reading data from.
week_start: replaced with the first instant of the week (i.e. Monday at 00:00), for the period of time the execution is reading data from.
week_end: replaced with the last instant of the week (i.e. Sunday at 23:59), for the period of time the execution is reading data from.
month_start: replaced with the first instant of the month, for the period of time the execution is reading data from.
month_end: replaced with the last instant of the month, for the period of time the execution is reading data from.
Validations
The validations below are checked:
start <= end, only when both are timestamps
start and end cannot be null at the same time
sort
The sort parameter allows you to choose how to sort the data exported. This allows you to use multiple columns for sorting.
Sorting is only applied if at least one date-time filter is present with a duration of 31 days or less.
A sort parameter should have the format:
{
"field": str
"order": str
}
field can be:
authorized_at
captured_at
created_at
updated_at
voided_at
order can be:
asc: ascending order
desc: descending order
No sortingIf no sorting should be applied, just set sort as null
Example
Example of report creation using the transactions model.
{
"name": "Test report",
"spec": {
"model": "transactions",
"params": {
"fields": ["id", "created_at"],
"filters": {
"status": ["capture_succeeded"],
"created_at": {
"start": "month_start",
"end": "month_end"
}
},
"sort": [
{
"field": "created_at",
"order": "desc"
}
]
}
}
}