PFlux DOCS
GitHub Integration enquiries Create a payment link
INTEGRATIONS/BLESTA

P2Flux for Blesta

Blesta invoices paid in USDC on Base, straight to your own wallet, including automatic payments for recurring services.

GATEWAYP2Flux (USDC) · 1.0.0
BLESTA6.x, non-merchant gateway
SETTLESUSDC on Base
CUSTODYNone — direct to your wallet
BLESTA INVOICE → P2FLUX → USDC ON BASE

A Blesta invoice is paid in P2Flux’s checkout from the client’s own wallet; the money lands in your wallet in the same transaction. Blesta records the payment only after the P2Flux API has confirmed that transaction on chain. There is no P2Flux account, no API key and no balance to withdraw.

Overview

The gateway adds P2Flux (USDC) to Blesta’s non-merchant gateways. Clients pay invoices in USDC on Base with MetaMask, Rabby or a phone wallet (by QR code). For recurring services the client can also choose automatic payment: they approve once, and P2Flux collects every period.

Both networks are supported: Base Sepolia for testing with faucet money, and Base Mainnet for real USDC.

Requirements

REQUIREMENTDETAIL
Blesta6.x (tested on 6.0.3).
PHP8.1 or newer with curl, json and mbstring.
Invoice currencyUSD. USDC is a US-dollar stablecoin; Blesta offers the gateway only for USD invoices.
WalletA Base wallet address of your own that receives the payments.
Reachable over httpsP2Flux sends its confirmations to Blesta’s gateway callback, so it must be reachable from the internet over https.

Installation

  • Download p2flux-blesta-1.0.0.zip from the GitHub releases (or the Blesta Marketplace).
  • Unzip it into components/gateways/nonmerchant/ — you get components/gateways/nonmerchant/p2flux/.
  • In Blesta: Settings → Company → Payment Gateways → Available, install P2Flux (USDC).
  • Enter your wallet address, choose the network, tick USD under Accepted Currencies, save.

Settings

SETTINGWHAT IT DOES
Your wallet addressThe Base wallet that receives every payment (0x followed by 40 characters).
NetworkBase Mainnet (real USDC) or Base Sepolia (test, no real money).
Buyers can pay without ETHClients pay the network cost in USDC instead of ETH; a fixed 0.10 USDC per payment comes out of your amount. One-time payments only.
Offer automatic payment for recurring servicesShows “Pay automatically every …” on invoices of recurring services (on by default).
Public callback base URLOnly behind a proxy or tunnel, or when the server answers more than one hostname: the public https://…/callback/gw address P2Flux sends confirmations to. Otherwise the company’s hostname is used.
NO SECRETS TO STORE

P2Flux has no API key. The gateway signs the links on your pay page with Blesta’s own system key, so a client cannot change who or what a payment is for.

One-time payments

On the invoice’s payment page the client clicks Pay with USDC. P2Flux’s checkout opens in a small window, the client pays from their wallet, and the window hands the transaction back to Blesta, which shows its “payment received” page. If the window is closed early, the payment is still recorded when P2Flux’s confirmation arrives (retried for about 18 hours).

A second click on an unpaid invoice reuses the same payment; an invoice that is already paid shows “already paid” instead of a new payment.

Automatic payments

When an invoice belongs to a recurring service, the client can choose Pay automatically every …. They approve once in their wallet; P2Flux charges the first period immediately (applied to that invoice) and then collects every period by itself. Each later charge is recorded as a payment to the client’s account and applied to the open renewal invoice by Blesta’s Auto Apply Credits (on by default).

BILLINGFixed intervals: a month is 30 days, a year 365 days. The amount is fixed; a price change needs a new approval from the client.
STOPPINGThe client can stop at any time from the P2Flux payment page. If you cancel the service in Blesta, the next charge that still arrives is kept as credit and collection is stopped.
ONE LINKEach automatic payment uses its own P2Flux link. Only the first wallet that subscribes through it is the client’s; anyone else using the same link is stopped and never credited.
MINIMUMAt least 1 USD per period and a period of at least one day.

How payments are recorded

  • Only what the P2Flux API confirms on chain is recorded. Client, invoices and amount come from the gateway’s own record, never from the request.
  • The Blesta transaction ID is the blockchain transaction hash. Each transaction is recorded once, even when the client’s browser and P2Flux’s confirmation arrive at the same moment.
  • A payment of a different amount than the invoice is recorded as credit, not applied.
  • Every confirmation is in Blesta’s gateway log.

Changing settings later

Switching the network or the wallet invalidates every payment page started before (pay pages are valid for a day). A test payment is never recorded once the gateway is on Mainnet. Uninstalling the gateway stops all active automatic payments first.

Refunds

Blesta cannot send a P2Flux refund: a refund is a transfer from your own wallet. Use the P2Flux refund page (see Refunds); for automatic payments, send it to an address the client gives you.

Troubleshooting

SITUATIONWHAT TO DO
The gateway does not appear on an invoiceThe invoice is not in USD, or USD is not ticked under Accepted Currencies in the gateway settings.
Paid, but nothing recordedCheck that the callback address shown in the settings is reachable over https. The gateway log shows every confirmation.
“no webhook for this payment” in the logP2Flux could not watch that payment; it is recorded when the client’s browser returns.
Confirmed in the log, no transaction in BlestaBlesta refused it (for example a deleted client): add the transaction by hand with the hash from the log.
A renewal is missing after a long outageIf Blesta was unreachable for longer than about 18 hours and a newer period was collected meanwhile, the older one is listed in the P2Flux overview; record it by hand.

More

Gateway on GitHubReleases, source and tests.WebhooksThe confirmations the gateway receives.Payment linksWhat an automatic payment is underneath.
Something more than a standard integration?
Marketplace flows, platform billing and custom settlement logic.
Discuss an integration