All Projects → defisapiens → decentrapay

defisapiens / decentrapay

Licence: MIT license
Maker DAI payment processor

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to decentrapay

adyen-hybris
Adyen Payment plugin for Hybris
Stars: ✭ 23 (-68.06%)
Mutual labels:  payment-gateway, payment-processing
mollie-api-go
Golang wrapper for Mollie's REST API with full resource coverage.
Stars: ✭ 45 (-37.5%)
Mutual labels:  payment-gateway, payment-processing
bite-keeper
Maker Keeper Framework: Keeper to bite undercollateralized cups.
Stars: ✭ 46 (-36.11%)
Mutual labels:  dai, stablecoin
ching
Easy, web-based, crypto-first POS that supports DAI and xDAI.
Stars: ✭ 26 (-63.89%)
Mutual labels:  dai, stablecoin
stripe
Stripe integration with Magento 2
Stars: ✭ 58 (-19.44%)
Mutual labels:  payment-gateway, payment-processing
arbitrage-keeper
Maker Keeper Framework: Keeper to arbitrage on OasisDEX, `join`, `exit`, `boom` and `bust`. Efficiently handles both bad debt liquidations and surplus Dai.
Stars: ✭ 102 (+41.67%)
Mutual labels:  dai, stablecoin
stablecoin.services
A gas free offering of common Dai and Chai operations
Stars: ✭ 32 (-55.56%)
Mutual labels:  dai, stablecoin
cybersource-sdk-java
Java SDK for CyberSource Simple Order API
Stars: ✭ 44 (-38.89%)
Mutual labels:  payment-gateway, payment-processing
ThreeDPayment
Est altyapısına sahip tüm bankalarla uyumlu 3DPay model sanal pos örneği - ASP.NET Core 3.1 ile yazılan yeni version https://github.com/sefacan/3DPaymentAspNetCore
Stars: ✭ 29 (-59.72%)
Mutual labels:  payment-gateway, payment-processing
adyen-python-api-library
Adyen API Library for Python
Stars: ✭ 41 (-43.06%)
Mutual labels:  payment-gateway, payment-processing
paymentgateway
Dokumentace ČSOB platební brány a jejího eAPI pro platby platebními kartami, Apple Pay, mallpay a platebními tlačítky ČSOB.
Stars: ✭ 104 (+44.44%)
Mutual labels:  payment-gateway, payment-processing
adyen-salesforce-commerce-cloud
Salesforce Commerce Cloud (formerly Demandware)
Stars: ✭ 63 (-12.5%)
Mutual labels:  payment-gateway, payment-processing
cybersource-android-sdk
The CyberSource InApp SDK enables developers to simply and securely incorporate mobile payments into their Android applications.
Stars: ✭ 25 (-65.28%)
Mutual labels:  payment-gateway, payment-processing
MMORPGMaker-MV
Plugin to transform RPG Maker MV to MMORPG Maker MV
Stars: ✭ 67 (-6.94%)
Mutual labels:  maker
Far-From-Home
A cross-platform mobile developed using Flutter and Firestore for House Rental Application with integrated payment module
Stars: ✭ 27 (-62.5%)
Mutual labels:  payment-gateway
zevoicemask
An open source DIY implemetation of a face mask with voice visuals and animations.
Stars: ✭ 13 (-81.94%)
Mutual labels:  maker
svg-path-outline
Create an outline surrounding an SVG path
Stars: ✭ 56 (-22.22%)
Mutual labels:  maker
Online-Book-Store
An online Book Store createed with Python / Flask rest, MySql,Angular and Bootstrap
Stars: ✭ 76 (+5.56%)
Mutual labels:  payment-processing
custom-hotword-for-aiy-voicekit
Snowboy API for AIY Voice Kit
Stars: ✭ 26 (-63.89%)
Mutual labels:  maker
MagPiDownloader
Downloads all the Mag Pi (Raspberry Pi Magazine) on your Windows, Mac OS or Linux or with Docker
Stars: ✭ 70 (-2.78%)
Mutual labels:  maker

Decentrapay is an open-source payment processor which allows you to receive stablecoin tokens for payments.

Motivation

The goal of the project is to provide merchants with a decentralized, trustless solution to accept payments on the Ethereum blockchain.

Features

  • Direct P2P payments
  • No volatility risk as stablecoins are tied to fiat
  • Complete control over private keys
  • No middleman
  • REST API for managing invoices
  • Web interface for accessing invoices
  • A tool for managing generated wallets and forwarding payments

Requirements

  • Node v12 or newer
  • Access to the Ethereum network

Installation

Run the below commands:

