The example in the docs is pasted above, but this uses the customer.update action on an existing customer. I want to create a business customer at the same time I verify them ideally. Is this possible using customer.create as the value of action, and, if so; what should the value of _links be since I won’t have a customer ID to use at the time of the call like what happens in the above example?
I see that the business-vcr drop-in has css fields for customer creation (name, email, etc), which would lead me to believe you don’t have to call the /client-tokens endpoint on an existing customer id. Seems like a chicken and egg situation; how can I make the call to fetch the token I need to render the vcr drop-in without having the customer id yet?
Doing some postman test calls it looks like I can get successful responses from /client-tokens with an empty _links field in the request body. Is this what I should be doing?
Hi @Cody_Eddings – ah yeah, for a “flow” type component (like Business VCR), you do not have to call the /client-tokens endpoint. You can actually specify a tokenUrl which would be a server-side endpoint that can be called by the dwolla-web library when an action needs to be performed within the flow to simplify the integration experience. Flow components are designed to support drop-ins that have multiple isolated functions connected together into a single user flow.
I’m a bit stuck unfortunately, is there anyone on your team that could offer some guidance on using the https://cdn.dwolla.com/v2/dwolla-web.js lib with a view app?
Following my previous approach, I tried import dwolla from "dwolla"; at the beginning of my script, and it does seem to successfully install Dwolla, but then I get a console error when I try to call `dwolla.configure(“sandbox”):
dwolla__WEBPACK_IMPORTED_MODULE_4___default.a.configure is not a function
Circling back, I actually got the dwolla-v2 library installed successfully. I forgot to npm install dwolla-v2 which was my first problem, then I abandoned the dwolla.configure() approach and just followed the guide directly (who knew, following the instructions verbatim is important! lol)
My question comes full circle though, what should I be passing in as the body to the tokenUrl request?
let Client = require("dwolla-v2").Client;
let dwolla = new Client({
key: "",
secret: "",
environment: "sandbox",
});
const url = `/client-tokens`;
return dwolla
.post(url, body) //TODO: what should the body be?
.then((response) => {
return response.body;
})
.catch((error) => {
return error;
});
Like I mentioned earlier, I don’t have a customer ID yet since the customer is in the process of being created during this flow, so do I just pass in an empty _links object with and action of customer.create ?
Here, the req object represents the HTTP request and has properties for the request query string, parameters, body, and HTTP headers. The res object represents the HTTP response that an Express app sends when it gets an HTTP request.