Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
mercadopago
Advanced tools
$ npm install mercadopago
var MP = require ("mercadopago");
var mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
Create a Checkout preference:
var preference = {
"items": [
{
"title": "Test",
"quantity": 1,
"currency_id": "USD",
"unit_price": 10.5
}
]
};
mp.createPreference (preference, function (err, data){
if (err) {
console.log (err);
} else {
console.log (JSON.stringify (data, null, 4));
}
});
Get an existent Checkout preference:
mp.getPreference ("PREFERENCE_ID", function (err, data){
if (err) {
console.log (err);
} else {
console.log (JSON.stringify (data, null, 4));
}
});
Update an existent Checkout preference:
var preference = {
"items": [
{
"title": "Test Modified",
"quantity": 1,
"currency_id": "USD",
"unit_price": 20.4
}
]
};
mp.updatePreference ("PREFERENCE_ID", preference, function (err, data){
if (err) {
console.log (err);
} else {
console.log (JSON.stringify (data, null, 4));
}
});
Searching:
var filters = {
"id": null,
"site_id": null,
"external_reference": null
};
mp.searchPayment (filters, function (err, data){
if (err) {
console.log (err);
} else {
console.log (JSON.stringify (data, null, 4));
}
});
Receiving IPN notification:
var MP = require ("mercadopago"),
http = require("http"),
url = require('url');
var mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
function onRequest(request, response) {
var qs = url.parse (request.url, true).query;
mp.getPaymentInfo (qs["id"], function (err, data){
if (err) {
console.log (err);
response.writeHead(200, {
'Content-Type' : 'application/json; charset=utf-8'
});
response.write (err);
response.end();
} else {
console.log (JSON.stringify (data, null, 4));
response.writeHead(200, {
'Content-Type' : 'application/json; charset=utf-8'
});
response.write (JSON.stringify (data));
response.end();
}
});
}
http.createServer(onRequest).listen(8888);
Cancel (only for pending payments):
mp.cancelPayment ("ID", function (err, data){
if (err) {
console.log (err);
} else {
console.log (JSON.stringify (data, null, 4));
}
});
Refund (only for accredited payments):
mp.refundPayment ("ID", function (err, data){
if (err) {
console.log (err);
} else {
console.log (JSON.stringify (data, null, 4));
}
});
FAQs
Mercadopago SDK for Node.js
The npm package mercadopago receives a total of 11,462 weekly downloads. As such, mercadopago popularity was classified as popular.
We found that mercadopago demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.