Skip to content

Start a payment

POST
/v1/billing/checkout
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.

Media type application/json
object
provider
required
string
Allowed values: paddle monopay liqpay
tier
required
string
Allowed values: personal team
period
required
string
Allowed values: month year
companyId

Team only: a company the caller owns

string
seats

Team: 3 to 50, default 3; Personal: 1 or absent

integer
>= 1 <= 50
Examples

Personal for one’s own account, monthly

{
"provider": "paddle",
"tier": "personal",
"period": "month"
}

The provider’s page of payment; send the person there

Media type application/json
object
url
required
string format: uri
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

Media type application/json
object
error
required
string
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)

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}

A company the caller is not in

Media type application/json
object
error
required
string
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)

Media type application/json
object
error
required
string
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.

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}
Retry-After
integer

Seconds until the window rolls over

The provider refused to open a checkout (provider_error) - a key, store or variant that is not right

Media type application/json
object
error
required
string
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

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}