View Card Transactions
Learn how to search for specific card transactions
If you need to search for transactions, there are two ways to go about it:
- Search for transactions for a particular card via our View Card Transactions endpoint. This will retrieve transactions for that particular card only
- Search for transactions across all cards you've issued via our List transactions endpoint.
Triggering either of these endpoints without any filters will retrieve all of the associated transactions that can be seen by the authenticated user, limited to the default pagination limit of 100.
For more details regarding how pagination works, see our Pagination documentation
In most cases, you would want to be more specific about which transactions you would like to retrieve. The primary filtering options we provide are:
- Retrieving transactions based on their transaction amount / authorization amount
- Retrieving transactions by the merchant who processed them
- Retrieving transactions by the transaction date
- Retrieving transactions by their associated card. Note that this only applies to the List transactions endpoint and gives equivalent functionality to the View Card Transactions endpoint if specified.
There are some other filters available, these are explained in the reference documentation.
Filtering With Dates
Note that when you are using date filters, our systems assume that the date provided is in UTC time. To ensure your queries return the correct results, please check that you provide the correct time format.
Example: List all transactions for the past week
import os
import requests
from datetime import datetime, timedelta, timezone
API_URL = "https://api.dba.thepennyinc.com/v1"
ACCESS_TOKEN = os.getenv("PENNY_ACCESS_TOKEN")
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}"
}
current_date = datetime.now(timezone.utc)
one_week_ago = current_date - timedelta(days=7)
parameters = {
"transaction_time_after_or_on": one_week_ago.strftime("%Y-%m-%dT%H:%M:%S"),
"transaction_time_before_or_on": current_date.strftime("%Y-%m-%dT%H:%M:%S")
}
response = requests.get(API_URL + "/transactions", params=parameters, headers=headers)
Example: List transactions for a particular card in the past week
import os
import requests
from datetime import datetime, timedelta, timezone
API_URL = "https://api.dba.thepennyinc.com/v1"
ACCESS_TOKEN = os.getenv("PENNY_ACCESS_TOKEN")
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}"
}
card_id = "<card-id>"
current_date = datetime.now(timezone.utc)
one_week_ago = current_date - timedelta(days=7)
parameters = {
"transaction_time_after_or_on": one_week_ago.strftime("%Y-%m-%dT%H:%M:%S"),
"transaction_time_before_or_on": current_date.strftime("%Y-%m-%dT%H:%M:%S")
}
response = requests.get(API_URL + f"/cards/{card_id}/transactions", params=parameters, headers=headers)
Updated over 1 year ago