Management Commands

django-solana-payments provides commands to keep payment/wallet records healthy and to move funds from one-time wallets to your main wallet.

All commands support:

--sleep <seconds>

Use –sleep to add a delay between blockchain operations and reduce rate-limit issues.

1. Expire Payments And Close Wallets

Command:

python manage.py close_expired_solana_payments_with_wallets

What it does:

  • Marks expired initiated payments as expired.

  • Tries to close related expired one-time wallets.

Example with delay:

python manage.py close_expired_solana_payments_with_wallets --sleep 0.2

2. Send Funds From One-Time Wallets

Command:

python manage.py send_solana_payments_from_one_time_wallets

What it does:

  • Scans one-time wallets in processing/failed-send states.

  • Sends available funds from one-time wallets to your configured receiver wallet.

Example with delay:

python manage.py send_solana_payments_from_one_time_wallets --sleep 0.2

3. Close Expired Wallets And Reclaim Rent

Command:

python manage.py close_expired_one_time_wallets_and_reclaim_funds

What it does:

  • Finds wallets in PAYMENT_EXPIRED state.

  • Closes eligible associated token accounts (ATAs) to reclaim locked rent.

Example with delay:

python manage.py close_expired_one_time_wallets_and_reclaim_funds --sleep 0.2

4. Recheck Initiated Payments (On-Chain Reconciliation)

Command:

python manage.py recheck_initiated_solana_payments

What it does:

  • Scans payments that are still in initiated status.

  • For each payment, checks token options tied to that payment and verifies on-chain wallet activity.

  • If payment is detected as paid, it updates payment status and executes acceptance signal/hooks.

Use this when:

  • Customer already paid to the one-time wallet.

  • API/webhook verification flow was missed or delayed.

  • DB remained initiated even though payment happened on chain.

Options:

--limit <int>   # max initiated payments to scan (default: 200)
--sleep <sec>   # optional delay between checks

Example:

python manage.py recheck_initiated_solana_payments --limit 500 --sleep 0.1