1. Home

Libraries for webmasters

The recommended way to create a button calling the request for payment

1:  <button onclick="pay()"> PaySomeAmount </button> <!-- you can put nice graphics with button 'Pay' here -->
2:  <script src="//billon.info/lib/js/billon.js"></script> <!--  we use ready-made libraries here -->
3:  <script src="//billon.info/lib/js/billon-agent.js"></script>
4:  <script src="//billon.info/lib/js/billon-object.js"></script>
5:  <script src="//billon.info/lib/js/billon-user.js"></script>
6:  <script src="//billon.info/lib/js/billon-paymentDialog.js"></script>
7:  <script> function PaySomeAmount(ReqestedAmount) {
8:  billon.paymentDialog(	// the user initiates a payment request here	
    {
9:       connection: new billon.agent("http://example:1400/exampleProxy"), // Sails.js controller 'ExampleProxyController' on NodeJS server
10:      request:
         {
11:         Address: "PaySomeAmount",
12:         Data: function (UserLoginName) {
13:            return {               
14:               amount: ReqestedAmount, // note: PLN x 1000
15:               user: UserLoginName
         }; } },
16:      listen: // we are waiting for the success of pay (from WUI via ExampleProxyController) 
         {
17:         Address: "status",
18:         Data: function (requestResponse)
            {
19:            return {
20:               taskId: requestResponse.taskId
              }; },
21:         Response: function (response)
            {
22:            switch (response.status)
                {
23:               case "FINISHED_OK":
24:                  // handler of successfully finished payment here
25:                  break;               
26:               case "FINISHED_ERR_USER_REJECTED":
27:                  // handler of rejection of payment here
28:                  break;
29:               case "FINISHED_ERR_USER_NOT_FOUND":
30:                  // handler for unsuccessful search for user
31:                  break;
32:               default:
                     // optional advanced handler here
    } } } }); } </script>

NodeJS proxy service for processing the payment should be run after placing code of button on the page. More about above script is descripted on the page „Scripts in user’s browser”. Billon jQuery, which uses PHP, can be used for the simple donations.

Plate payments should be used for the quick payments with the mobile phone for articles that are published on the webpages.

The way to create a button calling the request for payment and displaying a bar of the payment at the bottom of the screen

1:  <button onclick="pay()"> PaySomeAmount </button> <!-- you can put nice graphics with button 'Pay' here -->
2:  <script src="//billon.info/lib/js/billon.js"></script> <!--  we use ready-made libraries here -->
3:  <script src="//billon.info/lib/js/billon-agent.js"></script>
4:  <script src="//billon.info/lib/js/billon-object.js"></script>
5:  <script src="//billon.info/lib/js/billon-user.js"></script>
6:  <script src="//billon.info/lib/js/billon-loadingBar.js"></script>
7:  <script> function PaySomeAmount(ReqestedAmount) {
8:  billon.loadingBar(	// the user initiates a payment request here	
    {
9:       connection: new billon.agent("http://example:1400/exampleProxy"), // Sails.js controller 'ExampleProxyController' on NodeJS server
10:      request:
         {
11:         Address: "PaySomeAmount",
12:         Data: function (UserLoginName) {
13:            return {               
14:               amount: ReqestedAmount, // note: PLN x 1000
15:               user: UserLoginName
         }; } },
16:      listen: // we are waiting for the success of pay (from WUI via ExampleProxyController) 
         {
17:         Address: "status",
18:         Data: function (requestResponse)
            {
19:            return {
20:               taskId: requestResponse.taskId
              }; },
21:         Response: function (response)
            {
22:            switch (response.status)
                {
23:               case "FINISHED_OK":
24:                  // handler of successfully finished payment here
25:                  break;               
26:               case "FINISHED_ERR_USER_REJECTED":
27:                  // handler of rejection of payment here
28:                  break;
29:               case "FINISHED_ERR_USER_NOT_FOUND":
30:                  // handler for unsuccessful search for user
31:                  break;
32:               default:
                     // optional advanced handler here
    } } } }); } </script>

Articles

Was this article helpful to you? Yes No

How can we help?