Let's assume that you have a webhook subscription and Dwolla has just delivered the following payload to your specified endpoint:
{
"id": "cac95329-9fa5-42f1-a4fc-c08af7b868fb",
"resourceId": "cdb5f11f-62df-e611-80ee-0aa34a9b2388",
"topic": "customer_transfer_created",
"timestamp": "2017-01-20T22:45:12.790Z",
"_links": {
"self": {
"href": "https://api-sandbox.dwolla.com/events/cac95329-9fa5-42f1-a4fc-c08af7b868fb"
},
"account": {
"href": "https://api-sandbox.dwolla.com/accounts/ad5f2162-404a-4c4c-994e-6ab6c3a13254"
},
"resource": {
"href": "https://api-sandbox.dwolla.com/transfers/cdb5f11f-62df-e611-80ee-0aa34a9b2388"
},
"customer": {
"href": "https://api-sandbox.dwolla.com/customers/e358a488-6699-4d79-bbfb-c5bf58100ea4"
}
},
"created": "2017-01-20T22:45:12.790Z"
}
For illustrative purposes, let's assume you are using Ruby on Rails with a controller defined to handle the POST request from Dwolla's servers. Your application logic will look a little something like this:
require 'dwolla_swagger'
if params[:topic] == 'transfer_completed'
transfer = DwollaSwagger::TransfersApi.by_id(params[:links][:resource][:href])
transfer._embedded.each do |k, v|
# Retrieve customer info from your database
# or from Dwolla here, and then send notifications
end
elsif params[:topic] == 'another_event'
"..."
end
Let's recap. From the event we can retrieve the transfer
and then take a look at the _links
object and retrieve the customers
that need to be notified. From here, you can make a call to customers/{id}
to retrieve their e-mail addresses (or to your own database) so that you can send your notification message.
That's it! You’ve learned the basics of webhooks.
Use sandbox environment to test API requests.
Dwolla, Inc. is the operator of a software platform that communicates user instructions for funds transfers to our financial institution partners.
Dwolla is an agent of Veridian Credit Union. All ACH and Wire transfers are performed by Veridian Credit Union. Your Dwolla Balance, if any, is held in one or more pooled holding accounts held by Veridian Credit Union. These funds may not be eligible for share insurance by the National Credit Union Share Insurance Fund.
Sponsorship and Settlement of Push-to-Debit payment services provided by MetaBank®, N.A.
Push-to-Debit payments are typically available within 30 minutes.
Real-Time Payments are performed by Cross River Bank, which holds funds on behalf of the Receiver of such transactions in one or more pooled custodial accounts. These funds are not subject to FDIC pass-through deposit insurance.