Gyvar docs

Sending money

The rules every endpoint that moves money follows - payouts, transfers and Lightning payments.

Three groups move value out of the wallet, one per kind of recipient:

Everything else on this API reads, or mints something to receive into. These three share the rules below.

Saved recipients

The API calls saved recipients beneficiaries. To pay the same person again, save them once with POST /v1/beneficiaries and pay by the beneficiary_id it returns. Saving an account that is already saved returns the saved one, so it is safe to retry. DELETE /v1/beneficiaries/{id} removes one. Both need the money capability. See Beneficiaries.

Payment reason

Send reason with any payout, transfer or Lightning payment to keep your own note on it, such as March salary or Invoice 104. It is optional, up to 255 characters on one line. It comes back on the payment and in Transactions. It is not sent to the recipient.

Two independent grants

The key must carry the money capability, granted per key; and the business must be enabled for money over the API, granted per business by us. Neither is sufficient alone - a key that leaks pays nobody unless the business was also opened, and opening a business arms no key that was not separately granted.

You will see capability_required for the first and api_money_not_enabled for the second, so you always know which to go and ask for. See Access.

Idempotency-Key is required

Required on every endpoint that moves money, and only there. Send a value unique to the payment you intend to make - a uuid, or your own payment id. Retry a request that timed out with the SAME key and you get the SAME order back (200, where a fresh call answers 202) instead of paying twice.

It is mandatory rather than encouraged because a retry is not a mistake here, it is what every HTTP client does by default when a request times out - and a payout that times out has already been created. Optional would mean the protection is on only for the integrator who already thought about it.

  • The key is remembered for 24 hours, scoped to your business.
  • Reusing one with a different body is refused (idempotency_key_reused) rather than answered, because either answer would be a lie.
  • A key whose first request is still running is refused too (idempotency_in_flight) - retry once it settles and it replays.
  • A request refused with a code (insufficient_funds, below_minimum and the rest) created no order and releases its key, so a corrected retry is free to reuse it.
  • A request that fails with a 500 may have created an order, so its key is held. A retry with it gets 409 idempotency_outcome_unknown. Check Transactions, and send again with a new key only if the payment is not there.

Accepted is not settled

A successful call answers 202 with the order. Nothing has landed yet: the wallet is debited and the payment is on its way. Follow it on Transactions or the webhooks, and report money delivered only when the order says so.

Paying from another wallet

A payout doesn't have to come out of your balance. Add funding to POST /v1/payouts and you get an address to send the money to instead. The payout goes out once it arrives.

{
  "beneficiary_id": "11111111-1111-1111-1111-111111111111",
  "asset": "USDT",
  "amount_minor": 25000000,
  "min_settlement_amount_minor": 38000,
  "funding": { "method": "deposit", "chain": "tron" }
}

The answer is the payout, with status: awaiting_funds. Send exactly amount of currency to funding.pay_to on funding.chain before funding.expires_at. On lightning, pay_to is an invoice.

  • Wrong network? Change it with POST /v1/payouts/{id}/network before any money arrives. You get a new pay_to. Money sent to the old one still pays this payout. funding.networks lists the chains you can change to.
  • Follow it with GET /v1/payouts/{id}: awaiting_funds, then processing, then pending, successful or failed like any payout. transaction links to it on Transactions.
  • Sent too little: once expires_at passes, what arrived is paid out at the current rate, if the recipient still gets at least min_settlement_amount_minor (0 means no floor). If not, it is released and the money is in your wallet. The same floor applies if the rate moves while your money is on its way.
  • Sent too much: the payout is sent and the extra goes to your wallet.
  • Nothing arrived in time: it is expired. Money that arrives after a payout has ended goes to your wallet.
  • Changed your mind: POST /v1/payouts/{id}/cancel before sending anything.

On this page