partner
POST /v1/partner/customers/{externalId}/hosting-orders
Place a hosting order for one of your customers, unpaid.
Аутентификација
Пошаљите API кључ као bearer токен. Кључ мора имати дозволу partner.domains; кључ без ње се одбија уз 403, а не 404.
Ова крајња тачка не прихвата id организације. Ваш кључ већ идентификује организацију којој припада, а одговор је ограничен на њу.
Испробајте
Замените све што је у угластим заградама сопственим вредностима, а чувар места кључа кључем са своје контролне табле.
curl -X POST https://api.zinndigital.com/v1/partner/customers/{externalId}/hosting-orders \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "term_months": <integer<1, 3, 6, 12>>, "currency": <string>, "return_url": <string>, "cancel_url": <string> }'Пријављени сте? API конзола на вашој контролној табли попуњава ваш прави id организације и ваш сопствени кључ, и покреће захтев према живом API-ју како бисте могли да видите стварни одговор. Отворите ову крајњу тачку у API конзоли
Детаљи
The hosting twin of createPartnerDomainOrder, with the same safety properties: the order is priced from our catalogue and placed pending_payment, nothing is charged and no payment method is touched, and the customer pays on the hosted page named by pay_url (a secret shown only in this response, alive 24 hours). return_url and cancel_url follow the same allowlist rules. Idempotency-Key is required — a retry returns the same order with a fresh pay_url. Plan and term. Name the plan by plan_code (or plan_version_id) from listInAppCatalogPlans. term_months is 1, 3, 6 or 12 on every plan, and what it costs is one rule: a published interval that covers the term wins (12 months on a plan with an annual price is that price), otherwise the term is N months of the monthly price, with no discount — the same arithmetic a prepayment on an existing subscription uses. A plan we hold no price for in currency is a 422 with details[0].code = term_not_priced; we never convert. Prices are per currency: the order is priced in currency, never in the first entry of a plan's prices array. A prepaid term (3, 6, or 12 where no annual price exists) is charged in full here and delivered as the subscription's first period plus a prepayment covering the rest, so the customer's RENEWAL price stays the monthly one. Every line carries its own term_months and currency so a partner can reconcile the charge against the quote it showed. Site. site names the site to create once the order is PAID: order fulfilment creates it in the customer's organization on the subscription this order buys, with the chosen application, and getPartnerHostingOrder then returns its id. The hostname, application, stack and region are all checked before anything is placed. site may be omitted entirely (sell the plan now, add the site later) and site.domain may be omitted — we mint a temporary address on our own preview domain, return it as site.domain with temporary_domain: true, and build the site on it, so a customer can start before their own domain points at us. Your key never gains sites.manage or billing.payment.manage in the customer's organization. Add-ons. addons carries codes from listCatalogAddons; each must be sold on the plan's product line and priced in currency. Refusals carry a stable details[0].code (plan_unknown, plan_not_hosting, plan_not_fulfillable, term_not_priced, term_unknown, app_required, app_unknown, region_unknown, region_unavailable, site_domain_taken, addon_unknown, addon_not_offered, addon_currency, return_url_not_allowed, not_linked). plan_not_fulfillable: the plan's deploy target has no usable provisioning connection right now, so a paid order could not be built — refused before any order exists. It clears itself when the plan can be provisioned again. Card-free trial (trial: true, hosting_orders.version 5). Starts the SAME card-free, never-billed trial a direct sign-up gets, on a plan whose hosting_orders.trial.plans[].trial_days is above 0 (open your trial choice on hosting_orders.trial.served). The order is priced at 0, settles at once with no payment step (the response carries no pay_url), and fulfilment starts the trial and builds the site, if one was named. The trial is never converted and never charged automatically: at trial.ends_at the customer is told it ended, at trial.cutoff_at the trial ends and its site is suspended, and nothing is ever billed. To keep the site, the customer subscribes — you place an ordinary paid order for trial.subscribe.plan_code with no site and send them its pay_url; once paid, the trial converts and its site is moved onto the paid plan (and resumed if it had been suspended). That works before ends_at, during the grace window and after cutoff_at. Eligibility is the direct rule — one trial per customer, ever — plus: no add-ons on a trial order, and no trial on a product line the customer already pays for. Refusals: trial_not_offered, trial_already_used, trial_already_subscribed, trial_addons, trial_limit (a per-partner daily ceiling on new trials; retry tomorrow), trial_domain_used (the site.domain — or its www/apex twin, in any case — has already had a trial on any account). A paid order may name the trial it converts in trial_id; see that field for trial_subscribe_other_line and trial_not_convertible. Several plans (hosting_orders.version 7, ADR 0036). A customer may hold ANY number of plan subscriptions, on any product line and several on the same one; a paid order ADDS a plan and never cancels or supersedes another. To change a plan instead, name the one it replaces in replaces_subscription_id (see that field); nothing else replaces anything. region_unknown / region_unavailable: region (top level or on site) is not a data centre we run, or is one with no box able to take this plan's site today. A region is never accepted and ignored; omit it for our default location, and read getPartnerCapabilities for the ones an order is accepted for. lines are in a fixed order: the plan line first, then the add-ons. Requires partner.domains.
Параметри
| Назив | Тип | Обавезно | Шта је ово |
|---|---|---|---|
externalId (path) | string | Да | YOUR id for that customer — whatever your own system calls them. It is what makes linking idempotent, and it is scoped to your partner programme: another partner's id is a 404… |
Idempotency-Key (header) | string | Не | Client-generated key that makes an unsafe request replay-safe: the server stores the first response and returns it verbatim for repeats. |
Тело захтева
| Назив | Тип | Обавезно | Шта је ово |
|---|---|---|---|
plan_code | string | Не | The plan's code from listInAppCatalogPlans. This or plan_version_id. |
plan_version_id | object | Не | The plan's current plan_version_id. This or plan_code. |
term_months | integer<1, 3, 6, 12> | Да | The term to sell, in months. A published interval that covers it is used as-is; otherwise it is N months of the monthly price, with no discount. Ignored on a trial order, which is… |
trial | boolean | Не | Start the plan's card-free trial instead of selling it: priced at 0, settled with no payment step, never converted or charged automatically. One per customer, ever; no addons.… |
trial_id | object | Не | On a PAID order (trial false): the trial this purchase converts — its trial.trial_id. Optional. When set, the plan must be one of that trial's subscribe.plan_codes (any tier… |
replaces_subscription_id | object | Не | On a PAID order (trial false): the customer's live plan subscription this order REPLACES — an upgrade or downgrade (hosting_orders.version 7, ADR 0036). Omitted, the plan is… |
currency | string | Да | — |
site | PartnerHostingSite | null | Не | — |
addons | object[] | Не | — |
billing_country | string | Не | Overrides the country on the customer's billing profile for this order. |
region | string | Не | Where the customer chose to be hosted. Refused (region_unknown / region_unavailable) unless we can place a site there today; omitted, our default location. A site without its… |
return_url | string | Да | As on a domain order. |
cancel_url | string | Да | As on a domain order. |
locale | string | Не | The language the payment page opens in. |
Одговор
| Назив | Тип | Обавезно | Шта је ово |
|---|---|---|---|
order_id | string | Да | — |
human_ref | string | Да | The reference the payment page returns to you as ?order=. |
pay_url | string | Не | Only in the response that placed (or replayed) the order: the hosted page the customer pays on. It carries a secret that is stored nowhere — treat it as one. Absent on a trial… |
pay_expires_at | string | Не | — |
org_id | string | Да | — |
trial | PartnerHostingTrial | null | Да | Present on an order placed with trial: true; null on every other order. Until fulfilment starts the trial, status is pending and the dates are null. |
replaces_subscription_id | object | Не | The live plan subscription this order replaces, as named on the request (ADR 0036); null when the order ADDS a plan. Once fulfilled that subscription is canceled and… |
status | string | Да | As on PartnerOrder. |
currency | string | Да | — |
term_months | integer | Да | — |
subtotal_minor | integer | Да | — |
tax_minor | integer | Да | — |
total_minor | integer | Да | — |
lines | PartnerHostingOrderLine[] | Да | — |
site | PartnerHostingOrderSite | null | Да | — |
subscription_id | object | Да | The subscription the paid plan line became; null until fulfilment. |
Грешке које ова крајња тачка може вратити
401 · 403 · 404 · 422 · 429