BillingCreditSandboxGrantRequest billing.credit-sandbox-grant-request@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
billing
Visibility
internal
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/billing/credit-sandbox-grant-request.v1.json

billing.credit-sandbox-grant-request@1: POST /internal/credits/sandbox/grants, synthetic credit for tests and staging. Billing answers only when BILLING_CREDITS_SANDBOX=1; the grant is a test transaction (D9). D10: the grant lands in the subject's sandbox credit account for the project (account kind usd_credit_sandbox, owner subject:project), and only a sandbox hold (billing.credit-hold-create-request@1 sandbox: true) draws on it; real Credits are never touched.

Fields

FieldTypeRequiredDescriptionConstraints
subjectidentity.subject-refyes
project_idstringyes
  • pattern ^prj_[0-9A-HJKMNP-TV-Z]{26}$
amount_nano_usdstringyesInteger nano-USD (1e-9 USD), stored as a string.
  • pattern ^[0-9]{1,19}$
reasonstring
  • maxLength 500

Examples

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

Valid: minimal
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "amount_nano_usd": "5000000000"
}
Valid: with-reason
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "amount_nano_usd": "5000000000",
  "reason": "staging smoke test"
}
Rejected: missing-project
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "amount_nano_usd": "5000000000"
}
Rejected: money-float
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "amount_nano_usd": "5.5"
}
Rejected: money-number
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "amount_nano_usd": 5000000000
}

Validate

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