DEV Community

Bulent Kocaman for PD Modules

Posted on

Taking cryptocurrency on Blesta invoices, paid directly into your own wallet

A client emails: "Can I pay my renewal in USDT?" On Blesta, saying yes is mostly plumbing. Who receives the funds? How does Blesta learn the invoice is settled? What if they send slightly too little, or an hour late?

Many hosted crypto gateways answer those questions by taking custody: the client pays them, and they settle with you afterwards, minus a fee. This guide is about the other model, where coins move from the client's wallet to yours with nobody in between, and the billing side is automated around that.

One payment, start to finish

  1. The client opens an unpaid invoice in the Blesta client area and picks the crypto option.
  2. They choose a coin. The page shows a precise amount, the network, a receiving address, a scannable QR code and a countdown.
  3. They send from their wallet app or exchange.
  4. Your side spots the transaction, then waits while the network confirms it.
  5. Once it's confirmed, the payment is applied to the invoice in Blesta, and the client gets an email.

Every step hides a choice, so here they are as questions.

Which wallet should receive?

Start with control. If you want spending authority to stay entirely with you, connect a receive-only (watch-only) wallet: your billing system gets an extended public key or a list of receiving addresses, and nothing that can move money.

If you'd like refunds or treasury moves automated, the alternative is a hot wallet, whose key sits encrypted on your server. Treat it like a till rather than a safe. Keep a modest float in it, set sending limits and an allow-list of destinations, and sweep anything above a threshold out to cold storage.

A third route is a deposit address from your own exchange account. Convenient if you sell crypto for sterling regularly, but the exchange is then holding those coins for you.

Will each invoice get its own address?

Ideally, yes: whatever reaches address X then belongs to invoice Y.

  • Bitcoin and Litecoin: derive a new address per invoice from your xpub or zpub.
  • Ethereum-style networks: wallets rarely expose an extended key, so load a pool of addresses you own. Each invoice reserves one exclusively until it's settled or lapses, and you should top the pool up before it runs dry.
  • A single shared address: possible, and quick to configure, but then only the amount distinguishes clients. A payment that doesn't fit any open invoice cleanly, when more than one could own it, waits for staff to assign it. Bear in mind that a shared address publishes your receipts to anyone with a block explorer.

So treat the shared address as a fallback, not a default.

How long is the price fair?

Crypto rates move by the minute, so the amount shown is locked only for a set period; half an hour is a common choice. Behind that number you want:

  • several rate providers queried in priority order, falling through if one is unavailable;
  • a maximum rate age, after which that coin is hidden from checkout instead of being priced on stale data;
  • a check that holds a coin back when two providers diverge too far;
  • a modest uplift on the converted figure, absorbing rounding, outbound network costs and drift.

When is a payment real?

Seen isn't settled. Decide how many confirmations each coin requires; higher is safer but slower. As a rough guide, Bitcoin can take 10 to 60 minutes, and most other coins are quicker.

Also think about clients who pay just as the countdown ends. Continue monitoring an expired quote for something like 24 hours. Funds detected within the window still clear normally once confirmed; funds that first appear afterwards go into a review queue so a person can settle them.

Set a minimum per coin too, so tiny invoices aren't offered where moving the money later costs more than it's worth.

What if the amount is wrong?

Underpayments are routine, because many exchanges subtract a withdrawal fee in transit. Set a small percentage you'll write off automatically, and above it the client is asked to send the remainder. Make your price uplift larger than that allowance, and a borderline payment still leaves you whole.

Surplus funds need a rule as well: credit them to the client's account for future invoices, or park them for manual review.

How do refunds work in Blesta?

There's no way to pull coins back from a blockchain, and Blesta has no refund button for a non-merchant gateway like this. A refund is a separate outbound transfer that you initiate, so:

  • get the destination in writing from the client; coins returned to the address an exchange withdrawal came from can be lost;
  • with a receive-only wallet, send from your own wallet app, then log the transaction against the payment;
  • with a hot wallet, sending can happen from the admin side, subject to your limits;
  • know Blesta's accounting rules: refunding a whole payment marks it Refunded, and its invoice shows as unpaid again (void it if nothing is owed), while a partial refund is a negative payment and the invoice stays paid.

Rehearsing safely

First, enable the gateway itself: in Blesta, go to Settings → Company → Payment Gateways → Available, install it, then assign the currencies it should accept under Installed.

Before any live coin, switch to test networks (Ethereum's Sepolia, or testnet versions of Bitcoin and Litecoin) and settle a brand-new test invoice from start to finish. A request opened earlier keeps the network it was created on, so don't reuse one. Deliberately send a little less, and once let the timer lapse, to see both exception paths. Then switch back to live and recheck your mainnet receiving details.

The module we built for this

PD Crypto Pay is our Blesta gateway for exactly this flow. Funds go directly to the wallet or exchange account you choose, with no commission from us. Coins include Bitcoin, Litecoin and Ethereum, with BNB Smart Chain, Arbitrum and other networks, and tokens like USDT or USDC. It offers receive-only and hot wallets, per-invoice addresses or address pools, the payment rules described here, client emails, refunds and a test mode. It's managed from the free PD Modules panel inside Blesta.

PD Crypto Pay for Blesta has the full feature list. Questions are welcome below.

PD Modules is made by Projektif Digital Ltd, the team behind PD Hosting.

Top comments (0)