Dujiao-Next Backend Setup
About 1030 words
About Dujiao-Next
Dujiao-Next is an open-source automatic card-key delivery and storefront system for digital goods. It supports automatic card-key delivery, manual delivery, a membership system and upstream supplier integration, making it a good fit for individuals or small teams that want to open a digital goods shop quickly.
Project repository
This page walks through the integration with xstock in the same order as the Dujiao-Next v1.6.1 admin panel. The screenshots come from a real admin panel; the entry paths depend on the version you deployed (admin URLs usually include a random path).
Prepare two things first
xstock's adapter URL and API Key / Secret. The adapter URL looks like https://api.xstock.example/api/v1/upstream; it is not the direct API path /dist/api/v1.
Step 1: Sign in to the admin panel
Sign in to the Dujiao-Next admin panel with an administrator account.

- Admin URL = your shop domain + the admin path generated at deployment, for example
https://shop.example.com/dj-mgmt-xxxxxx/; - If you have lost the admin path, check the
.envfile in the deployment directory or the container startup logs.
Step 2: Go to "Integration Management → Connection Management"
Expand Integration Management in the left menu and click Connection Management. This page lists all upstream connections together with their status and last ping time.

The screenshot shows a test environment: in production, set BASE URL to the xstock adapter URL (
/api/v1/upstream); do not copy the address shown in the image.
| Column | Meaning |
|---|---|
| Name / BASE URL | Connection identifier and upstream root URL |
| Protocol | Fixed as dujiao-next |
| Markup | Overall markup ratio for this connection |
| Status | Must be Active before the connection can be used for importing and ordering |
| Last PING | Time of the most recent connectivity check |
Step 3: Create a connection
Click New Connection at the top right and fill in the form below.

| Field | Value | Description |
|---|---|---|
| Name | e.g. xstock | Local identifier only; choose anything |
| Base URL | https://api.xstock.example/api/v1/upstream | Must be the adapter URL, with no trailing / |
| API Key | Your xstock API Key | Created under "API Credentials" in the portal |
| API Secret | Your xstock Secret | Shown only once; store it once pasted |
| Protocol | dujiao-next | Keep the default |
| Callback URL | Generated by the shop or entered manually | Must be a publicly reachable HTTPS URL |
| Max retries | 3 | Number of retries when an order fails |
| Retry interval (seconds) | 30,60,120 | Comma-separated |
| Exchange rate | 1 | Upstream price × rate = local base price; use 1 for the same currency |
| Markup percentage | 0 | 50 means +50%, 100 doubles the price |
| Price rounding | No rounding | Choose "Round up" and the like when you need integer prices |
| Update prices automatically on sync | No | When enabled, syncing products refreshes local prices using the markup rules |
| Markup by upstream category | Optional | Configure after saving the connection; child categories inherit the parent's setting when unset |
Click Create to save.
Three common mistakes
- Base URL set to
/dist/api/v1— the signature rules differ, so Ping keeps returning 401; - Extra spaces or newlines copied into the Secret — also 401;
- Callback URL pointing to an internal address or using an incomplete HTTPS certificate — orders succeed but delivery callbacks never arrive.
Step 4: Test connectivity
Back in the connection list, click Ping on that row:
- Success: the status becomes
Activeand "Last PING" shows the current time; - Failure: read the response on the right —
401usually means a key or URL problem, timeouts usually mean network or domain problems.
A successful Ping returns the site name, balance and currency, which confirms that the URL, key and signature chain all work.
Step 5: Import products from upstream
Go to "Integration Management → Product Mapping" and click Import from Upstream at the top right.

- Select the connection you just created;
- Browse by category and check the categories or products to import;
- If needed, check "Create local categories with the same name", or pick a "Local category";
- Click "Import selected".
After importing, the products appear in the product list, and product mappings plus SKU mappings are generated.
Step 6: Check mappings and prices
Return to the Product Mapping list and verify every mapping:

The products in the screenshot are test data; confirm the markup rules and sale prices before going live.
| Check | Expected |
|---|---|
| Connection | Shows the name of the connection you created |
| Upstream ID | Filled in, not empty |
| Local price | The sale price calculated from the markup rules |
| SKUs | Count matches upstream; 1 for single-SKU products |
| Status | Enabled |
To adjust a price individually, click "Edit"; to force a refresh, click "Sync". After you disable a product it is no longer restocked from upstream, but existing orders are unaffected.
Step 7: Ordering and procurement orders
Place a test order on the storefront, then open "Integration Management → Procurement Orders" to see the matching procurement record:

- The procurement order status should match the xstock order status;
- Open the details to see the upstream order number, amount and delivery result;
- Exceptional orders (insufficient balance, delisted product) show the failure reason here.
Step 8: Acceptance
Confirm each item in the table below and move production traffic over only after everything passes:
| Acceptance item | Pass criteria |
|---|---|
| Connectivity | Ping succeeds and the status is active |
| Product import | Categories, products, SKUs, images and prices are all correct |
| Availability | Sellable quantities shown on the storefront match xstock queries |
| Ordering | A storefront order succeeds and a procurement order is created |
| Delivery | The delivery callback arrives and card keys/accounts can be shown to the consumer |
| Order query | Status matches xstock after a manual sync |
| Cancellation | Cancelling an undelivered order releases the hold |
| After-sales | A submitted ticket is visible in the xstock portal |
Related
- Interface and signature details: Dujiao-Next API Reference
- Field-level mapping: Dujiao-Next integration
- Capability boundaries and limits: Support overview