/top-up-sample

Top Up Sample

Primary LanguageJavaScriptMIT LicenseMIT

Top-Up is a sample application that applies a bitcoin payment to a targeted account service.

Main Features

  • Integration with BitPay bitcoin payment service using modal invoice
  • Supports bitcoin livenet and testnet
  • Configure from 160+ currencies
  • Responsive UI for mobile and desktop presentation
  • Form validation & error handling
  • Modular design uses service providers
  • AngularJS application
  • Bootstrap presentation
  • Easily configured

Mobile View

   

Browser View

 

Configuration

You must provide API access keys/tokens for each service you intend to use. See appConfig.json.

Payment methods

This application integrates with the BitPay merchant services platform for accepting bitcoin as a payment from your customers. You can add additional payment methods by creating providers and calling your providers from paymentService.js.

BitPay (bitcoin)

For the application to create BitPay invoices you must link the application to a BitPay merchant account. You can configure the application for both production (livenet transactions) and development (testnet transactions) simultaneously. Follow these steps:

  1. Login to your production BitPay merchant account or test BitPay merchant account
  2. Click "Payment Tools", then "Manage API Tokens", then "Add New Token"
  3. Enter a label (e.g. "Top-Up app")
  4. Uncheck the "Require Authentication" checkbox
  5. Click "Add Token" button
  6. Copy and paste the Token into the api token entry in appConfig.json

Top-up services

You can add additional top-up services by creating providers and calling your providers from topUpService.js. This application includes a stubTopUpService that serves as a placeholder for your top-up service. Use this as a reference implementation for your top-up service.

Obtain API keys and configure your top-up service as required. See appConfig.json. The key topUpService selects your target service at runtime.

Install For Development

Ensure you have Node, bower and grunt installed, then install and start Top-Up:

npm install
npm start

Visit localhost:8000 to view the app.

Making changes

After changes are made re-build and re-start Top-Up:

grunt
npm start

Build For Production

You can target payment methods for development or production. See appConfig.json. Ensure you have Node, bower and grunt installed, then install and start Top-Up:

npm install
grunt --target=prod
npm start

Visit localhost:8000 to view the app.

Known Issues

  • [TODO] There is no IPN handler for BitPay to POST invoice notifications to the application.
    • The application relies on window.postMessage() to receive payment status from the invoice.

Support

  • GitHub Issues
    • Open an issue if you are having problems with this project

License

Top-Up is released under the MIT License. Please refer to the LICENSE file that accompanies this project for more information including complete terms and conditions.