Payments

Handle underpayment and overpayment

A charge only flips to paid — and only then fires the webhook — when an inbound transfer matches expected_amount exactly. If a buyer sends slightly less or more, no webhook ever fires and the charge stays pending until it expires. You detect the mismatch by reading the deposit address's on-chain transfers directly and resolve it yourself; there is no built-in underpaid/overpaid status or refund object.

Antes de começar
  • A charge you're waiting on, with its deposit_address
  • A live API key with a positive credit balance

1Poll the charge while it's pending

If the charge is still pending as it approaches expires_at, check whether anything landed at the deposit address at all.

> { "invoice": "in_8fK2", "status": "underpaid", "amount_usd": 41 }

2Read the deposit address's transfers

List the address's transfers to see what actually arrived. Compare the amount against expected_amount from the charge — a mismatch is why the watcher never marked it paid.

curl https://api.1st-node.com/v1/data/tron/address/T.../transfers \
  -H "Authorization: Bearer sk_live_..."
> { "transfers": [
>   { "hash": "0x...", "to": "T...", "amount_usd": 49, "confirmations": 41 }
> ] }

3Resolve an underpayment

Ask the buyer to send the remaining balance to the same deposit_address before expires_at. If the cumulative amount then matches expected_amount exactly, the watcher marks the charge paid on its next pass and the webhook fires.

4Resolve an overpayment

For an overpayment there is no refund API — this platform is non-custodial, so the excess sits at an address only your own xpub can spend from. Send the difference back yourself from your own wallet tooling, or route it through the custody API if you manage that address as a custody wallet (see Refund a crypto payment).

Perguntas frequentes

Does a mismatched charge ever settle on its own?

Only if the total received later matches expected_amount exactly and the charge hasn't expired yet — the watcher rechecks every pending charge on a fixed interval.

Is there a built-in underpaid or overpaid status?

No. A charge is only ever pending, paid or expired. Detecting a partial or excess payment means comparing the address's transfers against expected_amount yourself.

Continue lendo

Recarregue, pegue a chave e publique.

Autoatendimento. Pague em cripto ou cartão. Medido por créditos: primitivas pesadas custam mais, as simples são baratas.

Obter chave de API