Hello All,
I want to pass order details with invoiceNumber in Json format using Node js. I am using
"createTransactionRequest": { "merchantAuthentication": { "name": apiLoginID, "transactionKey": transactionKey }, "refId": "123456", "transactionRequest": { "transactionType": "authCaptureTransaction", "amount": data.amount, "payment": { "opaqueData": data.opaqueData }, "profile": {createProfile: true}, "order":{ "invoiceNumber": "INV-12345", "description": "Product Description", }, "customer": { type: 'individual', id: order.GP_customer, "email" : order.email },
Can you please help me? how can i pass order in json format?
Thanks
โ08-09-2020 09:57 PM
That response is a string too, if you want to send the response prettified, for some awkward reason, you could use something like JSON.stringify(anObject, null, 3)
It's important that you set the Content-Type header to application/json, too.
var http = require('http'); var app = http.createServer(function(req,res){ res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify({ a: 1 })); });app.listen(3000); // > {"a":1}
โ08-11-2020 08:01 AM
jason.stringify use the following
var http = require('http'); var app = http.createServer(function(req,res){ res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify({ a: 1 })); });app.listen(3000); // > {"a":1}
code
โ08-12-2020 05:14 AM
type header as Application/jason
jason.stringify place the following code
var http = require('http'); var app = http.createServer(function(req,res){ res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify({ a: 1 })); });app.listen(3000); // > {"a":1}
โ08-12-2020 05:18 AM
jason.stringify set the header as application/jason
place the following code
var http = require('http'); var app = http.createServer(function(req,res){ res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify({ a: 1 })); });app.listen(3000); // > {"a":1}
โ08-12-2020 05:35 AM