What are the best practices with transfer history workflow?

Basically, there are 4 types of transfers present in the business logic of the application I am working on:

  1. Dwolla Wallet → Dwolla Wallet
  2. Dwolla Wallet → Bank account
  3. Bank account → Dwolla Wallet
  4. Bank account → Bank account

After doing some research on the forum I have discovered, that storing the trasnfers data and updating it when related webhooks hit the server is a great approach. Up to this moment, I am receiving webhook events and updaing a transfer record status extracting the status from the event topic. But, because of the fact, that there are several transfer-related entites get created in the Dwolla system for the trasnfer types 2-4, it sets created status several times when it should not, logically.
Unfortunately, I could not invent a universal approach on how to track transfer statuses properly for each of the transfer types. It is said in the docs that webhook events are sent in async order, so I cannot rely on their arrival time. Could you, please, provide some pieces of advice on how to process events and set the status properly, as well as figuring out the latest transfer status available.

I use correlation id in order to distinguish orders one from another.

Thanks, in advance.

Hi @kostyabek – you’re on the right track! Using correlationIds is a great way to correlate the different transfer related webhooks to the main resource.

Each transfer in Dwolla goes through several hoops. For transfer type 4, the flow looks like this,

Sender A’s Bank → Sender’s A’s Dwolla Balance
Sender A’s Dwolla Balance → Receiver B’s Dwolla Balance
Receiver B’s Dwolla balance → Receiver B’s Bank
Dwolla Network → Bank

For all of these events you can expect to receive specific webhooks. This lets you understand where the funds are at a given moment. These webhooks and their sequences are mentioned in details in the following Gists -

By understanding the sequence of the webhooks, you should be able to process them in that order and update your status accordingly. Check them out and let me know if you come across any questions!

Hope this helps!

Those gists give a bit more explanation, thats great, but are there any similar ones for the second and the third type?

I’m afraid there aren’t for type 2 and 3. You could infer them from the the gists posted above though!

So, basically, to understand whether the transfer has fully been processed and completed I would have to listen for such kinds of events:

  1. Wallet → Wallet (customer_trasnfer_completed)
  2. Wallet → Bank (customer_bank_transfer_completed)
  3. Bank → Wallet (customer_transfer_completed)
  4. Bank → Bank (customer_bank_transfer_completed)
    where all of the listed above events are related to the receiver, am I right?

Hi Kostiantyn. that is correct!

1 Like