- Tech Docs

NodeJS example integration

// These code snippets use an open-source library. http://unirest.io/nodejs

unirest.post("https://www.transactionale.com/api/v1/transaction")
  .header("X-Authorization", "YOUR_API_KEY")
  .header("Content-Type", "application/json")
  .header("Accept", "application/json")
  .send('{ "email" : "your-customer-email@mailprovider.com", "country":"it", "first_name":"customer-name", "zip_code":"00001" }')
  .end(function (result) {
    console.log(result.status, result.headers, result.body);
});

Some notes:

  • We use Unirest in our examples, but feel free to use any framework or library capable of making HTTP POST requests
  • Remember to customise the variables in the examples - the snippet will not work as-is
  • You have a personal API key in the Integrate section of your account. Copy that key and subsitute it in the snippet where YOUR_API_KEY is noted
  • The HTTP request’s content type must be application/json (the example should already take care of this)
  • The body of the HTTP request must contain a JSON-encoded object with your data (the example should already take care of this)