node.js sepa_credit_transfer -> Error 422

1 post

Hey guys,

I am working on an app that needs to do sepa_credit_transfers.

I started with the node.js example. Original example works fine, Authentication is fine, but for some reason
I cannot get my ‘properties’ in there. I am not sure wether this is an API issue, or a syntax issue on my side. Would you mind having a look at it?

I am getting:

{“error”:{“message”:”param is missing or the value is empty: sepa_credit_transfer”,”code”:422,”errors”:[]}}

as reply.

This is my function. Only the relevant part – as stated Auth etc. works fine. (I recycled the ‘render’ function from the sample).

function render (endpoint, req, res) {

function pipeApi(endpoint, access_token, res) {
var api_endpoint = url.parse(fidor_config.fidor_api_url+endpoint)
var http_module = api_endpoint.protocol == “https:” ? https : http

var http_options = {
hostname: api_endpoint.hostname,
path: api_endpoint.path,
port: api_endpoint.port,
method: “POST”,
headers: {
“Authorization”: “Bearer “+access_token,
“Accept”: “application/; version=1,text/json”,

var api_request = http_module.request(http_options, function(api_response) {
res.setHeader(‘Content-Type’, api_response.headers[‘content-type’])
if (api_response.statusCode == 401) { // access_token has expired.
console.log(“access token expired”)
handleLogout(req, res, endpoint)
res.writeHead(api_response.statusCode, api_response.statusMessage)
api_response.on(‘data’, function(chunk) {
api_response.on(‘end’, function(){

api_request.on(‘error’, function (err) {
console.log(“api_request.on error”)
res.writeHead(500, {‘Content-Type’: ‘text/plain’})
// … what to send
var postData1 = JSON.stringify({“sepa_credit_transfer” : {
“account_id”: “1872”,
“amount”: “100”,
“external_uid”: “5jUb4T7d8uhm9QaOcKcn”,
“remote_iban”: “DE49140520002640025972”,
“subject”: “test subject”,
“remote_name”: “test remote holder”


// utility to check whether access token is via session cookie, if not
// redirects account holder to OAuth Authorization Endpoint.
function getAccessToken(redirect, req, res, cb) {
var accesstoken = getAccessTokenFromSession(req)
if (!accesstoken) {
// start OAuth
redirect_to_oauth(res, redirect)
} else {
cb(null, accesstoken)


getAccessToken(endpoint, req, res, function (err, accesstoken) {
if (err) {
res.writeHead(500, {‘Content-Type’: ‘text/plain’})
pipeApi(endpoint, accesstoken, res)


Is it the json format? Any advice is appreciated – already spent like 10 hours on debugging without any success…

Thanks in advance

You must be logged in to reply in this thread.