Basically, there are 4 types of transfers present in the business logic of the application I am working on:
Dwolla Wallet → Dwolla Wallet
Dwolla Wallet → Bank account
Bank account → Dwolla Wallet
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.
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!