VipCheckoutRequest vip.checkout-request@1
Generated at from
openvibe-contracts v0.53.0 and
openvibe-sdk v0.11.0.
- Version
- 1.0.0
- Owner
- vip
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/vip/checkout-request.v1.json
vip.checkout-request@1: the body of vip.membership.checkout on OpenVibe.VIP. POST /api/v1/checkout: { plan_id, provider, subject?, success_url?, cancel_url?, auto_renew? } starts joining a published plan: VIP records the plan version and hands off to OpenVibe.Billing (provider credit: a period paid from the member's credit at once; any other provider: a Billing payment intent and its checkout). A service names the member (subject); a person joins as themselves, and their return URLs must be pages of VIP's own site. Refusals are problem+json: 404 vip.plan_not_found (no published plan with that id); 409 vip.checkout.unavailable, vip.already_member, vip.checkout.insufficient_credit or vip.checkout.provider_unavailable; 422 vip.checkout.provider_unavailable (a provider VIP does not offer), vip.checkout.self, vip.invalid_subject or vip.invalid_input; 503 vip.billing_frozen or vip.billing_unavailable. Unknown fields are ignored.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
plan_id | string | yes |
| |
provider | string | yes | One of VIP_CHECKOUT_PROVIDERS (powerchat and credit by default); case-insensitive. | |
subject | one of | The member: required for services; a person may only name themselves. | ||
success_url | string | null | Where the provider sends the buyer after paying; default the member's VIP page. | ||
cancel_url | string | null | Where the provider sends the buyer after cancelling; default the creator's VIP page. | ||
auto_renew | boolean | integer | string | Default true. |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: credit
{
"plan_id": "vpl_01JAB2C3D4E5F6G7H8J9K0MNPW",
"provider": "credit"
}Valid: service
{
"plan_id": "vpl_01JAB2C3D4E5F6G7H8J9K0MNPW",
"provider": "powerchat",
"subject": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
},
"auto_renew": true
}Rejected: no-provider
{
"plan_id": "vpl_01JAB2C3D4E5F6G7H8J9K0MNPW"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('vip.checkout-request@1', value); // { valid, errors: [{ path, message }] }