Has anyone built their own transaction ID workaround for the Open API?

Hi there

Currently the Investec Open API transactional payload doesn’t include a transaction ID for each transaction.

Has anyone built a workaround for this on their side?

answer from Vincent Holtzhausen via Offerzen Slack

I recall that the temporary store of value (Here’s the transcript) one had something with transaction hashes that might work, but I don’t have anything specific.It’d be more like a transaction UUID, but just computing the MD5 hash of a transaction will give you a pretty damn unique identifier.

If you want to match programmable banking transactions to card transactions then you’d need to hash based on the constant values such as date, merchant name, amount.
Sample C# app below.

1 Like

Unfortunately even if one includes all fields such as: date, description, amount and balance, it is still sometimes not unique. For example, I seen when a transaction is attempted, fails for some reason (reversed) and is retried. In that case the first (failed) and second (successful) attempt both look identical (including the account balance).
If the transaction history is not too recent (a few days old), then a simple rowcount per day of transactionDate can be useful? e.g. The third transaction on Friday might look like “2020-10-30/3”.

1 Like

@edwardvk, the Python Open API implementation has code built in that generates a unique transaction hash for every transaction, even taking your comment about the date, description, and amount being the same.

Since the API will give you all the transactions in a day, it is easy to keep track of the hashes already generated and make a unique one if it already exists.

You can have a look at the repo https://gitlab.com/vchegwidden/investec-openbanking-python.

The specific code is:

    # Add a hash to each transaction
    processed_digests = list()
    for t in transactions:
        transaction_hash = hashlib.sha256()
        transaction_hash.update(t["postingDate"].encode("utf-8"))
        transaction_hash.update(t["description"].encode("utf-8"))
        transaction_hash.update(str(t["amount"]).encode("utf-8"))
        hex_digest = transaction_hash.hexdigest()
        while hex_digest in processed_digests:
            transaction_hash.update("a".encode("utf-8"))
            hex_digest = transaction_hash.hexdigest()
        processed_digests.append(hex_digest)
        t["transactionHash"] = hex_digest
1 Like

I have seen with other banks that the description can change for recent (pending?) transactions as the transaction reaches a final state.

Is it safe to assume that this does not happen?

Pending transactions aren’t returned by the API if I understood your question correctly.