Add Funding source using Plaid Token

Dear Support
Please guide me about the following issue. I am trying to create funding source using Plaid Token using the CURL request attached below:

But I am getting response (I have passed Customer Client Token as a Bearer):

stdClass Object
(
    [code] => InvalidScope
    [message] => Missing or invalid scopes for requested endpoint.
)

I also tried a request by using IAVToken, then I got following response:

stdClass Object
(
    [code] => InvalidAccessToken
    [message] => Invalid access token.
)

Thanks in Advance

Hey, @Heena,

Thank you for reaching out!

I tried to look up some of these requests, and I was only able to find a few where InvalidAccessToken was returned. This is returned because the Authorization header did not contain a valid access token. Before sending a request to Dwolla, make sure that you have generated an OAuth2 token that is subsequently supplied as an Authorization Bearer header.

As for InvalidScope, unfortunately, I was not able to find a request where this was returned in our logs; however, this has been known to happen in the past when the request body is not valid. For more information on the expected request body for creating a funding source via Plaid, I’d recommend checking out this guide. Additionally, if you’d like to see a working example on create a Dwolla funding source using a Plaid token, we have an open-source project dwolla-plaid-funding-source that should hopefully assist with this!

Finally, regarding the InvalidScope error, if you are able to send over the customer ID that this error is associated with as well as the approximate date/time that Dwolla sent this error to you, I can try to search in our logs again to see if I can find the specific request body that was sent.

Please let us know if you have any further questions!

Thanks,
James

Hi @james

Thank you for your reply. Let me try again and I will get back to you!!

hi @james

I am able to create Funding Source using Plaid Token successfully. But the curl Response is empty from Dwolla side. Although Funding Source is added to my customer. Any suggestions regarding this?

I have got following response if I tried to send duplicate request, but not for First time request.

stdClass Object
(
    [code] => DuplicateResource
    [message] => Bank already exists: id=83abcb88-2c5a-4b7a-bc99-385ac771a0d6
    [_links] => stdClass Object
        (
            [about] => stdClass Object
                (
                    [href] => https://api-sandbox.dwolla.com/funding-sources/********-****-****-****-********
                    [type] => application/vnd.dwolla.v1.hal+json
                    [resource-type] => funding-source
                )

        )

)

When a resource is created in Dwolla (i.e. HTTP status code 201 Created is returned), the response body will be empty. To grab the newly-created resource, you will want to grab the Location header instead. Then, once you have the Location URL, you can call a GET request on it to grab the resource information.

As an example, let’s say that your application sent the following request to Dwolla:

POST https://api-sandbox.dwolla.com/customers/15e8df87-0bda-4fc9-8395-780aabe9ed92/funding-sources

Accept: application/vnd.dwolla.v1.hal+json
Authorization: Bearer [YOUR OAUTH TOKEN HERE]
Content-Type: application/vnd.dwolla.v1.hal+json

{
  "routingNumber": "222222226",
  "accountNumber": "123456781",
  "type": "checking",
  "name": "Jane Doe - Checking"
}

...

HTTP/1.1 201 Created
Location: https://api-sandbox.dwolla.com/funding-sources/a72c694d-392e-4099-9872-d8fbbf1800a6

Now that you have the full URL for the created resource, you can execute a GET request on it:

GET https://api-sandbox.dwolla.com/funding-sources/a72c694d-392e-4099-9872-d8fbbf1800a6

Accept: application/vnd.dwolla.v1.hal+json
Authorization: Bearer [YOUR OAUTH TOKEN HERE]
Content-Type: application/vnd.dwolla.v1.hal+json

... 

HTTP/1.1 200 OK
{
    "_links": { ... },
    "id": "a72c694d-392e-4099-9872-d8fbbf1800a6",
    "status": "unverified",
    "type": "bank",
    "bankAccountType": "checking",
    "name": "Jane Doe - Checking",
    "created": "2022-06-23T18:23:57.300Z",
    "removed": false,
    "channels": [
        "ach"
    ],
    "bankName": "SANDBOX TEST BANK",
    "fingerprint": "ea2f9562b698e1353d5c7e73b75dd5997de9a5329a7b7dd6f032a15352addec3"
}

For more information on these topics, I would recommend checking out our Developer Documentation on creating a new funding source for a customer and retrieving a funding source.

As for the error that you are seeing, when a funding source with the same account and routing number already exists and is active for the specified customer, you will be unable to create a new funding source using the same values. Instead, you will either have to remove the funding source and then re-add it. Additionally, since you are integrating Plaid, you can choose to pair with a new bank, which should provide a different routing number, or you can select another account, such as a savings account versus a checking, which should provide a different account number.