Event webhook subscription explaination


(Mass Venture) #1

Can you explain a flow that for listening to the completion of a transfer?

I can make transfers and I get back and storing a transfer url to check the status, however you mentioned it would be best to create a webhook.

The docs show how to create a webhook and what url to ping on our end. How do I tie the current transfer in question to a webhook url.


(Ben) #2

After you subscribe to a webhook using the POST /webhook-subscriptions endpoint Dwolla will call your server with the following webhook topics(assumes they are bank transfers) during the lifespan of each bank transfer:

bank_transfer_created
bank_transfer_cancelled
bank_transfer_failed
bank_transfer_completed

In the webhook’s POST request body you can get the transfer’s Dwolla id:

transfer_id = event_body[:_links][:resource][:href]

Using that transfer_id you can lookup the transfer on your end and update your data accordingly.