git clone https://github.com/defisapiens/decentrapay.git
cd decentrapay
npm install

Don't forget to update local reposotory regularly to catch up with latest updates

git pull origin master
npm install

Configuration

Decentrapay needs to connect to the Ethereum network to process transactions. You have two options:

  • Connect to a locally running Ethereum node (geth or parity)
  • Use a third-party node service provider such as Infura

Open config/default.cson in a text editor and make necessary changes:

  1. If you are using an external node provider, update the provider section
provider:
  type: "rpc"
    uri: "http://localhost:8545" # replace with an endpoint URL from an external provider
  1. Change the apiKey to some unique string. The API key is used to post invoices to Decentrapay.

Running Decentrapay

To run the server in development mode, use the following command:

    npm run dev 

For production mode:

    npm run build
    npm start

API

Invoice object has the following properties:

  • apiKey - The API key to verify that the invoice creator is trusted (it is not stored in the database)
  • currency - Currency of the invoice. DAI,USDT,TUSD,USDC are supported at the moment. (optional)
  • merchant - The information about the merchant (optional)
    • name - The merchant’s name
    • address - The address to be displayed in the invoice
  • items - an array containing the invoice items. Decentrapay calculates totalAmount for all items and stores it with the invoice.
    • description - item description
    • quantity - number of units to be purchased (optional, default is 1)
    • amount - the unit cost
  • metadata - contains arbitrary data which is passed back to the app via the callback (see below). (optional)
  • expires - a timestamp until the invoice is valid (optional, default is 24 hours after the invoice was created)
  • callbacks - specifies where Decentrapay server should send a POST request containing token and metadata for notifying the app that the payment occurs.
    • token - a secret token to verify that the callback is originated from Decentrapay server
    • paid
      • url - where POST request should be sent to

Invoices can be created by sending a POST request to the /api/v1/invoice endpoint

An example with curl (replace API_KEY with the apiKey from the config file):

    curl http://localhost:8000/api/v1/invoice --header "Content-Type: application/json" -X POST -d '{"apiKey":"API_KEY",currency:"DAI","items":[{"description":"My item","amount":1}]}'

The backend will create a new invoice record and return its id

    {"invoiceId":"bfuWuYgRs"}

The invoice can be viewed in a browser at http://localhost:8000/invoice/bfuWuYgRs

Decentrapay invoice

Also, the invoice record can be accessed via REST API:

    curl http://localhost:8000/api/v1/invoice/bfuWuYgRs


    {"deposit":{"_id":"xm-8-8lThd","address":"0xE6F2392Fe8ED75f684cb93fA0e278f0E404a8522"},"_id":"bfuWuYgRs","items":[{"description":"item #1","amount":1}],"totalAmount":1,"paidAmount":0,"created":1548735086893,"state":"pending","__v":0}

Upon creation, an invoice gets linked with a deposit address generated by DecentraPay server. Private keys are stored in the local database in plain text format.

Newly created invoices have pending state. After an invoice is paid its state will be changed to confirming. Then the server waits for the number of blocks specified in the configuration as minConfirmations (default is 1) and if thereafter the invoice balance is not less than totalAmount, the server changes the invoice state to paid and notifies the app via callback that the payment was done. The app should return HTTP code 200 to acknowledge that the invoice was processed. Then the invoice status is changed to closed.

If the invoice was not paid on time, as configured by the expires property, its status will be set to expired and no callbacks will be called thereafter.

Maintainence

Collecting payments

Until it is possible to pay for gas with tokens on the Ethereum network, collecting and forwarding payments can be a bit challenge because generated wallets need gas in order to be able to transfer DAI. For that purpose, Decentrapay includes a tool named wallets that funds wallets with small amounts of ETH if needed and then transfer tokens out.

Example command usage:

npm run wallets --  --fundamount 0.001 --collect <YOUR ETHEREUM ADDRESS> --privatekey 4e4a0db6ee08f21c68923f9a068a40c97769796fc88232c465a932d102a6eab4

the collect parameter specifies the destination address for collected payments and the privatekey is a private key of any account with small amount of ETH (it can be a key exported from MetaMask, for example). In the result, each non-empty wallet that linked to a closed invoice will be funded with 0.001 ETH if needed and then DAI tokens be transferred out to the specified address. Released wallets will be then re-used by the backend because there is a high chance they still have gas.

IMPORTANT: Be careful when using this tool - any mistake may result in lost funds. Do not use accounts with large amounts of ETH.

TODO

  • Adding a project logo
  • Point-of-Sale mode

CREDITS

  • Inspired by Baron project
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].