GithubHelp home page GithubHelp logo

mattyice / sc2-pay Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 6.0 27 KB

SC2 Pay is an add-on library for SteemConnect V2 to provide a more integrated and seamless STEEM or SBD payment experience for third-party sites and services built on the Steem blockchain.

License: MIT License

HTML 34.82% JavaScript 65.18%

sc2-pay's Introduction

SC2 Pay: Integrated STEEM/SBD JavaScript Front-End Payment Add-On for SteemConnect V2

SC2 Pay is an add-on library for SteemConnect V2 to provide a more integrated and seamless STEEM or SBD payment experience for third-party sites and services built on the Steem blockchain.

Currently the process for making STEEM or SBD payments on third-party websites using the SteemConnect V2 library is a little disjointed since it takes the user away from the original site to complete the purchase. They then have to go back to the original site and sometimes wait and/or refresh the page to see if the payment has gone through.

The SC2 Pay plugin allows the payment process to be handled in a popup window without leaving the original site, and providing a client-side callback method when the transaction has been completed so that the website can automatically refresh and show the purchase as soon as it is completed.

HTML Page Setup

The SC2 Pay library requires the following dependencies:

Include all of the required libraries in the element of your HTML page as shown below:

<!-- Steem JS Library -->
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script>

<!-- SteemConnect V2 JS Library -->
<script src="https://steemit.github.io/example-steemconnect-angular/sc2.min.js"></script>

<!-- SC2 Pay JS Library -->
<script src="sc2-pay.min.js"></script>

Usage

// Process payment using SteemConnect
sc2_pay.requestPayment(title, to_account, amount, currency, memo, callback);

// Process payment using Vessel
sc2_pay.requestPaymentVessel(title, to_account, amount, currency, memo, callback);

Parameters:

  • title: The title text shown on the modal payment dialog.
  • to_account: The name of the Steem account to which the payment should be sent.
  • amount: The amount of STEEM or SBD to be paid, this should be a number and not contain the currency name.
  • currency: The payment currency. Valid values are 'STEEM' or 'SBD'.
  • memo: The memo to be included with the payment transaction. This should be something that allows your application to uniquely identify this purchase.
  • callback: This function will be called when the payment is completed or cancelled. On successful payment it will be passed a single parameter which will be a JSON object containing the Steem transaction details.

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.