CryptoCashier is a minimalistic and open-source cryptocurrency gateway payment processor. It allows your projects to accept payments in a secure manner without storing private keys and using scan APIs for transaction confirmations. Payments are accepted directly to your existing crypto wallets.
- Supports most popular cryptocurrencies: USDT, USDC, ETH on Ethereum chain; USDT, USDC, TRX on Tron chain.
- Works with your existing wallets; no need to manage private keys, just add your raw addresses in admin panel.
- Automatically generates new addresses if existing ones are busy. These generated addresses can be imported into wallets like Metamask or Tronlink.
- Securely dump and delete private keys of generated addresses from the database.
- Admin panel for managing merchants, payment methods, addresses, invoices
- Easy deploy with docker: just start services and expose to public
- This project is built and tested on Debian 12, but you can use any other Linux distribution.
- Docker and Docker Compose installed on your system.
- Basic knowledge of Linux bash.
- Clone the repository:
git clone https://github.com/simple-roll/crypto-cashier.git
cd crypto-cashier
- Generate environment variables:
./generate_dotenv.sh
Important: Copy and store the generated DB_FIELD_ENCRYPTION_KEY
securely. Losing this key may result in the loss of your funds if you didn't dump your keys.
- Configure your
.env
file with necessary details:
DB_FIELD_ENCRYPTION_KEY
: copy this generated key and store it in a safe place.DJANGO_SUPERUSER_PASSWORD
: store admin access passwordDJANGO_ADMIN_SECRET_PATH
: store the secret URL path to the admin panelETHERSCAN_API_KEY
andTRONSCAN_API_KEY
: Optional API keys for scan sites to increase API request limits. Recommended, but not required.TIME_ZONE
: set same timezone with your shops or services. List of all timezones can find here. Recommended but not required.NGINX_PORT
andGUNICORN_PORT
: ensure these port numbers are not busy on your system. Change to any other free ports if not
- Build and start the services:
docker compose up --build
- Go to admin panel using generated
DJANGO_ADMIN_SECRET_PATH
in URL. Use your savedDJANGO_SUPERUSER_PASSWORD
for login. You can find everything in the.env
file.
127.0.0.1/{DJANGO_ADMIN_SECRET_PATH}/admin
- Create your first
Merchant
for your shop or service. Set thecallback_url
to receive payment results on your service. You can just setlocalhost
for first try test.
After it created copy its merchant uuid.
Add your own cryptocurrency addresses or leave the Address
list blank, and the merchant will generate new ones as needed. One address can be used by several Merchant
s.
Important: If you add your own addresses, please refrain from accepting payments to them manually, as this can conflict with customer payments and cause errors.
Let's simulate a payment for a VPN service using Ethereum.
- Replace YOUR_MERCHANT_UUID with your created merchant uuid, copy and paste URL to browser
127.0.0.1/create_invoice/?merchant_uuid=YOUR_MERCHANT_UUID&order_id=1&product_name=VPN&chain_name=ETHEREUM&coin_name=ETH&amount=0.05
This URL contains the following parameters:
merchant_uuid
: Merchant UUIDorder_id
: may contains letters, digits and other urlsafe chars.product_name
: name of the product that customer pay for.chain_name
: may containsETHEREUM
orTRON
.coin_name
: may containsUSDT
,USDC
,ETH
,TRX
.amount
: coin amount for pay
- By this URL you can open creating
Invoice
page with auto filled hidden form and everything is need just check payment details and pushPay
.
- Will open
Invoice
page and start background transactions checking job until they will be confirmed orInvoice
expired.
The merchant supports multiple transactions for a single Invoice
, and the service calculates the sum and sets one of three confirmed statuses:
Confirmed
: Invoice amount paid extactly as set. Payment successful.Overpaid and confirmed
: Invoice amount overpaid and confirmed. Payment successful.Underpaid and confirmed
: Invoice amount underpaid but confirmed. Payment failed.
Overpaid and underpaid info sending with callback requests to your shop/service.
After the service generates a new Address
, you should extract its private key and mnemonic phrase using bash. Before execute these commands, ensure the project is currently running.
- Come to running project dir
cd path/to/crypto-cashier
- Dump all private keys and mnemonic phrases
./manage.sh dump_private_keys
-
Copy all output JSON data and save it in a safe place. Also you can use it to import into your wallet, such as Metamask or Tronlink.
-
Ensure you have saved all the dump command output from the previous step. Delete all private keys and mnemonic phrases from merchant service database using this command
./manage.sh delete_private_keys
- After deletion these addresses can still accept payments but do it in the total safe way.
Etherscan and Tronscan APIs have low rate limits without API key. For stable operation, set API keys in your .env
file if you expect to process more than 10 invoices per day. Just make free accounts of these scansites, get API keys from accounts settings and set to .env
params ETHERSCAN_API_KEY
and TRONSCAN_API_KEY
.
Merchant
sends notifiction callback in any case: successful and failed payments. Here are the POST request parameters sent to Merchant.callback_url
after an invoice is confirmed or in case of failure:
is_payment_successful
:true
whenInvoice
payment confirmed or overpaid, andfalse
in any other case.merchant_uuid
: your createdMerchant
UUID in the Cashier admin.order_id
: shop/service order id, supports letters, digits, etc.order_amount
: amount that customer should pay.amount_confirmed
: how much customer has paid in fact.amount_overpaid
: how much customer overpaid.amount_underpaid
: how much customer underpaid.payment_status
:CONFIRMED
,OVERPAID_CONFIRMED
,UNDERPAID_CONFIRMED
,CANCELED
, orEXPIRED
.coin_name
:USDT
,USDC
,ETH
, orTRX
.chain_name
:ETHEREUM
orTRON
.chain_txids
: list ofInvoice
transactions txids.sign
: callback request sign to filter some fake requests from attackers.
Checking the sign
of the callback request is important because anyone can send a POST request to your shop/service claiming a successful payment. To prevent this, you must verify the request's sign using Merchant.sign_key
. Copy this auto generated key from admin Merchant
page and use for checking callback request. Here is Python example below
import json
import hashlib
MERCHANT_SIGN_KEY = "paste key here"
def check_sign(request):
params = json.loads(request.POST)
sum_source = ":".join([
MERCHANT_SIGN_KEY,
str(params['merchant_uuid']),
str(params['chain_name']),
str(params['coin_name']),
str(params["order_amount"]),
]).encode()
md5 = hashlib.md5(sum_source).hexdigest()
if md5 == p['sign']:
print("Sign correct")
else:
raise ValueError("Sign incorrect")
You need to build a source string containing the parameters sign_key
, merchant_uuid
, chain_name
, coin_name
, and order_amount
, separated by :
, and calculate the md5
sum. Then compare with sign
param in callback request it must be same.
I welcome everyone who understands this project and has good ideas. Your contributions are valuable to us. Feel free to fork the repository, make improvements, and submit pull requests.
If you need assistance setting up this project for your service, please contact me at: goplua@proton.me. I am happy to help but not for free.
If you like this job please support me and I will make more nice stuff like this, here are my donation addresses:
- Ethereum (or any EVM): 0x965311B06Ff6DD813804280220BD33f19a586407
- Tron: TBEsCFe3dCrJGoJYseVVHsBCN85YJxXVDN