bankcard test

node v10.20.1
version: 2.0.0
endpointsharetweet
const https = require('https'); const querystring = require('querystring'); const security_key = '{security_key}'; const hostName = 'bankcardconnect.transactiongateway.com'; const path = '/api/query.php'; const actionType = 'sale'; // Can be any valid Query API action. // Create the post data body to pass into request const postData = querystring.stringify({ 'security_key': security_key, 'action_type': actionType, }); const options = { hostname: hostName, path: path, method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': Buffer.byteLength(postData) } }; // Make request to Query API const req = https.request(options, (response) => { console.log(`STATUS: ${response.statusCode}`); console.log(`HEADERS: ${JSON.stringify(response.headers)}`); response.on('data', (chunk) => { console.log(`BODY: ${chunk}`); }); response.on('end', () => { console.log('No more data in response.'); }); }); req.on('error', (e) => { console.error(`Problem with request: ${e.message}`); }); // Write post data to request body req.write(postData); req.end();
Loading…

no comments

    sign in to comment