{"id":13673851,"url":"https://github.com/Overtorment/Cashier-BTC","last_synced_at":"2025-04-28T13:31:55.859Z","repository":{"id":39615922,"uuid":"44130541","full_name":"Overtorment/Cashier-BTC","owner":"Overtorment","description":"💰 Self-hosted Bitcoin payment gateway (฿)","archived":true,"fork":false,"pushed_at":"2018-07-25T19:12:37.000Z","size":156,"stargazers_count":293,"open_issues_count":12,"forks_count":104,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-21T21:51:48.843Z","etag":null,"topics":["bitcoin","bitcoin-payment-gateway","btc","invoice","microservice","payment-gateway","payment-request","request-payment"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Overtorment.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-12T19:52:18.000Z","updated_at":"2025-04-09T11:49:15.000Z","dependencies_parsed_at":"2022-09-13T03:00:17.303Z","dependency_job_id":null,"html_url":"https://github.com/Overtorment/Cashier-BTC","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Overtorment%2FCashier-BTC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Overtorment%2FCashier-BTC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Overtorment%2FCashier-BTC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Overtorment%2FCashier-BTC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Overtorment","download_url":"https://codeload.github.com/Overtorment/Cashier-BTC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251319757,"owners_count":21570451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","bitcoin-payment-gateway","btc","invoice","microservice","payment-gateway","payment-request","request-payment"],"created_at":"2024-08-02T11:00:25.953Z","updated_at":"2025-04-28T13:31:50.817Z","avatar_url":"https://github.com/Overtorment.png","language":"JavaScript","funding_links":[],"categories":["Blockchain API and Web services"],"sub_categories":[],"readme":"Cashier-BTC\n===================\n\nv2 refactored and improved\n---------------------------\n\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) Tests: [![CircleCI](https://circleci.com/gh/Overtorment/Cashier-BTC.svg?style=svg)](https://circleci.com/gh/Overtorment/Cashier-BTC)\n\nSelf-hosted Node.js Bitcoin payment gateway. Provides REST API (microservice).\nProcess Bitcoin payments on your end, securely, with no comission.\n\nRequest payments (invoicing), check payments (whether invoice is paid), receive callbacks if payment is made.\nAggregate funds on final (aggregational) address.\nDepends on Nodejs v8+, Bitcoin Core, Couchdb for storage.\n\n* Simple\n* No 3rd parties (works though Bitcoin Core node)\n* Transactions are signed locally. No private keys leak\n* Battle-tested in production\n* SegWit compatible\n\n\nInstallation\n------------\n\n```\n$ git clone https://github.com/Overtorment/Cashier-BTC \u0026\u0026 cd Cashier-BTC\n$ npm install\n$ cp config.js.dev config.js\n```\n\n* Install [Bitcoin Core](BITCOIN-CORE-INSTALL.md)\n* Install Couchdb (or use [https://cloudant.com](https://cloudant.com))\n\nEdit `config.js`:\n\n* Point it to a new Couchdb database\n* Point it to a Bitcoin Core RPC server\n\nTests\n-----\n\n```\n$ npm test\n```\n\nRunning\n-------\n\n```\n$ nodejs cashier-btc.js\n$ nodejs worker.js\n$ nodejs worker2.js\n```\n\nOpen [http://localhost:2222](http://localhost:2222) in browser, you should see 'Cashier-BTC reporting for duty'.\nThat's it, ready to use.\nUse tools like `supervisord` or `foreverjs` to keep it running.\n\nLicense\n-------\n\n[WTFPL](http://www.wtfpl.net/txt/copying/)\n\nAuthor\n------\n\nIgor Korsakov\n\n\nTODO\n----\n\n* [x] ~~Get rid of Chain and leave Bitcore only~~\n* [x] ~~Add options to work through bitcoind and other bitcoin network endpoints~~\n* [x] ~~Add tests~~\n* [x] ~~Better abstractioning (add more abstraction layers)~~\n* [x] ~~CI~~\n* [ ] Better logging \u0026 error handling\n* [ ] Stats\n* [ ] Better tests\n* [x] ~~Ditch bitcore-lib in favor of bitcoinjs-lib~~\n* [x] ~~SegWit~~\n* [ ] Flexible (user-defined?) fees\n* [ ] BigNumber lib for all numbers handling\n\n\nAPI\n===\n\n### GET /request_payment/:expect/:currency/:message/:seller/:customer/:callback_url\n\n\nCreate a request to pay, supported currencies: BTC, USD, EUR. Non-btc currency is converted to btc using current rate from bitstamp.com.\nReturns a json document with QR code to be displayed to the payer, and a unique address for that particular payment (you can use it as invoice id).\nMessage will be displayed to the client (for example, you can write \"Payment for goods\"). Seller and customer - system field, here you can\nwrite the application that created the request and the payer id. Keep Seller field private, it is also used for payouts.\nCallback_url will be requested once the invoice is paid.\n\n\tExample\n\n\t\thttp://localhost:2222/request_payment/0.005/BTC/wheres%20the%20money%20lebowski/treehorn/lebowski/http%3A%2F%2Fgoogle.com%2F\n\n\tResponse\n\n\t\t{\n\t\t\t\"link\" : \"bitcoin:1DzJepHCRD2C9vpFjk11eXJi97juEZ3ftv?amount=0.004\u0026message=wheres%20the%20money%20lebowski\",\n\t\t\t\"qr\" : \"http://localhost:2222/generate_qr/bitcoin%3A1DzJepHCRD2C9vpFjk11eXJi97juEZ3ftv%3Famount%3D0.004%26message%3Dwheres%2520the%2520money%2520lebowski\",\n\t\t\t\"qr_simple\" : \"http://localhost:2222/generate_qr/1DzJepHCRD2C9vpFjk11eXJi97juEZ3ftv\",\n\t\t\t\"address\" : \"1DzJepHCRD2C9vpFjk11eXJi97juEZ3ftv\"\n\t\t}\n\nLink can be opened by the payer, there is a chance it will be handled by his bitcoin wallet.\nQR shoud be shown to payer as well. Duplicate it with text, like, dear user, please pay the %expect% amount to %address%.\n\n### GET /check_payment/:address\n\n\nCheck payment by a unique address received in the \"request_payment\" call.\n\n\n\tExample\n\n\t\thttp://localhost:2222/check_payment/16FsTPe5JG8yj1P31AqXrMGzu7iAet7NTL\n\n\tResponse\n\n\t\t{\n\t\t\t\"btc_expected\" : 0.0001009,\n\t\t\t\"btc_actual\" : 0.0001009,\n\t\t\t\"btc_unconfirmed\" : 0.0001009\n\t\t}\n\nUsing difference between \"btc_expected\" and \"btc_actual\" you can judge whether payment request (invoice) was paid.\nYou can use this call to implement some kind of frontend animation which shows 'waiting for funds', and \npolls periodically about the status of payment (i.e. unconfirmed incoming funds, paid in full/not in full).\nIn case you accept unconfirmed balances (see `config.small_amount_threshhold`), you might want to check payment again before shipping actual goods.\n\n\n\n\n### GET /payout/:seller/:amount/:currency/:address\n\n\nTransfer funds from aggregated seller's address to some other address.\nSupported currencies: BTC.\nThere's no additional sequrity here, it is presumed that the %seller% identifier is kept secret.\nYou might want to disable this call for security reasons (or manually replace seller's address in \ndatabase with the one you control).\n\n\tExample\n\n\t\thttp://localhost:2222/payout/new_test_seller/0.01/BTC/1MahZCousgNv6EAofCfi7Wpp2RKUfHH8uD\n\n\tResponse\n\n\t\tIf successfull, json document with transaction details (txid etc)\n\n\n### GET /get_seller_balance/:seller\n\n\nCheck the total balance of seller's aggregated address.\n\n\tExample\n\n\t\thttp://localhost:2222/get_seller_balance/treehorn\n\n\tResponse\n\n\t\tJson encoded available balance\n\n\nHardening for Production\n------------------------\n\nWhen the `seller` is created in `/request_payment/` call, database record also stores seller's `address` \nand associated `WIF` which allows to spend seller's aggregated funds.\nYou might want to manually replace this record with your own `address` (probably a cold storage), and not putting `WIF` in the record.\nThis breaks the `/payout/` call, but at least the funds from orders will be forwarded to a secure storage.\n\nSmall risk remains with hot wallets still having their `WIFs` in the database, but this is a reality any other Bitcoin processor\nhas to live in.\n\nAlternatives\n============\n\nOpensource alternatives\n----------------------\n\n* https://github.com/btcpayserver/btcpayserver\n* http://docs.electrum.org/en/latest/merchant.html\n* Your project here\n\nSaaS alternatives\n-----------------\n\n* https://coingate.com/accept-bitcoin\n* https://www.coinpayments.net\n* https://coinsbank.com/merchant\n* https://www.blockonomics.co/merchants#/page1\n* https://www.paybear.io\n* https://globee.com/\n* https://opennode.co/ (lightning)\n* https://strike.acinq.co/ (lightning)\n* ~~coinbase~~ crap\n* ~~bitpay~~ crap\n* ~~Coinify~~ crap\n* ~~Gocoin~~ crap\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOvertorment%2FCashier-BTC","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOvertorment%2FCashier-BTC","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOvertorment%2FCashier-BTC/lists"}