Coder Social home page Coder Social logo

jeff-matthews / payment-page Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24 KB

A sample Node.js app built using the Express.js framework and integrates the ChargeIO JS library and AffiniPay payment gateway

License: MIT License

JavaScript 70.73% CSS 1.43% HTML 27.84%

payment-page's Introduction

payment-page

standard-readme compliant

Sample Node.js app built on the Express.js framework that masks payment details using the ChargeIO.js tokenization library and submits charge requests to the AffiniPay Payment Gateway

Overview

This is a simple node app for accepting credit card payments on a website. Here's what it does:

  1. Provides a form for collecting credit card details and a payment amount.
  2. Exchanges credit card details for a one-time token without passing sensitive data through the local web server.
  3. Posts the one-time token and payment amount to an endpoint on the local web server using a callback (public/javascripts/event-handler.js).
  4. Submits a charge request to the AffiniPay Payment Gateway using the one-time token and payment amount.

Security

This app requires AffiniPay Payment Gateway API keys, which include a public and test- or live-mode secret key.

  • Public key: The ChargeIO.js tokenization library needs to know your merchant identity to create payment tokens. You identify yourself by providing your public key, which is safe to expose in web pages (as opposed to your secret key, which must be safeguarded).

  • Secret key: Used to authenticate requests from your web server to the AffiniPay Payment Gateway when running charges and performing other operations.

    Your secret keys provide access to sensitive operations affecting payments and therefore must be closely guarded. Never expose these keys in any publicly-accessible web pages, JavaScript, etc.

Installation

This app is written in Node.js, which must be installed prior to use. Node.js includes the Node Package Manager (NPM), which is used for installing dependencies.

  1. Clone the repository:

    $ git clone [email protected]:jeff-matthews/payment-page.git
    
  2. Open a terminal and navigate to the new directory:

    $ cd payment-page
    
  3. Install dependencies:

    $ npm install
    

Configuration

  1. Log in to the AffiniPay web app.

  2. Obtain your AffiniPay Payment Gateway API keys.

  3. Enter your public key in the views/layout.pug template to initialize the ChargeIO.js library:

    script.
     ChargeIO.init({public_key: '<add-your-key-here>'});
    
  4. Add your live- or test-mode secret key to your web server. [TODO]

Usage

  1. Start the server:

    $ npm start
    

    Use DEBUG=app.js:* npm start to launch the app in debug mode.

  2. Open a web browser and go to http://localhost:3000.

  3. Enter payment details in the form.

  4. Click Submit.

Contributions

Contributions in the form of GitHub pull requests are welcome. Please adhere to the following guidelines:

  • Before embarking on a significant change, please create an issue to discuss the proposed change and ensure that it is likely to be merged.
  • Follow the coding conventions used throughout the project, including 2-space indentation and no unnecessary semicolons. Many conventions are enforced using eslint.
  • Any contributions must be licensed under the MIT license.

License

MIT © Jeff Matthews

payment-page's People

Watchers

 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.