Dwolla V2 Gem - Code samples for Transfer and Fund Request


(Luis Mojica) #1

Hi,

I would like to know if there are any available code samples on how to create a Transfer and a Fund Request using the DwollaV2 gem.

Note:
I used the Dwolla implementation from the GIST provided on the other thread and I have access to my account_id and my funding sources


(Stephen Ausman) #2

Hey Luis,

We’re working on adding some examples for the V2 gem to our docs. In the meantime I would look at the “raw” examples as they map pretty closely to the V2 gem’s usage. For example, here is what initiating a transfer looks like with the V2 gem:

token.post "transfers", {
  _links: {
    destination: {
      href: "https://api.dwolla.com/customers/07D59716-EF22-4FE6-98E8-F3190233DFB8"
    },
    source: {
      href: "https://api.dwolla.com/funding-sources/707177c3-bf15-4e7e-b37c-55c3898d9bf4"
    }
  },
  amount: {
    currency: "USD",
    value: "10.00"
  },
  metadata: {
    foo: "bar",
    baz: "boo"
  },
  fees: [
    {
      _links: {
        "charge-to" => {
          href: "http://api-uat.dwolla.com/customers/07D59716-EF22-4FE6-98E8-F3190233DFB8"
        }
      },
      amount: {
        value: "1.00",
        currency: "USD"
      }
    }
  ]
}

(Luis Mojica) #3

Hi Stephen,

Your request body suggestion seems to accepted properly however, I keep getting an error from the API:

DwollaV2:Error for dwolla_transfer 13: code: InvalidScope, message: Missing or invalid scopes for requested endpoint.,

I created the refresh token from the token generator website with all scopes enabled, but it keeps responding the same.

Also, I created a refresh token from the management console where I had my application scopes properly specified and get the same error.

Can you help me out on this one?

Best Regards,


(Stephen Ausman) #4

Hey Luis,

It sounds like you might be using the refresh token instead of the access token? You will only need to use the refresh token to get a new access_token and new refresh_token once your current access_token expires.

If that’s not it, which endpoint are you trying to access?


(Luis Mojica) #5

Hi,

Thanks for the prompt response, I was able to get over the scopes errors by enabling more permissions on the application console. At this point I am able to submit Dwolla transfers properly :slight_smile:

However, I can’t seem to find answers to these questions:

  1. Where can I find a list of all the possible transfer status values?
  2. How do I create a “Money Request” using the V2 gem?

Best Regards,


(Stephen Ausman) #6

I think this is what you’re looking for:

https://docsv2.dwolla.com/#transfers

processed, pending, cancelled, failed, or reclaimed

“Money Requests” is only available in the v1 API. For the v2 API we recommend implementing this functionality within your application and using the transfers API for initiating the transaction that fulfills the request for payment.


(Luis Mojica) #7

Stephen,

I would like to thank you for your valuable help, I am able to create and monitor outgoing transfers.
(source: my own funding source, destination: my payee email address)

However, I am still struggling to send a transfer that acts as a “money request” using an email address as the source. According to the documentation the source of a transfer can only be the funding source id, but I only know my payer’s email address. Any suggestions?

Thanks in advance,


(Spencer Hunter) #8

You won’t send a transfer that acts as a money request. As Stephen mention, you’ll implement money request functionality within your application. i.e. If Jane Doe wants to request money from johndoe@email.com your app will trigger a notification of some kind telling johndoe@email.com that there is a pending request for money. To fulfill the pending request, John Doe will need to go through the OAuth flow somewhere within your application where they will then authorize your application to send money(calling the Transfers API) to Jane Doe.

Let us know if we can go into greater detail or break down the steps further.


(Deb Hersom) #9

We are looking for the V2 equivalent of the V1 Money Requests.


(Cory Anderson) #10

(Cory Anderson) #11

(Cory Anderson) #12