Buy button
A buy button sells one plan at one price from your own website. A click opens the checkout as a window over your page. The buyer enters an email address, agrees to receive the license right away and pays on the page of your payment provider. The checkout then shows the license key, and the key also goes to the buyer by email. Below your own email text, that email carries a fixed order confirmation: you as the seller, the order, the price, the buyer's consent with its time, your withdrawal policy and your terms as text. The law needs this confirmation on a durable medium, so your own email templates cannot remove it. GET /v1/checkouts/{id} shows the consent and whether and when the confirmation was sent. You are the seller; the money goes to your connected payment account.
Pre-release. The checkout host below is a placeholder for the address of your Noctix web app.
Before you start
- Connect a payment account in the dashboard under Payment accounts, or with the Management API (
/v1/payment-accounts). - Create a buy button for a plan in the dashboard under Buy buttons, or with
POST /v1/buy-buttons: payment account, price and currency, the text on the button, and the allowed domains. The dashboard shows the code below ready to copy. Domains are hosts withouthttps://and path, such askestrel.example,*.kestrel.examplefor all subdomains, orlocalhost:5000for a test page. - Fill in your legal details in the dashboard under Legal details, or with
PATCH /v1/legal-details: legal name with legal form, postal address, email, phone, the addresses of your imprint, privacy notice and terms, the terms as text, your withdrawal policy in English or German (or both), and the tax note. Optionally, how many months from provision you provide updates (update_months), if your product needs that information. The checkout shows the seller and links these pages before every order. A live button can only be switched on once they are complete; the API answers422 legal_details_incompleteand names what is missing. Test buttons work without them. - Note the button ID (
bbt_...).
The browser loads the button and the checkout only on the allowed domains. On any other site the frame stays empty. With no allowed domains, only the direct link works.
Embed the button
Put this where the button should appear:
<script src="https://checkout.example/embed/buy.js" data-button="bbt_..." async></script>
| Attribute | Values | Default |
|---|---|---|
data-button |
The button ID | required |
data-locale |
en, de |
en |
data-size |
sm (28 px), lg (44 px), or leave it out (36 px) |
36 px |
The button brings its own font and shape and takes nothing from your page's styles. Its color is the accent color from your branding settings.
Rules for selling to consumers
The checkout is built for the EU rules on online orders (in Germany § 312j and § 356 BGB). Some of them depend on you:
- Name your button after the product, such as "Buy Kestrel CAD Pro". Do not label it "Buy now" or "Jetzt kaufen": those words belong to the order button in the checkout, and several order-like buttons in a row weaken the warning the law wants.
- Set the language with
data-locale(or/de/in the direct link) to the language of your page, so that the order button and the consent are in the buyer's language. - Prices are final prices. The amount of a buy button is what a consumer pays, including VAT. The payment provider must not add anything on its page.
- Your texts, your responsibility. Noctix shows your terms and withdrawal policy as you wrote them and provides no templates. Your withdrawal policy must match what the plan sells (see the next point).
- Say what each plan sells. Every plan has a service kind (
service_kind, in the plan form of the dashboard or withPOST/PATCH /v1/plans):digital_content: software the buyer downloads and unlocks with a key, including updates. The buyer agrees that you provide the license right away and loses the right of withdrawal once it is provided. Your withdrawal policy should say so.digital_service: an online service (SaaS, cloud features, anything you keep providing and adapting). The buyer asks you to start the service before the withdrawal period ends. The right of withdrawal lasts 14 days, and if the buyer withdraws, they pay for the time used. Your withdrawal policy should say so.- Without a value, subscriptions count as
digital_serviceand everything else asdigital_content. That is the safe side: treating content as a service gives the buyer more rights than needed, the other way round you lose your claim and your withdrawal policy is wrong. The license check by the server alone does not make software a service.
Offer coupons
Coupons give buyers a percentage or an amount off the price of a buy button. Create them in the dashboard under Coupons or with POST /v1/coupons (scope payments):
- Code: 3 to 40 letters, digits,
-and_, such asLAUNCH20. Buyers can type it in any case; it is unique per environment, also after archiving. - Discount:
percent_offfrom 1 to 99, oramount_offin minor units with acurrency. An amount coupon only applies to buy buttons in its currency and must stay below their price; nothing becomes free. - Limits: optional
starts_at,ends_at,max_redemptionsandplan_ids(empty for every plan).
The buyer opens Add a coupon in the checkout, enters the code and sees the price, the discount and the total right above the order button. The payment provider charges the total; for a subscription, every payment is discounted. A redemption counts while the checkout is open and not expired, and for good once it is paid, so max_redemptions never sells more than allowed. Each checkout names its coupon_id and discount.
Coupons cannot be deleted. Archive one with POST /v1/coupons/{id}/archive: buyers can no longer redeem it, and checkouts that use it can still be paid.
Sell more units of a quota
A quota is an entitlement with an integer value in the plan, such as "exports": 1000. Licenses that run low can buy more units through your payment account:
- Offer a pack with
POST /v1/usage-packs(scopepayments):plan_id,entitlement,units(1 to 10^9) and the price of one pack,amountwithcurrency. Changeunitsor the price withPATCH; archive a pack withPOST /v1/usage-packs/{id}/archiveto stop selling it. - When a customer wants more, open a checkout from your backend with
POST /v1/licenses/{id}/usage/checkout:pack_id,quantity(1 to 100),account_id,success_urlandcancel_url. Send the buyer to the checkout'surl. - Once the provider confirms the payment, the license gets the pack's units times
quantityon top of its quota (usage.granted), once per checkout. The checkout iscompletedwithout an order and names what it sold intop_up.
A refund gives the money back; the units granted stay with the license. Packs are not offered for revoked licenses or by resellers.
Let buyers cancel
Every environment has a public cancellation page: https://checkout.example/en/cancel?team=team_... (add &environment=test for test). The dashboard shows the address under Cancellations. Anyone can use it without signing in: it asks for the type of cancellation, the reason for an extraordinary one, name, purchase address, optionally the order number or license key, the date and the address for the confirmation, and ends with Cancel now. German law asks for this for continuing contracts sold online (§ 312k BGB), and courts count licenses for a fixed term too.
- Link it on your website under exactly the label "Cancel contracts here" (German "Verträge hier kündigen"), where buyers find it without signing in. The checkout, the customer portal, the confirmation email and every renewal email of an order from a buy button already link it.
- What happens: every declaration is accepted and the buyer gets a confirmation by email at once. An ordinary cancellation of a subscription for the earliest date that clearly matches one order (address plus order number or key, or the only subscription of that address) is carried out: the subscription ends with its paid term at your payment provider. Everything else waits for you, with the reason: no matching order, several orders, extraordinary, a wished date, no subscription, the provider did not answer, or the refund did not go through.
- Subscriptions longer than a month (for example yearly) run for their first term and then continue for an indefinite period, cancellable at any time with one month's notice. This follows § 309 Nr. 9 BGB, which forbids renewing a consumer contract by another full year. The checkout, the confirmation email and the renewal emails say so. A cancellation in a later term ends the contract one calendar month after it arrives (or with the paid term, if that comes first). The licenses end with the contract, and the buyer gets back the share of the last payment for the time after the end, through your payment provider; the confirmation names the date and the amount. If the refund fails, the declaration waits for you with the reason
refund_failedand the amount inrefund. Monthly subscriptions and cancellations in the first term end with the paid term as before. Your terms and conditions must state the same rule. - Handle open declarations in the dashboard or with
GET /v1/cancellations?status=open. End the contract yourself (for examplePOST /v1/orders/{id}/cancel), tell the buyer the end, then mark it handled withPOST /v1/cancellations/{id}/resolve. Thecancellation.receivedwebhook tells your server about each new declaration.
Let buyers withdraw
Every environment also has a public withdrawal page: https://checkout.example/en/withdraw?team=team_... (add &environment=test for test). The dashboard shows the address under Withdrawals. It asks for name, contract (order number or license key) and the address for the receipt, and ends with Confirm withdrawal. German law asks for this function wherever contracts are closed online (§ 356a BGB), even where the right of withdrawal ends once the license is provided.
- Name it in your withdrawal policy with its address (legal details in the dashboard), and link it on your website as "Withdraw from contract" (German "Vertrag widerrufen"). The checkout, the customer portal and the confirmation email already link it; from the email, the fields come filled in.
- What happens: every declaration is accepted. The buyer gets a receipt by email at once, which confirms that the declaration arrived, not that it is valid; the owners and admins of your team get a notice. Nothing is refunded by itself.
- Decide and refund in the dashboard or with
GET /v1/withdrawals?status=open. Each declaration shows the order its contract names, when it was placed and whether the buyer's consent to immediate provision and the confirmation email are on record. For a digital service it also shows the end of the 14-day period and the compensation: the price of the term times the days used until the declaration, divided by the term, and what is left to refund. Refund that rest withPOST /v1/payments/{id}/refundand{"amount": <rest>}, or with Refund the rest in the dashboard: the payment stays paid and the licenses stay, so end them yourself (for examplePOST /v1/orders/{id}/cancel). Each declaration names the payment (purchase.payment) with what of it went back so far (refunded_amount). If the right of withdrawal still existed, refund withPOST /v1/payments/{id}/refundwithout an amount, which refunds the rest of the payment and revokes the licenses, then mark the declaration handled withPOST /v1/withdrawals/{id}/resolve. Thewithdrawal.receivedwebhook tells your server about each new declaration.
Know when a purchase completes
document.addEventListener("noctix:checkout.completed", (event) => {
const { button, checkout } = event.detail;
// Show a thank-you message, or ask your backend about the order.
});
The event carries the button ID and the checkout ID only, never the license key or the buyer's address. Treat it as a hint for your page. For anything that matters, such as unlocking an account, use the order.paid webhook on your server (Webhooks v1).
Other ways to sell
Direct link:
https://checkout.example/en/buy/bbt_...opens the checkout as its own page, for emails or a link on any site. It works without allowed domains.Your own iframe: embed the checkout in your page instead of the overlay. Give it room for the whole window (at least 440 by 640 px). It posts
{ type: "noctix:checkout.completed", button, checkout }to your page; check thatevent.originis the checkout host.<iframe src="https://checkout.example/en/buy/bbt_..." title="Checkout" width="480" height="720"></iframe>
What the buyer sees
Email for the license, and the consent that you provide the license right away, before the withdrawal period ends. The consent names you as the seller. Without it the checkout does not start.
The order summary: product and plan, the number of devices and the term, for a subscription how it renews and how to cancel, the total with the period (for a yearly plan also the monthly amount), the tax note and the ways to pay.
Right below the summary, the order button: "Buy now" in English, "Zahlungspflichtig bestellen" in German, without the amount. Under it a note that the order is binding with the click and that payment follows on the provider's page, the note that statutory warranty rights apply and, if you gave one, the minimum period of updates. Payment providers do not run in frames, so from the button the payment page opens in a new window. The checkout window waits and shows the key as soon as the payment arrives.
With Stripe, where the platform runs Stripe's payment fields in the checkout, the order takes two steps and still has one button that costs money. Step 1 ends with "Continue to payment", which orders nothing. Step 2 shows Stripe's payment fields, the summary and right below it "Buy now", which places the order and pays in one click. The checkout names the ways to pay your Stripe account offers in its payment method settings: card, SEPA Direct Debit and PayPal. PayPal is left out for subscriptions and when the checkout runs in a frame on your page, because PayPal opens its own page.
The key with "Copy", two steps to activate it in your app, and a link to your license portal.