npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pagseguro-node

v1.0.2

Published

This is a Node.js package which provides interaction with PagSeguro online payment system.

Downloads

19

Readme

pagseguro-node

This is a Node.js package which provides interaction with PagSeguro online payment system. The method used for this module is HTTP Parameters. XML support coming soon!

After you create your seller account and generated your token, you can start making requests.

Keep in mind that you can use tokens in two environments: sandbox and production. They are provided by PagSeguro API, for more information, read their documentation.

======================================================

Este é um pacote Node.js que fornece interação com o sistema de pagamento online PagSeguro. O método usado nesse módulo é o de parâmetros HTTP. Suporte para arquivos XML em breve!

Depois de criar sua conta de vendedor e gerar seu token, poderá começar a fazer requisições.

Tenha em mente que você pode usar token em dois ambientes: sandbox (teste) e produção. Eles são fornecidos pela API do PagSeguro, para maiores informações, leia a documentação deles.

Version (Versão)

1.0.1

Installation (Instalação)

$ npm install pagseguro-node --save

What's new (O que há de novo)

pagSeguro.setMode('prod'); // or sanbox, default is prod
pagSeguro.setToken('<your_token>');
pagSeguro.setRedirectURL('http://somepoint/isback');
pagSeguro.setReference('<stuff_ref_number>');
pagSeguro.setNotificationURL('http://somepoint/notification');

Quick example (Exemplo rápido)

var express = require('express');
var app = express();

var email = '[email protected]';
var token = 'your_long_token';

var PagSeguro = require('pagseguro-node');
var pagSeguro = new PagSeguro(email, token);

// provide redirect URL after PagSeguro sends you the transaction code
var URL_RED_PAG = 'https://pagseguro.uol.com.br/v2/checkout/payment.html?code=';

pagSeguro.addItem({
  id: 1,
  description: 'Item description 1',
  amount: '11.11',  // values in string format with 2 decimal places
  quantity: 1,
  weight: 1200,   // in grams
  shippingCost: '0.00'  // same criterion
});

// shipment depends on options set in PagSeguro store page.
// make sure you set them and read the API
pagSeguro.addShipment({
  type: 3,
  state: 'BA',
  city: 'Jacobina',
  postalCode: '44700000',
  district: 'Um bairro',
  street: 'Rua x',
  number: '999',
  complement: 'Casa',
  cost: '0.00'
});

pagSeguro.addBuyer({
  email: '[email protected]',
  name: 'Bruno Pinho', // you must provide at least 2 names, don't know why!
  areaCode: '74'
});

app.get('/', function (req, res) {
  pagSeguro.processOrder(function (err, response, body) {
    
    if (err) {
      res.json(err);
    }
    else {
      // redirect user to payment page (pagseguro)
      res.redirect(URL_RED_PAG + body.code);      
    }   

  });
});

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});

Changelog

Version 1.0.2 (Feb. 9th, 2016)

  • Fixed a bug when adding more items to list and generating only one during request.

Version 1.0.1 (Feb. 8th, 2016)

  • Created a few more methods: setToken, setEmail, setMode, setRedirectURL, setNotificationURL, setReference.

Version 1.0.0 (Feb. 7th, 2016)

  • First release with basic interaction to start selling things on internet using PagSeguro.

License

Please, read the License file on this repository for more information.

Do you like it?

Start contributing by forking and sending pull request.

Thanks, Bruno Pinho