Authorize.net requests for Node.JS
npm install auth-net-request 
npm install auth-net-request
``js
var AuthorizeRequest = require('auth-net-request');
var Request = new AuthorizeRequest({
api: '123',
key: '1234',
cert: '/path/to/cert.pem',
rejectUnauthorized: false, // true
requestCert: true, // false
agent: false // http.agent object
sandbox: false // true
});
Request.send(
`
* - As specified in the Auhorize.net API without the "Request"
suffix, e.g. "createTransaction".
* - Either an XML string or a JavaScript object reflecting the JSON xmlOptions.rejectUnauthorized
specification in the Authorize.net API.
* - see https.request option. false
Note: defaults to . Likely want to set to true.xmlOptions.requestCert
* - Defaults to true.xmlOptions.agent
* - Defaults to false.xmlOptions.extraOptions
* - Adds an tag to the request. For?
If !err on the send method callback, response is as specified in the response.transactionResponse.responseCode
Authorize.net API. E.g. consider checking and recording , response.transactionResponse.authCode and response.transactionResponse.transId.
If !!err on the send method callback, you can get access to the err
following properties of :err.name
* err.message
* err.code
* err.stack
* err.response
* - response from Authorize.net API, if the request
got that far.
!err on the send method callback does not necessarily mean a messages.resultCode
transaction was approved. Note the differences among the following
in the API documentation: , messages.message.code and transactionResponse.responseCode.
Version >= 2.x.x` has a breaking change, all values are returned as strings rather than strings and numbers (unless the value is an object, array, etc).
* Authorize.net API Reference
* Authorize.net Response Codes
* Node.js https.request