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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
subject | identity.subject-ref | yes | ||
project_id | string | yes |
| |
amount_nano_usd | string | yes | Integer nano-USD (1e-9 USD), stored as a string. |
|
reason | string |
|
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 }] }