When building a product or service that requires your users to pay for something, there are many ways that things can go wrong, such as delayed payments, fraud, or other such issues.
Thus, it is crucial to track these events in real-time and alert you and your team in the event of a problem.
Palzin Track lets you track payment events such as User Subscription, User Purchase, User Cancellation, and User Redemption directly from your Nodejs application.
Connect Palzin Track to NodeJs
Using NodeJs with Axios
var axios = require('axios');
var data = JSON.stringify({
"project": "my-project",
"channel": "payments",
"event": "Successful Payment",
"description": "[email protected] - ($19.99)",
"icon": "💸",
"notify": true
});
var config = {
method: 'post',
url: 'https://api.palzin.live/v1/log',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Using NodeJs with Native
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'palzin.live',
'path': '/api/v1/log',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = \[\];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"project": "my-project",
"channel": "payments",
"event": "Successful Payment",
"description": "[email protected] - ($19.99)",
"icon": "💸",
"notify": true
});
req.write(postData);
req.end();
Using NodeJs with Request
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.palzin.live/v1/log',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
},
body: JSON.stringify({
"project": "my-project",
"channel": "payments",
"event": "Successful Payment",
"description": "[email protected] - ($19.99)",
"icon": "💸",
"notify": true
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Using NodeJs with Unirest
var unirest = require('unirest');
var req = unirest('POST', 'https://api.palzin.live/v1/log')
.headers({
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
})
.send(JSON.stringify({
"project": "my-project",
"channel": "payments",
"event": "Successful Payment",
"description": "[email protected] - ($19.99)",
"icon": "💸",
"notify": true
}))
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
Connect Palzin Track to your NodeJs code to easily track and keep a record of your product's payment events. With Palzin Track, you can create simple charts and journeys to help you better understand your product. Palzin Track also allows you to receive real-time push notifications on your desktop and mobile devices whenever a new payment event occurs.
Palzin Track reveals the human stories behind your data. Make user-centric decisions that drive growth.