Match transfers ids for customer and bank, webhook responses


(Victor Ruiz) #1

Hi, everyone,

I am developing using dwola sandbox environment, and i have this question, i hope you can help me with any advice:

  • I have already an active webhook subscription and when I send a transfer, using the API, from SuperHeroe Bank to a unverified customer account, I receive 3 responses from webhook: customer_transfer_created, transfer_created, bank_transfer_created… but just for the first two i can track it using the transfid (which is inside “_links” field). Me enquire is, how can i know, for a transfid, the relation between the 3 responses id… Here is an example of the responses:

{"id":"3287e8c6-0633-4208-9ffd-419312428213","resourceId":"55580fa5-590a-e911-8114-bacd823e9f1d","topic":"customer_transfer_created","timestamp":"2018-12-28T04:33:01.007Z","_links":{"self":{"href":"https://api-sandbox.dwolla.com/events/3287e8c6-0633-4208-9ffd-419312428213"},"account":{"href":"https://api-sandbox.dwolla.com/accounts/8c1c8776-b894-414c-8f49-005725529ce3"},"resource":{"href":"https://api-sandbox.dwolla.com/transfers/55580fa5-590a-e911-8114-bacd823e9f1d"},"customer":{"href":"https://api-sandbox.dwolla.com/customers/dbb11958-9dd9-47a8-a60b-99c33bacd429"}},"created":"2018-12-28T04:33:01.007Z"}

{"id":"adb3e9cc-726e-4105-b214-1c7baa7656d3","resourceId":"54580fa5-590a-e911-8114-bacd823e9f1d","topic":"bank_transfer_created","timestamp":"2018-12-28T04:33:01.152Z","_links":{"self":{"href":"https://api-sandbox.dwolla.com/events/adb3e9cc-726e-4105-b214-1c7baa7656d3"},"account":{"href":"https://api-sandbox.dwolla.com/accounts/8c1c8776-b894-414c-8f49-005725529ce3"},"resource":{"href":"https://api-sandbox.dwolla.com/transfers/54580fa5-590a-e911-8114-bacd823e9f1d"}},"created":"2018-12-28T04:33:01.152Z"}

Regards,

Victor R


(Spencer Hunter) #2

Hi @vmruiz, Thanks for reaching out! As you may have noticed, a single transaction can trigger multiple Events which are then delivered to your webhook subscription. You should receive webhooks for both parties involved in the transaction. (User A - Source & User B - Destination). For a payouts scenario like yours, you’ll have the parent account which is a Dwolla Account created by signing up on dwolla.com, as well as a white label Customer record, which belongs to that parent account. The parent Account is your main account and Customers are users you pay that receive funds to a connected bank account (aka Funding Source).

Any event that is prepended with customer_* belongs to a Customer resource in the API and any event that is not belongs to an Account resource.


You may also notice that the resourceId from the bank_transfer_created event is different than the resourceId for the customer_transfer_created event. When funds are sourced from a bank that is connected to an account type in the Dwolla system that has the ability to hold a balance in the Dwolla network then a unique transaction is created which represents funds moving from the bank connected to that account (in this case your parent Dwolla Account) to the balance of that account.

When initiating bank-to-bank transactions between two parties with Dwolla then there are essentially two sides to the transaction. #1 - The ACH debit (funds being pulled from a bank) and #2 - The ACH credit (funds being pushed to a bank).


If you’re looking to tie those two transactions together then Dwolla will return a few different links in the API when retrieving a transfer by it’s ID. Those links are called funding-transfer and funded-transfer. If the funded-transfer link is returned then that is a pointer to a transaction that is further ahead in the overall transaction lifecycle. If the funding-transfer link is returned then that is a pointer to a transaction that is further behind in the overall transaction lifecycle.

If you’re retrieving the transfer that is in the customer_transfer_created event from the API then you should see the funding-transfer link. That funding transfer link is a pointer to that transfer that is showing in the bank_transfer_created event. i.e.

{
    "_links": {
        "cancel": {
            "href": "https://api-sandbox.dwolla.com/transfers/a81aa941-9713-e911-8114-bacd823e9f1d",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "transfer"
        },
        "source": {
            "href": "https://api-sandbox.dwolla.com/accounts/ad5f2162-404a-4c4c-994e-6ab6c3a13254",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "account"
        },
        "funding-transfer": {
            "href": "https://api-sandbox.dwolla.com/transfers/a71aa941-9713-e911-8114-bacd823e9f1d",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "transfer"
        },
        "destination-funding-source": {
            "href": "https://api-sandbox.dwolla.com/funding-sources/a2152a8a-b1a6-4b5e-9354-79e2bb8753ee",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "funding-source"
        },
        "self": {
            "href": "https://api-sandbox.dwolla.com/transfers/a81aa941-9713-e911-8114-bacd823e9f1d",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "transfer"
        },
        "source-funding-source": {
            "href": "https://api-sandbox.dwolla.com/funding-sources/707177c3-bf15-4e7e-b37c-55c3898d9bf4",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "funding-source"
        },
        "destination": {
            "href": "https://api-sandbox.dwolla.com/customers/cb4a606d-67b2-4be5-950b-4066f08495bf",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "customer"
        }
    },
    "id": "a81aa941-9713-e911-8114-bacd823e9f1d",
    "status": "pending",
    "amount": {
        "value": "42.00",
        "currency": "USD"
    },
    "created": "2019-01-08T22:46:38.380Z",
    "clearing": {
        "source": "standard"
    }
}