Skip to main content
POST
Create Plan

Endpoint Overview

POST https://api.unibee.dev/merchant/plan/new Create Plan

Authorization

All UniBee Merchant API requests require authentication via API key.

Parameters

Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.

Request body


Request examples

cURL

Sandbox


Response

Success responses return a JSON envelope with code, data, message, redirect, and requestId. code 0 indicates success.

Error handling

When code in the response body is non-zero, check message for details. Use requestId when contacting support.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
amount
integer<int64>
required

Plan Amount

currency
string<string>
required

Plan Currency

planName
string<string>
required

Plan Name

addonIds
integer<int64>[]

Plan Ids Of Recurring Addon Type

autoChargeConfig
object
autoUpgradePlanId
integer<int64>

Target plan id stored in additional settings when >0; independent of disableAutoCharge

cancelAtTrialEnd
integer<int>

whether cancel at subscription first trial end,0-false | 1-true, will pass to cancelAtPeriodEnd of subscription

checkoutTemplateId
integer<int64>

Checkout template id, used to build checkoutUrl; stored in plan additional settings

compareAtAmount
integer<int64>

optional strikethrough/compare-at price for regular plan amount (minor units, plan currency); UI only; stored in additional settings JSON with multiTrials; omit or 0 to leave unset

description
string<string>

Description

disableAutoCharge
integer<int>

Stored: 0=allow subscription auto-charge, 1=disable(single-cycle) — only applies to main recurring plans (type=1) with amount>0. For addon, onetime, or amount 0, you may still send 0/1; responses always return disableAutoCharge 1 and subscriptions never use auto-charge for those plans.

externalPlanId
string<string>

ExternalPlanId

gasPayer
string<string>

who pay the gas for crypto payment, merchant|user

homeUrl
string<string>

HomeUrl,Start With: http

imageUrl
string<string>

ImageUrl,Start With: http

internalName
string<string>
intervalCount
integer<int>

Number Of IntervalUnit,em: day|month|year|week

intervalUnit
string<string>

Plan Interval Unit,em: day|month|year|week

metadata
object

Metadata,Map

metricLimits
object[]

Plan's MetricLimit List

metricMeteredCharge
object[]

Plan's MetricMeteredCharge

metricRecurringCharge
object[]

Plan's MetricRecurringCharge

multiCurrencies
object[]

Plan's MultiCurrencies

multiTrials
object[]

multi-step trials for this plan; when set, the first item will override trialAmount & trialDurationTime

onetimeAddonIds
integer<int64>[]

Plan Ids Of Onetime Addon Type

productDescription
string<string>

Default Copy Description

productId
integer<int64>

Id of product which plan to linked

productName
string<string>

Default Copy PlanName

tagIds
integer<int64>[]

Plan tag ids to bind after create. Omit or [] = no tags. Binding is best-effort; retry with edit or batch_tag_bind if needed.

trialAmount
integer<int64>

price of trial period, not available for addon; overridden by multiTrials[0].trialPrice when multiTrials is set

trialDemand
string<string>

demand of trial, not available for addon, example, paymentMethod, payment method will ask for subscription trial start

trialDurationTime
integer<int64>

duration of trial (seconds), not available for addon; overridden by multiTrials[0].trialDuration when multiTrials is set

type
integer<int>
default:1

The type of plan, 1-main plan,2-addon plan, 3-onetime plan, default main plan

usVATConfig
object

Response

200 - application/json
code
integer<int>
data
object
merchantId
integer<int64>
message
string<string>
redirect
string<string>
requestId
string<string>