Community hosted payment gateway

Everyone should have access

In order to have an alterative regarding the usability of payment gateways (like btcz.in or other third party gateway), it should be well to have an open-sourced solution as basis for every developer. Also mostly to push user acceptance, this project must have to be a lever in the entrepreneurship people.

BTCz-pay - The open source project of the gateway is here:

Live API - (Beta version 0.1.1)

The pay.btcz.app gateway is an free to use API service that provide you end-to-end-user BTCz payment. It generating a new address (and QR) for each payment. It also provide you web UI for the payment process and states templates until success.

Use CoinMarketCap API

The CoinMarketCap API offer an interesting Hobbyist pricing that could allow 100ā€™000 requests per month. So we could begin with 15 currency support, that the conversion rate will be refreshed all 8-10 minutes.

(The actual beta version give only a refresh all 55 minutes with 4 currencies; CHF, USD, EUR and BTC)

WooCommerce Plugin - (Beta version 0.1.0)

The WooCommerce-BTCz-gateway is an WordPress plugin that allow you to pay with BitcoinZ crypto-currency in your WooCommerce WordPress Online Shop. It use the pay.btcz.app gateway to provide payment templates.

Costs estimation (up to 500 users)

image

So, itā€™s about 500 BTCZ per month and per person in this forum (all count, but we also could be more than 500 user of the service). Itā€™s very not an expensive project, itā€™s more time-consuming.

BENEFIT

  • Hosted by the community, for the world.
  • Continuity in the service.
  • Could be financially autonomous.
  • A free for use test platform for developers.
5 Likes

Im not fully understanding what is it about. Is it a new type of plugin?
Is it a better solution? I guess yes but Im noob in codeing.
I appriciate your work anyways Marcelus!

1 Like

:sweat_smile: Yep, I also read me againā€¦ and the explanation of what I would like to do is not clear. I will update the post.

ā€¦ Itā€™s about to create a other Payment Gateway like btcz.in, but an fully open-source solution.

3 Likes

Can I say how much I love you Marcelus ?!?

You really rock man !!

2 Likes

yeah we need a source code or an replication of btcz.in payment gatewayā€¦

4 Likes

:hourglass: Already 2 weeks, but here is a beta version of the BTCZ open-source payment gateway! :sunglasses:

https://pay.btcz.app
I let you test it, with small amounts. Please note the invoice number in case of trouble.

  • There is no minimum limitation of the amount.
  • Use of BTCZ, USD, EUR and CHF currencies for the moment.
  • Currency are refreshed only once an hour (temporarily, then I plan every 12 minutes later).
  • The eCommerce plugins will comming soonā€¦

Sources: https://github.com/MarcelusCH/BTCz-Pay
Note: Use this topic if you have any issues or the github repository.

3 Likes

Nice alternative if we donā€™t hear from btcz.inā€¦
tnx

2 Likes

Wow! Amazing job Marcelus! Seems to be a better alternative, which we can improve and use for the others!

1 Like

Yes, itā€™s a base of work for every developer (or coder) that would like us the BTCz as payment method. There is still a lot to doā€¦

I also integrate a currency converter API get method:
https://pay.btcz.app/api/get_btcz_rate
that return a json like:
{"USD":0.000627064909881,"EUR":0.0005327016739824692,"CHF":0.0006050235782986825,"BTC":9.686039165599868e-8}
Iā€™m checking to get up to 10 currencyā€™s refreshed every 12 minutes (now itā€™s only 4 refreshed once per hour).

Itā€™s will maybe help for the Fiat Converter project:
https://forum.btcz.rocks/t/btcz-to-fiat-price-converter-android-app/629/

3 Likes

I hope @Akta86 returns back soon and continue.

1 Like

So far Iā€™ve created a payment gateway using the Gateway form on the main site. I think it works so far with only one thing:

The pingback didnā€™t seem to send any information - I had netcat listening on my pingback address and all I got was:

GET / HTTP/1.1
host: 149.28.202.159:9005
Connection: close

I havenā€™t tested the GET API yet, but the only thing that seems to be missing is a ā€˜success_urlā€™ to send the payer back to the merchant site.

