Manage your transactions

Now that you manage the lifecycle of your connections it is important to manage your transactions updates.

In tracking your transactions, understanding the dates associated with each transaction is crucial. There are five different dates that may be relevant to your case study:

  • Date (date)
  • Value Date (valueDate): The value date is the reference date used by the bank to record the transaction as either a credit or a debit.
  • Transaction Date (transactionDate): This date signifies when the banking transaction is carried out, but the balance is not affected.
  • Booking Date (bookingDate): The booking date is the actual date when the transaction is posted to the account.
  • Updated Transaction Timestamp (updated_at): This timestamp represents the date and time when the transaction was last updated internally by Bridge.

📘

Please note that not all providers will provide all of these dates. If a particular date cannot be found, it will not be included in the API response. However, the date field will always be filled and will correspond to one of the three other dates, depending on the provider.

These dates fields are available on these endpoints:

In order to prevent duplicated transactions the date and the updated_at parameters are important to manage correctly.

The first step is to use the endpoint List transactions and to a GET without the since parameter and to store the field updated_at in your database. If you need to, you can limit the history fetched with the date parameter.

curl --request GET \
     --url https://api.bridgeapi.io/v3/aggregation/transactions \
     --header 'accept: application/json'
{
  "resources": [
    {
      "id": 33000191035700,
      "clean_description": "CB Mad Cours Marjane M.m G",
      "provider_description": "PAIEMENT PAR CARTE 09/11/2024 73.6 MAD COURS 0.09402 MARJANE M.M G",
      "amount": -6.92,
      "date": "2024-11-09",
      "booking_date": "2024-11-09",
      "transaction_date": "2024-11-09",
      "value_date": "2024-11-09",
      "updated_at": "2024-11-09T18:10:10.143Z",
      "currency_code": "EUR",
      "deleted": false,
      "category_id": 249,
      "operation_type": "card",
      "account_id": 48178050,
      "future": false
    },
    {
      "id": 33000191035701,
      "clean_description": "CB Idfs G",
      "provider_description": "PAIEMENT PAR CARTE 25/11/2024 IDFS T2 G",
      "amount": -194,
      "date": "2024-11-25",
      "booking_date": "2024-11-25",
      "transaction_date": "2024-11-25",
      "value_date": "2024-11-25",
      "updated_at": "2024-11-25T16:10:10.144Z",
      "currency_code": "EUR",
      "deleted": false,
      "category_id": 247,
      "operation_type": "card",
      "account_id": 48178050,
      "future": false
    }
  ],
  "generated_at": "2024-11-25T16:41:18.533Z",
  "pagination": {
    "next_uri": "/v3/aggregation/transactions?after=MTczMjExOTAxMDE0MjozMzAwMDE5MTAzNTY5OQ&limit=50"
  }
}

Then after receiving the webhook item refresh or account refresh

{  
  "content": { 
    "account_types": "payment",
    "full_refresh": true,  
    "refresh_trigger":"scheduler",
    "item_id": 7984384,  
    "status_code": 0,  
    "status_code_info": "OK",  
    "user_uuid": "806eda23-a648-426d-b4b1-615035fc60be"  
  },  
  "timestamp": 1686230311473,  
  "type": "item.refreshed"  
}

Make a second GET with the parameter since with the date : updated_at stored previously

curl --request GET \
     --url 'https://api.bridgeapi.io/v3/aggregation/transactions?limit=50&since=2024-11-24T12%3A46%3A18.971Z' \
     --header 'accept: application/json'
{
  "resources": [
    {
      "id": 33000191035701,
      "clean_description": "CB Idfs G",
      "provider_description": "PAIEMENT PAR CARTE 25/11/2024 IDFS T2 G",
      "amount": -194,
      "date": "2024-11-25",
      "booking_date": "2024-11-25",
      "transaction_date": "2024-11-25",
      "value_date": "2024-11-25",
      "updated_at": "2024-11-25T16:10:10.144Z",
      "currency_code": "EUR",
      "deleted": false,
      "category_id": 247,
      "operation_type": "card",
      "account_id": 48178050,
      "future": false
    }
  ],
  "generated_at": "2024-11-25T16:41:18.533Z",
  "pagination": {
    "next_uri": "null"
  }
}

By doing so, you'll avoid any deleted = true and prevents any duplicate transactions without having to create too many checks.