BillingVibesChargeCreateRequest billing.vibes-charge-create-request@1
Generated at from
openvibe-contracts v0.419.0 and
openvibe-sdk v0.161.0.
- Version
- 1.0.0
- Owner
- billing
- Visibility
- public
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/billing/vibes-charge-create-request.v1.json
billing.vibes-charge-create-request@1: body of POST /api/v1/vibes/charges, sent from the app's server with its app token (capability billing.vibes.charge). amount is whole Vibes. reference is the app's idempotency key: a replay with the same reference and body returns the same charge. return_url is optional. The app token decides the project, the sandbox environment and the owner-set limits.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
amount | integer | yes | Price in whole Vibes, a positive integer; never a fraction or a nano-USD amount. |
|
description | string | yes | What the person is paying for. |
|
reference | string | yes | The app's own reference; it is the idempotency key. |
|
return_url | string | Where the browser returns after paying. Optional; the app may instead poll the charge or wait for the webhook. |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: no-return-url
{
"amount": 1,
"description": "One cheer",
"reference": "order_124"
}Valid: sticker-pack
{
"amount": 50,
"description": "Sticker pack: Neon cats",
"reference": "order_123",
"return_url": "https://myapp.example/thanks"
}Rejected: empty-description
{
"amount": 50,
"description": "",
"reference": "order_123"
}Rejected: float-amount
{
"amount": 0.5,
"description": "Sticker pack: Neon cats",
"reference": "order_123"
}Rejected: missing-reference
{
"amount": 50,
"description": "Sticker pack: Neon cats"
}Rejected: person-id
{
"amount": 50,
"description": "Sticker pack: Neon cats",
"reference": "order_123",
"user_id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}Rejected: return-url-not-uri
{
"amount": 50,
"description": "Sticker pack: Neon cats",
"reference": "order_123",
"return_url": "not a url"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('billing.vibes-charge-create-request@1', value); // { valid, errors: [{ path, message }] }