BillingIntentRequest billing.intent-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/intent-request.v1.json

billing.intent-request@1: the body of POST /api/v1/intents on OpenVibe.Billing (billing.intent.create): a checkout with an enabled provider for a Vibes purchase ({ kind: purchase, bits } at least the minimum purchase) or a channel subscription ({ kind: subscription, streamer }; route direct pays the streamer's own account, and a direct PowerChat subscription names receiving_account). Billing prices it; the answer is { intent, checkout_url } (201). GET /api/v1/intents/:id and POST /api/v1/intents/:id/capture take no body. 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: direct-subscription
{
  "provider": "powerchat",
  "kind": "subscription",
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "streamer": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "route": "direct",
  "receiving_account": "alice"
}
Valid: purchase
{
  "provider": "stripe",
  "kind": "purchase",
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "bits": 1000,
  "success_url": "https://openvibe.live/wallet?ok=1"
}
Rejected: unknown-kind
{
  "provider": "stripe",
  "kind": "gift",
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}

Validate

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