BillingTransactionReversedPayload billing.transaction.reversed@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.reversed.v1.json

billing.transaction.reversed v1 (OpenVibe.Billing server/ops/reversals.js reverseReceipt, transfers.js refund, cashouts.js deny). A transaction reversing an earlier one was posted: a provider refund or chargeback, a donation refund, a denied cash-out. Envelope: subject { type: transaction, id: txn_… (the reversing transaction) }, visibility internal, priority important, actor service:billing.

Fields

FieldTypeRequiredDescriptionConstraints
transaction_idstringyes
  • pattern ^txn_[0-9A-HJKMNP-TV-Z]{26}$
typeenumyes
  • one of "purchase", "donation", "subscription", "subscription_share", "cashout_request", "cashout_paid", "cashout_denied", "recycle", "refund", "chargeback", "adjustment", "import"
testbooleanyesTest money: never counted.
from_subjectstring | nullyesSubject id (usr_…) value moved from, null for provider money.
to_subjectstring | nullyesSubject id (usr_…) value moved to.
providerstring | nullyesstripe, paypal, powerchat…; null for credit movements.
metadataobjectyesTransaction metadata as posted (amount_bits, paid_cents, value_cents, target EntityRef, intent_id, message, donor_name, rates…). Its keys depend on the transaction type.
reverses_txnstringyesThe transaction this one reverses.
  • pattern ^txn_[0-9A-HJKMNP-TV-Z]{26}$
reviewenumProvider reversals only: required when Billing kept value it could not recover (staff review).
  • one of "required", null
entitlements_revokedintegerProvider reversals only: subscription periods revoked.
  • minimum 0

Examples

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

Valid: chargeback
{
  "transaction_id": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ3",
  "type": "chargeback",
  "test": false,
  "from_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "to_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "provider": "stripe",
  "metadata": {
    "cents": 500,
    "original_paid_cents": 500,
    "reason": "charge.dispute.created",
    "review": "required"
  },
  "reverses_txn": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ1",
  "review": "required",
  "entitlements_revoked": 0
}
Valid: donation-refund
{
  "transaction_id": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ3",
  "type": "refund",
  "test": false,
  "from_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "to_subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "provider": null,
  "metadata": {
    "amount_bits": 500,
    "target": {
      "service": "tips",
      "type": "interaction",
      "id": "tint_01JAB3C4D5E6F7G8H9J0K1MNPQ"
    },
    "message": "gg"
  },
  "reverses_txn": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ1"
}
Rejected: no-original
{
  "transaction_id": "txn_01JAB3C4D5E6F7G8H9J0K1MNQ1",
  "type": "refund",
  "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.reversed@1', value);   // { valid, errors: [{ path, message }] }