BillingTransactionSettledPayload billing.transaction.settled@1
Generated at from
openvibe-contracts v0.33.0 and
openvibe-sdk v0.5.0.
- Version
- 1.0.0
- Owner
- billing
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Decision
- ADR-012
- Schema
https://openvibe.network/contracts/events/payloads/billing.transaction.settled.v1.json
billing.transaction.settled v1 (OpenVibe.Billing server/ops/purchases.js summary(); emitted by purchases, transfers, subscriptions, cashouts recycle and admin adjustments). A journal transaction was posted. Envelope: subject { type: transaction, id: txn_… }, visibility internal, priority important, actor service:billing.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
transaction_id | string | yes |
| |
type | enum | yes |
| |
test | boolean | yes | Test money: never counted. | |
from_subject | string | null | yes | Subject id (usr_…) value moved from, null for provider money. | |
to_subject | string | null | yes | Subject id (usr_…) value moved to. | |
provider | string | null | yes | stripe, paypal, powerchat…; null for credit movements. | |
metadata | object | yes | Transaction metadata as posted (amount_bits, paid_cents, value_cents, target EntityRef, intent_id, message, donor_name, rates…). Its keys depend on the transaction type. |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: donation
{
"transaction_id": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ1",
"type": "donation",
"test": false,
"from_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
"to_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"provider": null,
"metadata": {
"amount_bits": 500,
"target": {
"service": "tips",
"type": "interaction",
"id": "tint_01JAB3C4D5E6F7G8H9J0K1MNPQ"
},
"message": "gg"
}
}Valid: purchase
{
"transaction_id": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ1",
"type": "purchase",
"test": false,
"from_subject": null,
"to_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
"provider": "stripe",
"metadata": {
"paid_cents": 500,
"bits": 500,
"value_cents": 500,
"revenue_cents": 0,
"pricing": "bits",
"intent_id": "pi_01JAB3C4D5E6F7G8H9J0K1MNQ2",
"rates": {
"bits_per_usd": 100
}
}
}Rejected: subject-ref-instead-of-id
{
"transaction_id": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ1",
"type": "donation",
"test": false,
"from_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
"to_subject": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"provider": null,
"metadata": {
"amount_bits": 500,
"target": {
"service": "tips",
"type": "interaction",
"id": "tint_01JAB3C4D5E6F7G8H9J0K1MNPQ"
},
"message": "gg"
}
}Rejected: unknown-type
{
"transaction_id": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ1",
"type": "tip",
"test": false,
"from_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
"to_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"provider": null,
"metadata": {
"amount_bits": 500,
"target": {
"service": "tips",
"type": "interaction",
"id": "tint_01JAB3C4D5E6F7G8H9J0K1MNPQ"
},
"message": "gg"
}
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('billing.transaction.settled@1', value); // { valid, errors: [{ path, message }] }