RootApi not returning account in "_links"


(Dino Luck) #1

Hi guys,

So we have our account on Dwolla and trying to push our app live, after testing it in sandbox. We’re using Transfer API.

We have our funding source added and verified, but when I go to API and try to get to it I’m stopped few steps before. Here’s the breakdown:

  1. Auth successfully
  2. Set Configuration::$access_token successfully
  3. Start new ApiClient(‘https://api.dowlla.com/’)
  4. Start new RootApi($apiClient)

Now here we should be able to extract our account url following Dwolla API docs, but there is no ‘account’ index in ‘_link’ array.

When I do dump of $rootApi->root() I can see this:

{
     _links: {
          events: {
               href: "https://api.dwolla.com/events",
               type: "application/vnd.dwolla.v1.hal+json",
               resource_type: "event"
          },
          webhook-subscriptions: {
               href: "https://api.dwolla.com/webhook-subscriptions",
               type: "application/vnd.dwolla.v1.hal+json",
               resource_type: "webhook-subscription"
          }
     },
     _embedded: null
}

So As you can see I only get the ‘webhook-subscription’ and ‘events’ in _links, and no account.

What might be the cause for this?


(Manoj Goel) #2

We faced this exact same issue when switching from Sandbox to Production. What we got to know is that in production we need account access token in addition to appToken using accountToken then we can fetch the needed accountUrl and from that the funding source. Hope this helps you and gives you an idea to resolve this problem.


(Dino Luck) #3

@goelmk Thanks for the reply. I’m not sure I understand though. We are following the official API docs, is there something wrong with that code? We’re using PHP examples.


(Dino Luck) #4

So this is our current code:

Configuration::$access_token = json_decode($result)->access_token;

Then

$apiClient = new ApiClient("https://api.dwolla.com/");
$rootApi = new RootApi($apiClient);

Then

$root = $dwolla->root();

And $root only returns

{
     _links: {
          events: {
               href: "https://api.dwolla.com/events",
               type: "application/vnd.dwolla.v1.hal+json",
               resource_type: "event"
          },
          webhook-subscriptions: {
               href: "https://api.dwolla.com/webhook-subscriptions",
               type: "application/vnd.dwolla.v1.hal+json",
               resource_type: "webhook-subscription"
          }
     },
     _embedded: null
}

What are we missing here, @spencer ?


(Gastón Avila) #5

We are having the same issue and the docs say exactly what the original question states. We are doing something on the sandbox to get the account_url to run a transfer which does not work on production.
Any ideas?


(Matt Glaman) #6

We had to hardcode the email, due to production not returning the account link anymore. An example

  $payload = [
'_links' => [
  'source' => [
    'href' => $funding_source,
  ],
  'destination' => [
    'href' => 'mailto:owner@example.com',
  ],
],
'amount' => [
  'currency' => $charge['currency_code'],
  'value' => commerce_currency_amount_to_decimal($charge['amount'], $charge['currency_code']),
],

];


(Spencerhunter) #7

Reference my reply to a similar question in the following thread: