Pay out of a vault
const url = 'https://api.sotirea.com/v1/payments';const options = { method: 'POST', headers: { 'Idempotency-Key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"amount":"example","asset":"example","chain_id":"example","reference":"example","to":"example","vault_id":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sotirea.com/v1/payments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --data '{ "amount": "example", "asset": "example", "chain_id": "example", "reference": "example", "to": "example", "vault_id": 1 }'Asks for a payment and answers at once, 202, with the payment as it now stands; follow it with GET /v1/payments/{id}. Your organisation’s payment rules apply as they do to a person: a payment they refuse is answered 403 with the rule’s name in fields.rule, and one that needs approval is awaiting_approval until people in your organisation agree. Nobody who created this key, or gave it a new secret, can approve it. The network fee is paid from your gas pool, never from the amount.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Names this payment, 1 to 64 letters, digits, dots, dashes, underscores or colons, such as your own order id. The same key repeats the same payment; the same key with a different payment is refused 409.
Request Bodyrequired
Section titled “Request Bodyrequired”object
How much, in the asset’s smallest unit: 1.5 of an asset with 18 decimals is 1500000000000000000.
Native for the network’s own coin, the default, or a token’s contract address.
The network, needed only when the vault is open on more than one.
Your own id for the payment, such as an order or payout id: 1 to 128 characters with no spaces. It comes back on every answer and webhook about the payment, and GET /v1/payments?reference= finds it. Unlike the Idempotency-Key it need not be unique.
The address to pay.
The vault to pay out of.
Example generated
{ "amount": "example", "asset": "example", "chain_id": "example", "reference": "example", "to": "example", "vault_id": 1}Responses
Section titled “Responses”Done.
object
object
In the asset’s smallest unit.
How many people must agree before it is sent; 0 when it needs no approval.
The payment’s id: api:
The network or asset is not available right now: a payment waiting cannot be approved or sent until it is. One already sent is still followed to the end.
Payment, asked for by a person or a key; or sweep, sent by one of your sweep rules from a deposit vault into one of your own vaults.
True for the network’s coin and for tokens on Sotirea’s recognised list. Any other token’s symbol is whatever its contract calls itself, so do not trust it by name.
Requested, awaiting_approval, awaiting_gas, signed, sent, confirmed, failed or stuck. New statuses may be added: treat one you do not know as still in progress.
object
Quote it when asking about a request; it is in the X-Request-Id header too.
Example
{ "success": true}default
Section titled “default”Refused or failed, in words a person can act on.
object
object
object
object
Quote it when asking about a request.
Example
{ "success": false}