Integration flow
The path from an empty panel to a subscription that renews by itself. Shop code is needed only in steps 3–8.
-
Panel. Enable payment and at least one delivery method; optionally a discount and a palette. Without payment and delivery the shop is «not ready»: the subscribe button is not shown and
open()rejects. -
Key and shop id. On the Integration tab generate an API key
nc_live_…(shown once) and copy the shop ID. The key stays on the server; the ID goes into thedata-shop-idattribute. -
Products (optional).
PUT /v1/shop/products/{external_id}when a product is saved — title, variant, image, link. Can be skipped: an order adds its products to the catalogue anyway. -
Subscribe button. Embed the script and place
<neocarts-button>under the «Buy» button. The shopper picks a frequency in the button’s window — the choice is kept by the widget. -
Cart → items. Before checkout pass the cart lines through
getOrderItems(lines)— you getitemswithmode,interval_value,interval_unit. -
Order. Your server calls
POST /v1/shop/orders/createwithitems,localeand an optionalredirect_url. The201response is the order document indraftstatus; returnorder.idto the page. Cart changed before payment —PUT /v1/shop/orders/{order}/items; on409create a new order. -
Checkout. The page calls
NeocartsSubscription.open({ orderId }). The shopper goes through contacts → delivery → review → payment in the Neocarts dialog. -
Result. The page receives
neocarts:paid{ number }: clear the cart.neocarts:order-missing— forget the stored id and create a new order. The server receives theorder.paidwebhook. -
Renewals. Neocarts sends a reminder 3 days ahead, charges the saved card, creates an order for each period and sends emails. On failure — up to 5 attempts, then a pause with reason
charge_failed. Every change arrives as a webhook. See Recurring billing.
What the shop implements
Section titled “What the shop implements”| Where | What |
|---|---|
| Site template | the script and <neocarts-button> under the «Buy» button |
| Cart (browser) | getOrderItems() → a request to your server → open({ orderId }); handlers for neocarts:paid and neocarts:order-missing |
| Server | POST /v1/shop/orders/create with the API key |
| Server | a webhook handler — for fulfilling orders and tracking subscriptions |