BillingTransferRequest billing.transfer-request@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/transfer-request.v1.json

billing.transfer-request@1: bodies of billing.transfer.create on OpenVibe.Billing. POST /api/v1/transfers: { from, to, amount, kind?, target?, message? } moves amount bits from the sender's credit to the recipient's payable (a tip, donation or paid interaction; never to oneself). POST /api/v1/transfers/:id/refund: { amount?, reason? } gives a credit-funded donation back (all that remains refundable when amount is absent). Every mutating call needs an Idempotency-Key header (a replay with the same key and body returns the first answer) and is refused with 503 billing.frozen while the economy is frozen. Refusals are problem+json (billing.invalid_input, billing.invalid_amount, billing.insufficient_funds, …).

Fields

This schema has no named fields.

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: refund
{
  "amount": 200,
  "reason": "sent twice"
}
Valid: tip
{
  "from": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "to": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "amount": 500,
  "kind": "tip",
  "target": {
    "service": "live",
    "type": "stream",
    "id": "812"
  },
  "message": "gg"
}
Rejected: guest-and-kind
{
  "from": "gst_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "to": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "amount": "0",
  "kind": "bribe"
}
Rejected: negative
{
  "from": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "to": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "amount": -5
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('billing.transfer-request@1', value);   // { valid, errors: [{ path, message }] }