- Tech Docs

Ruby example integration

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

response = Unirest.post "https://www.transactionale.com/api/v1/transaction",
  headers:{
    "X-Authorization" => "YOUR_API_KEY",
    "Content-Type" => "application/json",
    "Accept" => "application/json"
  },
  parameters:{
    "email" => "your-customer-email@mailprovider.com",
    "country" => "it",
    "first_name" => "customer-name",
    "zip_code":"00001"
  }.to_json

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)