2 Likes

I just updated the code, pingback URLā€™s should now work. I manage the return URL as follow:

  • :srvPingback - Only executed on server side (never return back this value) once success.
  • :cliPingbackSuccess - Returned URL once success.
  • :cliPingbackError - Returned URL if fail (expired or error).
4 Likes

awesome I will test!

3 Likes

is there static ip of the server? so we can use it as extra protection for pingback checkā€¦
i will test it soon with my magento 2 btcz extensionā€¦

2 Likes

Yes there is a static IP (I send it to you in private).
@kovach, could you help with other plugins ?

@Marcelus yes I could, I just have to manage my very limited free timeā€¦
After magento we can check other pluginsā€¦

1 Like

Nice to see you back here! :slight_smile:thank you very much for Magento Bro!
All of our devs hard work should be gifted!

1 Like

Version 0.1.2 (beta) online

Updates

  • Almost instant payment checkout integration (5-8 sec)
    I use a temporary address, already having funds, to transfer the payment of the buyer to the sellerā€™s wallet without waiting for confirmation of the blockchain. Limited to 100 BTCz.
  • Added payment amount in the QR code
  • Added unconfirmed amount in the invoice template
  • Added RUB and GBP currencies support
  • The currencies are now updated 2 time per hour (instead of 1 per hour)
    Since https://pro.coinmarketcap.com/ updated the free account to 333 calls per day, Iā€™m also able to provide (in the actual demo) 2 more currencies and more rate refresh.
  • Show gateway usage statistics (total gateway, expired, paid)

Information about the instant checkout

The instant payment checkout is NOT without risks! In the case of a chain fork or any other transaction ā€œrollbackā€, the buyer will lost the founds. We have also to think about this and other possible issues.

For the demo, I added a ā€œSpeed Pay Feeā€ of 5%. Again, this is only for test proposes and everyone can fork this project and change it to free (or more). I added this fee more to test possibilities to get a return of investment for a service. I will not get rich with this and I do not want to scam people.

Iā€™m open for any discussion about how to improve this functionality :ok_hand:

Here a small demo on Youtube:
(I am not talented in video production, I do only a screen recording)

