flowrakis-taler_fastify-plugin
v0.60.0
Published
Add privacy aware GNU Taler Payments to your fastify projects
Maintainers
Readme
A GNU Taler Plugin for fastify
Plugin to easily add direct GNU Taler* support into your fastify website.
This project is kindly supported by NGI Taler by the NGI Initiative.
GNU Taler is not a coin, but a payment system. In Switzerland you can use it with Swiss Francs (CHF) or you can build your own local currency with it.
Online Demo
There is a demo running at https://fastify-plugin.taler.flowrakis.eu/
Local Offline Demo & Server
You can run that demo locally with
$ PORT=3001 npx flowrakis-taler_fastify-plugin demoNote that the GNU TAler wallet will not offer the 'Continue to merchant' after payment unless running over https/in development mode. So the this will fail returning to flowrakisOrderPaymentFulfillmentUrl by default locally.
You can also use it to serve a static web shop from your local folder.
Create a simple index.html with one article
<article>
<form method="POST" action="/api/flowrakis/order">
<input type="hidden" name="flowrakisOrderPaymentFulfillmentUrl" value="/goods/article-1" />
<input type="hidden" name="flowrakisGoods" value="Blue Skies Forever" readonly />
<figure>
<img src="https://placehold.co/300x300" alt="Product preview">
</figure>
<header>
<h2>Blue Skies Forever</h2>
<p>Blue Skies for life and beyond (plus a few sheep clouds sprinkled in for free)</p>
</header>
<footer>
<p><input type="hidden" name="flowrakisAmount" value="$1.11TESTKUDOS" readonly />1.11 TESTKUDOS</p>
<button type="submit">Buy</button>
</footer></form>
</article>and open it with
$ npx flowrakis-taler_fastify-plugin serve Using the Plugin
Install in your project
$ npm install flowrakis-taler_fastify-plugin --save And employ
import Fastify from 'fastify'
import flowrakisTaler_fastifyPlugin_Js from 'flowrakis-taler_fastify-plugin'
let fastifyApp = Fastify(fastifyOptions)
await fastifyApp.register(flowrakisTaler_fastifyPlugin_Js)
await fastifyApp.ready()
.then ( fastifyApp => fastifyApp?.listen({ port: 3000 } ))
.then( () => console.log('Server running at http://localhost:3000') )Enter you credentials under http://localhost:3000/api/admin/taler/merchant or use the default sandbox settings.
Please note that for production you should run behind a reverse proxy and protect the administration routes with auth.
REST Documentation / OpenApi
Head to https://fastify-plugin.taler.flowrakis.eu/documentation/#POST/api/flowrakis/order/ to post an order like
{
"flowrakisAmount": "$1TESTKUDOS",
"flowrakisDescription": "Simple as that"
}Then you can retrieve it with the flowrakisOrderId from https://fastify-plugin.taler.flowrakis.eu/documentation/#GET/api/flowrakis/order/{flowrakisId} already, or reafund it at https://fastify-plugin.taler.flowrakis.eu/documentation/#POST/api/flowrakis/refund/
For Contributers
The core dependency is fastify-taler which abstracts from the actual server implementation.
