Giter VIP home page Giter VIP logo

gateway's Introduction

Gateway

Simple y functional, multi-payment system. Payment systems are extremely variable. Because of this I have decided to create a method that only a few functions using and making use of any payment system. According to the needs of each and every user software.

Use

var gateway = require('gateway');
gateway.give(function(method, params, next){
	// Give the Id
	db.payment.find(params.id, function(err, doc){
		next(err, doc.uuid);
	});
});

gateway.request(function(method, payment, next){
	// The payment just made
	console.log(method, payment);
	db.payment.findAndUpdate(payment.id, payment, function(err){
		next(err);
	});
});

// OPTIONAL
gateway.serialize( function(req, methods, next){
	// What are the methods of payment for the user
	next(methods);
});

// Methods with use
gateway.use(PayPal({
	api : 'My API',
	secret : 'My secret',
	url : {
		success : 'http://mydomain.com/:method/:id',
		cancel : 'http://mydomain.com/pay',	
	},
	showMethod : true
}));

gateway.use(CoinBase({
	api : 'My API',
	secret : 'My secret',
	url : {
		success : 'http://mydomain.com/bitcoin/:id'	
	}
}));


app.use(gateway.methods());
app.post('/paypal', gateway.payment('paypal'), otherFunction );
app.get('/pay', function(req, res, next){
	gateway.create('paypal', {
		title : 'Give the donate',
		description : 'A donation',
		amount : 10,
		currency : 'USD',
		tax : 0.1,
		id : '--My Id --'
	}, function(err, obj){
		if(err) return next(err);
		res.redirect(obj.link);
	});
});

This under construction !!

gateway's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.