Hi
In the dwolla sandbox
I have Customer Account 36b5ad43-2113-4fed-965f-fbd982e78198 with two verified funding sources with ID ID: 007aafcc-f717-4802-9f91-8214ad419cc8 (say account A) and ID: 8b71f4f8-e92b-45b3-8997-088b40e6410f (say account B)
I tried transfer to transfer money from Account A to account B…But I got error as shown in RED…Ive pasted my code for reference…Please advise…
Unhandled rejection Error: {“code”:“ValidationError”,“message”:“Validation error(s) present. See embedded errors list for more details.”,"_embedded":{“errors”:[{“code”:“Invalid”,“message”:“Invalid destination.”,“path”:"/_links/destination/href","_links":{}}]}}
const dwolla = require(‘dwolla-v2’);
const appKey = ‘…’
const appSecret = ‘…’;
const client = new dwolla.Client({
key: appKey,
secret: appSecret,
environment: ‘sandbox’
});
var requestBody = {
_links: {
source: {
href: ‘https://api-sandbox.dwolla.com/funding-sources/007aafcc-f717-4802-9f91-8214ad419cc8’
},
destination: {
href: ‘https://api-sandbox.dwolla.com/funding-sources/8b71f4f8-e92b-45b3-8997-088b40e6410f’
}
},
amount: {
currency: ‘USD’,
value: ‘12.00’
},
metadata: {
paymentId: ‘12345678’,
note: ‘payment for completed work Dec. 1’
},
clearing: {
destination: ‘next-available’
},
addenda: {
source: {
addenda: {
values: [‘ABC123_AddendaValue’]
}
},
destination: {
addenda: {
values: [‘ZYX987_AddendaValue’]
}
}
},
correlationId: ‘8a2cdc8d-629d-4a24-98ac-40b735229fe2’
};
client.auth.client()
.then(
(appToken) => {
appToken
.post('transfers', requestBody)
.then(// => 'https://api-sandbox.dwolla.com/transfers/2e3269af-28bd-49ea-b4f7-7ff47e5edd84'
(res) => {
console.log(JSON.stringify(res, null, 2))
// console.log(JSON.stringify(res.headers.get('location'),null,2))
// res.headers.get('location')
}
); // => 'https://api-sandbox.dwolla.com/funding-sources/ccfdcd05-1304-46b4-b208-07ae6c0c978c'
}).catch(
(err) => {
console.log(JSON.stringify(err, null, 2))
}
)
