Open Bankin Visa Flow

Hello, I am a developer and I want to implement the creation of a funding source using open bankin visa flow described here: https://developers.dwolla.com/docs/balance/open-banking/visa

The problem is that in Step 3: Handle User Redirect we receive in callback only one property: exchange or error and to create a funding source you have to send a post request to this endpoint:

customers/${customerId}/funding-sources

but where I can get customerId if I only properties that I receive in callback is exchange or error?

Hi @mykhailokrachun,

The customerId is not provided in the callback from the Visa IAV flow. It is something that your application should already have when you create an exchange session for that customer. It could likely be stored in your session or a state within your app, or when you receive the callback from the Visa IAV flow, you could look up the customerId in your database based on the user who is currently logged in to your application.

Hope this helps!

Thanks for reply, but callback url that will be used in Visa IAV flow is backend url with get request - not front-end, front-end does not produce callback urls and sessions is used on front-end only. Only data that is being sent with callback can be retrieved in callback url, so it’s only exchnage or error. So please give me another solution

You should be able to get the customer Id based on the user who is currently logged in.

Here’s how you could handle this:

  1. User Session Management:

    • When a user logs into your application, their session or profile data should already include the customerId that you’ve stored in association with their account in Dwolla.
  2. Initiate the Visa IAV Flow:

    • When you generate the exchange session at the start of the Visa IAV flow, you use this customerId. Since it’s tied to the logged-in user, you don’t need to worry about retrieving it later.
  3. Handle the Redirect:

    • Once the user completes the Visa flow, they are redirected to the redirect URL which has the exchange ID appended as a query param.
    • At this point, you can retrieve the customerId from the logged-in user’s session or your database.
  4. Create the Funding Source:

    • With both the customerId (from the session) and the exchange ID (from the redirect URL), you can proceed to create the funding source using Dwolla’s API.

Hope this helps!

I am sorry, but this doesn’t helps, all data that is being retrieved before I get URL to visa website - includes contact id and other info, that’s being retrieved on front end, when visa flow ended - get request is being sent to BACKEND url, backend don’t have access to contact id, only to info that I being provided by your service, so it’s only exchange and error. If that’s not true, please provide code sample for this problem, code that you uploaded on GitHub as examples doesn’t shows how to solve this issue.

Hey @mykhailokrachun, another option would be to retrieve the customer information directly from the exchange.

Once you receive the exchangeId in the callback, you can make a GET request to Dwolla’s API to retrieve the exchange details. This response should include a link to the customerId, which you can then use to create the funding source!

Hope this helps!

Thanks, I am also checked this option and sadly I can’t retrieve customerId from exchange details after sending GET request. You can check by yourself that there is no info about contact: Retrieve an exchange | Dwolla API Documentation

Ah, the documentation likely needs updating. We will work on that.

Rest assured, you should be able to get the CustomerID info in the exchange resource. Please give it try and let us know if you run into any issues!

Here’s an example:

GET https://api-sandbox.dwolla.com/exchanges/61ef9e47-e483-4e3f-9afb-940ad74b848d
. . .
{
    "_links": {
        "self": {
            "href": "https://api-sandbox.dwolla.com/exchanges/61ef9e47-e483-4e3f-9afb-940ad74b848d",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "exchange"
        },
        "exchange-partner": {
            "href": "https://api-sandbox.dwolla.com/exchange-partners/bca8d065-49a5-475b-a6b4-509bc8504d22",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "exchange-partner"
        },
        "customer": {
            "href": "https://api-sandbox.dwolla.com/customers/c604420d-5b36-407c-ab37-097a1066e1b2",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "customer"
        }
    },
    "id": "61ef9e47-e483-4e3f-9afb-940ad74b848d",
    "status": "active",
    "created": "2024-09-05T14:50:07.643Z"
}

Thank you, this should solve the problem. I’ll let you know after testing.