BillingBalance billing.balance@1
Generated at from
openvibe-contracts v0.53.0 and
openvibe-sdk v0.11.0.
- Version
- 1.0.0
- Owner
- billing
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/billing/balance.v1.json
billing.balance@1: a person's Vibes balances, GET /api/v1/balances/:subject on OpenVibe.Billing (also returned after a recycle). credit is spendable (bought or given back), payable is what others gave the person (the only balance that can be cashed out), pending_payouts is held for requested cashouts.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
subject | identity.subject-ref | yes | ||
currency | const | yes |
| |
credit | integer | yes | ||
payable | integer | yes | ||
pending_payouts | integer | yes | ||
payable_value_cents | integer | yes | What payable is worth in US cents at today's rate. | |
bits_per_usd | number | yes |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: creator
{
"subject": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
},
"currency": "vibes-bits",
"credit": 1200,
"payable": 5500,
"pending_payouts": 0,
"payable_value_cents": 5500,
"bits_per_usd": 100
}Rejected: wrong-currency
{
"subject": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
},
"currency": "usd-cents",
"credit": 1,
"payable": 0,
"pending_payouts": 0,
"payable_value_cents": 0,
"bits_per_usd": 100
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('billing.balance@1', value); // { valid, errors: [{ path, message }] }