Start a payment
const url = 'https://beta-api.plune.ai/v1/billing/checkout';const options = { method: 'POST', headers: { cookie: 'plune_session=<plune_session>', 'Content-Type': 'application/json' }, body: '{"provider":"paddle","tier":"personal","period":"month"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://beta-api.plune.ai/v1/billing/checkout \ --header 'Content-Type: application/json' \ --cookie plune_session=<plune_session> \ --data '{ "provider": "paddle", "tier": "personal", "period": "month" }'Opens the provider’s page of payment (ADR 0081 §1) and answers its address; the card never reaches Plune. Personal is for the account of the session; Team is for a company named by companyId that the caller OWNS - a member is told 403 owner_only, a company the caller is not in (or one in the Bin) is the 404 of an id nobody has. Team is 3 to 50 seats (default 3), sent to Paddle as Team’s base price plus the extra-seat price for each seat above 3. monopay charges in hryvnias: the dollar price (3 seats in Team’s price, each more on top) at monobank’s selling rate, rounded up to the hryvnia; when that rate cannot be read the answer is 503 rate_unavailable. liqpay charges the same hryvnias by the same rate; its answer is Plune’s own page for the order, which posts the signed form to LiqPay. A subject that already has a payment subscription active or cancelling is told 409 already_subscribed. The same checkout (subject, provider, tier, period, seats) asked again while its page still lives answers that same page, so a buyer who went Back after paying cannot pay twice; asked while another click is still opening it, 409 checkout_pending. The provider sends the buyer back to the subject’s Plan & usage (/account/plan, a company’s /companies/{id}/settings/plan). While the chosen provider’s variables are unset on the server the route answers 503 provider_not_configured. The session alone: an API token gets 403 session_required. Ten calls a minute.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
Team only: a company the caller owns
Team: 3 to 50, default 3; Personal: 1 or absent
Examples
Personal for one’s own account, monthly
{ "provider": "paddle", "tier": "personal", "period": "month"}Team for a company one owns, yearly, 5 seats
{ "provider": "paddle", "tier": "team", "period": "year", "companyId": "6f1c2b3a-0000-4000-8000-0000000000a5", "seats": 5}Responses
Section titled “ Responses ”The provider’s page of payment; send the person there
object
Example generated
{ "url": "https://example.com"}Not JSON, or a body that does not hold: Team without a company, Personal with one, seats out of range
object
Example generated
{ "error": "example"}No / invalid session
An API token (session_required), or a member of the company who is not its owner (owner_only)
object
Example generated
{ "error": "example"}A company the caller is not in
object
Example generated
{ "error": "example"}The subject already has a payment subscription active or cancelling (already_subscribed), or the same checkout is being opened by another click (checkout_pending)
object
Example generated
{ "error": "example"}Rate-limited: the per-route throttle, or the per-minute request limit of the plan an API token counts by (#1442; the body names the plan, #2092). Retry-After carries the seconds until the window rolls over.
object
Example generated
{ "error": "example"}Headers
Section titled “Headers ”Seconds until the window rolls over
The provider refused to open a checkout (provider_error) - a key, store or variant that is not right
object
Example generated
{ "error": "example"}The provider’s variables are not set on this server (provider_not_configured), it could not be reached (provider_unreachable), or, for monopay, the exchange rate could not be read (rate_unavailable) - try again
object
Example generated
{ "error": "example"}