Need todo

  • [ ] Better explanation of the API usage
  • [ ] Youtube presentation (more professional than actual)
  • [ ] Test check list with 20-50 users and analyze the output logs
  • [ ] FAQ page
  • [ ] Buyer, Seller, Admin stats/login (with 2 factor Auth. by eMail, like https://btcz.me)
  • [ ] Otherā€¦

Stats at 13-OCT-2018 11:45

4 Likes

@Marcelus awesome work!

I got around to testing it again - it looks like ā€˜pingbackā€™ url is actually ā€˜successURLā€™ which means that is the URL that its going to after the payment completes.

SuccessURL vs. Pingback

SuccessURL = redirect after payment completes

PingbackURL = IPN (instant payment notification) URL is the URL that the seller points to so they can update the details about their buyers balance/purchase. It should POST details like that ā€˜statusā€™ etc.

Iā€™ve not tested the GET API yet, but Iā€™m about to test it now to see what the :cliPingbackSuccess and :cliPingbackError payload looks like.

1 Like

Tx for feedback.
I will update the API documentation (with some example) in a couple of days.

To clarify a little the actual usage of the API, bellow some explication how I proceed it with the WP-Woocommerce Plugin.

To create a gateway

I make a request_payment/ GET call on the API as following:

https://pay.btcz.app/api/request_payment/:amount/:currency/:message/:seller_address/:customer_email/:srvPingback/:cliPingbackSuccess/:cliPingbackError/0
(:parameters are the gateway info to use for personnalisation)

:srvPingback = The URL that the gateway GET once itā€™s paid with success (state 5).
In WP-Woocommerce, I manage it like $srvPingbackUrl = $order->get_checkout_order_received_url(); URL that contain the secret phrase like https://theDomain.com/order/32/?WP_key=333fffabc So that the order can be updated.

:cliPingbackSuccess and :cliPingbackError = URL for the client redirection on success (state 5) and on error/expired (state 2)

The ending 0 param is for spped checkout or standard (1=speed)

Example:
https://pay.btcz.app/api/request_payment/2/USD/Hello/t1KhD2unS3KUjcVsANs5ySfxTVE9KTv6K4t/email%40test.test/http%3A%2F%2Fmysite.com%3A2222%2Fapi%2Ftest/http%3A%2F%2Fwww.worldartstamps.com/http%3A%2F%2Fbtcz.app/0
(The URL have to be encoded 2 time to awoid routing issue, I work on this)

It return a JSON string like that with the basic info about the gateway:

{
    "id":"8bb30551-1eb9-4e5a-a056-5dd6e20dfe5b",
    "address":"t1QuAwjsMb7654YhTPpYEfAvJygfdLN2FFJ",
    "link":"bitcoinz:t1QuAwjsMb7654YhTPpYEfAvJygfdLN2FFJ?amount=3993.58593111&message=Hello",
    "qr":"https://pay.btcz.app/generate_qr/bitcoinz%3At1QuAwjsMb7654YhTPpYEfAvJygfdLN2FFJ%3Famount%3D3993.58593111%26message%3DHello",
    "qr_simple":"https://pay.btcz.app/generate_qr/bitcoinz:t1QuAwjsMb7654YhTPpYEfAvJygfdLN2FFJ?amount=3993.58593111"
}

The important param is the ā€œidā€. You will need it for retrieving the gateway status. On this stage, all information like the asked amount, currency, exchange rate, the 3 URL, seller address, ā€¦ , are stored in the database. a new payment address (with QR) is generated that can be retrieved by query of the ā€œqr_simpleā€ param : https://pay.btcz.app/generate_qr/bitcoinz:t1QuAwjsMb7654YhTPpYEfAvJygfdLN2FFJ?amount=3993.58593111

At this stage, a invoice is generated that can be show on this URL (with the id after invoice/):

Fetching Data from Existing Gateway

I make a check_payment/ GET call on the API as following:

https://pay.btcz.app/api/check_payment/:_id

:id = The gateway ā€œidā€ generated abow.

Example:
https://pay.btcz.app/api/check_payment/8bb30551-1eb9-4e5a-a056-5dd6e20dfe5b

It return a JSON string like that with the status info about the gateway:

{
   "error":"gateway expired",
   "generated":"t1QuAwjsMb7654YhTPpYEfAvJygfdLN2FFJ",
   "btcz_expected":3993.58593111,
   "btcz_actual":0,
   "btcz_unconfirmed":0,
   "currency":"USD",
   "amount":2,
   "timestamp_start":1540315982934,
   "timestamp_now":1540317938657,
   "timestamp_stop":1540317782934,
   "state":2,
   "err_callback_url":"http://btcz.app"
}

(in this example with an error: gateway expired)

You can GET this API URL (with the id) as many time as needed. in this case, the :srvPingback URL (with secret key) will never fire up. The :srvPingback URL only fire up on success (state 5). On success, this JSON string contain the "successURL":"https://mysite_or_IP/result/ param instead of err_callback_url param.

Important: The :srvPingback (set in the gateway creation) is never returned in any JSON string. It fire up a GET to the set URL only once the invoice is paid. I only tested it in WordPress with this plugin : https://github.com/MarcelusCH/BTCz-Pay/blob/master/plugin/woocommerce3.4/wp-content/plugins/BTCz-gateway/btcz.php


So, I hope itā€™s more clear :sweat_smile:

To answer you, @cryptorex, I donā€™t think itā€™s needed to ā€œPingbackā€ any other information. Because we know all needed info by the check_payment/ call. And normally the online store, like in Woocommerce, all this info are already linked with the sercret key (Woocommerce_CheckOut_URL / ?WP_key=xyz123). Once this URL is fetched, it should update all the staff ?

But I can append some info after the :srvPingback URL like: &id=xxxx-xxxx-xxxxxx-xxxxxx&paid_amound=1234 ā€¦ Is it really needed ?

Actually, the gateway send nothing back by expired gateway (excepting for client redirection).

1 Like