Skip to content

Instantly share code, notes, and snippets.

@andrew-grischenko
Created August 11, 2019 10:10
Show Gist options
  • Save andrew-grischenko/f2ad57a51b99126a6468b865478654ac to your computer and use it in GitHub Desktop.
Save andrew-grischenko/f2ad57a51b99126a6468b865478654ac to your computer and use it in GitHub Desktop.
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
var request = require('request');
var transaction = context.req.query.transaction;
request(
{
url : 'https://api.sandbox.ewaypayments.com/Transaction/' + transaction,
auth: {
user: "<your eWAY username goes here>", // or use process.env["EWAY_APP_KEY"],
password: "<your eWAY password goes here>"//or use process.env["EWAY_PASSWORD"]
}
}, function (error, response, body) {
if (error) {
context.log(error);
}
if (!error && response.statusCode == 200) {
context.log(body);
context.res = { status: 200, body: body };
}
context.done();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment