> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rxscale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# weed.de Integration

> Receive weed.de marketplace orders as Shopify draft orders in your shop

# weed.de Integration

weed.de is a cannabis marketplace. When your pharmacy sells on weed.de, weed.de sends every new order to a webhook URL that you register with weed.de. Register an RxScale URL there, and each weed.de order arrives in your shop the same way as an order from any other telemedicine provider:

1. weed.de sends an `order.created` webhook to RxScale.
2. RxScale validates the prescription PDF: it must carry a qualified electronic signature (QES), as for every other telemedicine provider.
3. RxScale creates a Shopify draft order in your shop with the products, prices, addresses and delivery method of the weed.de order.
4. A prepaid weed.de order is booked as paid. For an order that is not yet paid, Shopify sends the patient an invoice.
5. Shopify creates the order, and it arrives in RxScale like any other Shopify order.

weed.de calls the endpoint described on this page. You do not call it yourself: you set up the integration once in the RxScale Admin Tool and at weed.de.

## Before You Start

* Your organisation runs a Shopify shop in RxScale, and the products you want to sell on weed.de are in that shop.
* The shop sells in EUR. weed.de sends every amount in EUR, and RxScale sets weed.de's prices on the draft order in EUR.
* Your pharmacy has access to the weed.de Pharmacy API (in weed.de's API Management), where you register webhooks and manage your product data.

## Set Up the Integration

**1. Create a telemedicine provider for weed.de**

In the Admin Tool, open **Settings → Telemedicine providers** and choose **Add provider**. Enter a display name (for example `weed.de`) and an identifier (for example `weed`). Attach an API key that has the `create_prescription_checkout` permission, or create a new one with that permission.

weed.de never sends this API key, and you do not give it to weed.de. RxScale uses it to decide what the integration is allowed to do.

**2. Book prepaid orders as paid**

Open the new provider. Under **Prepaid orders**, choose **Change handling**, type the provider identifier to confirm, and choose **Book prepaid orders as paid**.

Patients usually pay on weed.de. With this setting, a prepaid weed.de order is booked as paid in Shopify, and the patient receives no payment request. See [Prepaid and Unpaid Orders](#prepaid).

**3. Map weed.de's delivery methods**

Open **Settings → Shipping Method Mappings** and choose **Create Mapping**. Select your shop and the weed.de provider. As **External Delivery Type**, enter the shipping provider exactly as weed.de names it (for example `DHL Standard`), and as **Shopify Shipping Method Title** the matching shipping method of your shop. Create one mapping for each shipping provider you offer on weed.de, and one for `pickup`. See [Delivery Method](#delivery).

**4. Link your weed.de products to your Shopify variants**

In your weed.de product data, set the `externalId` of every product to the ID of its Shopify product variant in your shop. That is the number at the end of the variant's address in the Shopify admin, for example `44012345678901`. The variant's GID, `gid://shopify/ProductVariant/44012345678901`, is accepted as well; any other GID, such as a product's, is not.

weed.de sells by the gram, so each of these variants must stand for **1 g**. See [Prices and Quantities](#prices).

**5. Register the webhook URL at weed.de**

Register this URL at weed.de for the event `order.created` only:

```
https://api.rxscale.com/v2/public-api/prescriptions/{shop_identifier}/weed/{telemedicine_provider_uid}
```

Replace `{shop_identifier}` with your shop's identifier and `{telemedicine_provider_uid}` with the UID of the provider you created in step 1. The UID is the last part of the provider page's address in the Admin Tool. The [Management API](https://docs.rxscale.com/api-reference/management/telemedicine-providers.md) also returns it as `uid`.

weed.de checks that the URL answers before it accepts it. RxScale answers that check successfully (see [URL Check](#url-check)), and weed.de then shows you a webhook secret.

**6. Enter the webhook secret**

In the Admin Tool, open the weed.de provider again. Under **Credentials**, enter the secret weed.de showed you as **Webhook secret** and save it. The webhook secret then shows as **Configured**.

Do this straight away: until the secret is stored, RxScale does not process weed.de orders. See [Before the Secret Is Stored](#not-configured).

**7. Send a test order**

Send a test order ("Testbestellung") from weed.de and check that it arrives in your shop. A test order is processed like a real one: it creates a draft order in your shop, and a prepaid test order is booked as paid. Cancel it in Shopify once you have checked it.

## Endpoint

```bash theme={null}
POST /v2/public-api/prescriptions/{shop_identifier}/weed/{telemedicine_provider_uid}
```

**shop\_identifier** `string` *required*

Unique identifier for the shop

**telemedicine\_provider\_uid** `string` *required*

UID of your weed.de telemedicine provider. The provider must belong to the organisation that owns the shop

**X-Signature** `string` *required*

The webhook secret weed.de issued when you registered the URL. weed.de sends it with every delivery

**Required permission** (on the API key attached to the provider): `create_prescription_checkout`

### Authentication

weed.de cannot send an RxScale API key. Instead, weed.de puts the webhook secret itself into the `X-Signature` header of every delivery. Despite its name, the header carries no signature computed over the request body. RxScale compares the value with the webhook secret stored for the provider. Spaces before or after the value are ignored. A delivery without the header, or with a different value, is refused with `401`. An RxScale API key sent in `X-API-Key` does not replace `X-Signature`.

When weed.de gives you a new secret, replace the stored one under **Credentials** — see [Changing the Webhook Secret](#rotate-secret). Until you do, deliveries are refused with `401`.

### Before the Secret Is Stored

weed.de only shows the secret after the URL has answered its check. So as long as no webhook secret is stored for the provider, RxScale answers every request to this URL with `200` and does nothing else:

```json theme={null}
{
  "status": "not_configured"
}
```

The shop and the provider are checked first. A URL with a shop identifier or provider UID that does not exist, or with a provider of another organisation, is refused with `404` even before a secret is stored, so weed.de's check fails.

> [!WARNING]
>
> While no webhook secret is stored, weed.de orders are acknowledged but not processed. weed.de counts them as delivered and does not send them again. Enter the secret right after registering the URL, before you take orders on weed.de, and do not remove it while you sell on weed.de.

### Changing the Webhook Secret

Removing the stored webhook secret puts the endpoint back into the [state without a secret](#not-configured): weed.de orders are answered with `200` and `{"status": "not_configured"}`, so orders delivered in that time are acknowledged but not created. To change the secret:

1. Register the webhook again, or rotate the secret, at weed.de.
2. Straight away, enter the new secret under **Credentials** in the Admin Tool and save it. Saving replaces the old secret; do not remove the old one first.
3. Check the new secret with the [URL check](#url-check), or send a test order from weed.de's sandbox.

Deliveries that weed.de sends with the new secret before you have saved it are refused with `401`. weed.de retries them, so they arrive once the new secret is saved, as long as that happens before weed.de's last retry (see [Responses and Retries](#responses)). Removing the secret instead would answer them with `not_configured`, and weed.de would not send them again.

### URL Check

```bash theme={null}
GET /v2/public-api/prescriptions/{shop_identifier}/weed/{telemedicine_provider_uid}
```

weed.de checks the URL before it accepts the registration. For that check the URL also answers `GET` and `HEAD`, with the same path parameters and the same `X-Signature` header. No request body is read, and nothing is stored or sent, so you can also use it yourself to test the stored secret without creating an order.

| Situation | Answer |
| - | - |
| No webhook secret is stored | `200` `{"status": "not_configured"}` |
| `X-Signature` matches the stored secret | `200` `{"status": "ok"}` |
| `X-Signature` is missing or does not match | `401` `invalid_api_key` |
| The shop or the provider does not exist, or the provider belongs to another organisation | `404` `not_found` |
| The API key attached to the provider lacks `create_prescription_checkout` | `403` `permission_denied` |
| The provider's setup in RxScale is incomplete | `500` `telemedicine_provider_misconfigured` |

`HEAD` answers with the same status and no body.

```bash theme={null}
curl -X GET "https://api.rxscale.com/v2/public-api/prescriptions/my-shop/weed/7d2c1e8a-4b6f-4f1e-9a3b-2c5d8e9f0a1b" \
  -H "X-Signature: your-weed-webhook-secret"
```

```json theme={null}
{
  "status": "ok"
}
```

### Events

RxScale processes `order.created` only. Every other event is answered with `200` and changes nothing. Its `data` is not checked:

```json theme={null}
{
  "status": "ignored"
}
```

## How a weed.de Order Is Mapped

weed.de sends each order as `{"event", "data", "timestamp"}`, where `data` is the order. RxScale uses these fields of `data`:

| weed.de field | Used for |
| - | - |
| `id` | The weed.de order number. It identifies the order for [duplicate detection](#duplicates), is returned as `prescriptions[].id`, and is attached to the Shopify order as the attributes `external_order_id` and `weed_order_id` |
| `prescriptionBase64` | The prescription PDF. It is validated (QES) and stored with the order |
| `products[].id` | weed.de's own product ID. It only names the product when a delivery is refused. At most 255 characters |
| `products[].externalId` | The product: the Shopify variant with this ID, or with its `gid://shopify/ProductVariant/…` GID, in the shop named in the URL. At most 255 characters. Any other GID names no product of the shop and is refused as unknown |
| `products[].quantity` | The line quantity. Must be a whole number from `1` to `1000` |
| `products[].unitPrice` | The line price in EUR per unit, when set. When `null`, the variant's Shopify price applies |
| `products[].totalPrice` | Checked against `unitPrice` × `quantity` when both are set |
| `customer.firstName`, `customer.lastName` | The patient's name, and the name on the billing and shipping addresses |
| `customer.email` | The contact email address of the draft order. For an unpaid order (`prepaid` `false`), Shopify sends the invoice to this address, so it is required: an unpaid order without an email address is refused. For a prepaid order, an empty value counts as no email address. A value that is not a valid email address is always refused |
| `customer.phone` | The contact phone number of the draft order. A number without a country code is read in the country of the shipping address, or of the billing address when there is no shipping address, and in Germany when neither is sent: with a German address, `0700000000` becomes `+49700000000`; with an Austrian one, `06641234567` becomes `+436641234567`. The number is also written, as sent, on the billing and shipping addresses |
| `customer.address` | The billing address |
| `deliveryDetails.address` | The shipping address. When it is missing, or all its fields are empty as in a pickup order, the billing address is used |
| `doctor.firstName`, `doctor.lastName`, `doctor.email`, `doctor.phone` | The prescribing doctor's details, when weed.de sends them |
| `deliveryDetails.shippingProvider`, else `deliveryDetails.deliveryForm` | The shipping method — see [Delivery Method](#delivery) |
| `priceBreakdown.deliveryPrice` | The shipping price, when weed.de sends it. Needs `deliveryDetails.shippingProvider` or `deliveryDetails.deliveryForm` — see [Prices and Quantities](#prices) |
| `prepaid` | Whether the order is booked as paid or Shopify sends the patient an invoice — see [Prepaid and Unpaid Orders](#prepaid) |
| `prepaid`, `deliveryDetails.deliveryForm`, `deliveryDetails.shippingProvider`, `deliveryDetails.externalDelivery`, `prescriptionVersion`, `isThirdPartyPrescription` | Attached to the Shopify order as attributes — see [Order Attributes](#attributes) |

Addresses are converted as follows:

* `street` and `houseNr` become one address line, for example `Hauptstraße 42`. When `street` already ends with the house number, it is not added a second time: `Main St 154` with `houseNr` `154` stays `Main St 154`.
* `state` becomes the state or province of the address.
* `country` is a country name such as `Germany`, and is converted to its country code. An address without a country, or with a country name that cannot be recognised, is refused.
* An address whose fields are all empty counts as no address.

Products are identified by `externalId` only. Other product fields, such as `pzn` or `name`, do not change the draft order: each line shows the variant from your shop. Fields not listed here are neither used nor checked, for example `customer.dateOfBirth`, `priceBreakdown.productsTotalPrice` and `priceBreakdown.totalPrice`. Fields that weed.de adds to its webhooks in the future are accepted and ignored.

### Order Attributes

Next to the attributes RxScale adds to the orders of every telemedicine provider, the Shopify order carries these attributes. An attribute whose weed.de field is missing or `null` is left out, and `true` / `false` are written as text.

| Attribute | Value |
| - | - |
| `external_order_id` | `id`, the weed.de order number |
| `weed_order_id` | `id`, the weed.de order number |
| `weed_prepaid` | `prepaid` |
| `weed_delivery_form` | `deliveryDetails.deliveryForm` |
| `weed_shipping_provider` | `deliveryDetails.shippingProvider` |
| `weed_external_delivery` | `deliveryDetails.externalDelivery` |
| `weed_prescription_version` | `prescriptionVersion` |
| `weed_is_third_party_prescription` | `isThirdPartyPrescription`. RxScale records it but does not act on it |

## Prices and Quantities

All amounts are in EUR, and the shop must sell in EUR. Quantities and amounts must be sent as JSON numbers. A value sent as text, such as `"10.50"`, is refused.

weed.de sells by the gram: `products[].unit` is `"g"`, and `quantity` is the number of grams. RxScale uses the quantity as the number of units of the Shopify variant, so each variant you list on weed.de must stand for 1 g. A quantity of `5` orders five units of the variant, that is 5 g.

* **Quantities** must be whole numbers from `1` to `1000`. `2.0` counts as `2`; a delivery with a quantity such as `2.5`, `0` or `1001` is refused.
* **Amounts:** `unitPrice`, `totalPrice` and `priceBreakdown.deliveryPrice` must be between `0` and `99999.99` EUR, with at most two decimal places. A negative amount, or one such as `10.555`, is refused.
* **Product prices:** when `unitPrice` is set, it is the line's price per unit in the draft order, in EUR, whatever the variant costs in Shopify. When `unitPrice` is `null`, the variant's Shopify price applies.
* **Totals:** when both `unitPrice` and `totalPrice` are set, `totalPrice` must equal `unitPrice` × `quantity` exactly. Otherwise the delivery is refused.
* **Shipping price:** `priceBreakdown.deliveryPrice` is used as the shipping price when weed.de sends it. weed.de sends `priceBreakdown` for prepaid orders only. Without it, the price of the mapped Shopify shipping method applies. A `deliveryPrice` needs `deliveryDetails.shippingProvider` or `deliveryDetails.deliveryForm`, so that the order is never booked without the delivery the patient paid for. A delivery that has neither is refused.

For example, a product with `unitPrice` `10.5` and `quantity` `2` becomes a line of two units at €10.50 each, €21.00 in total.

## Prepaid and Unpaid Orders

| `prepaid` | What happens |
| - | - |
| `true` | The patient has already paid on weed.de. RxScale creates the draft order without sending the patient a payment request, and books it as paid. No money is captured through your shop. |
| `false` | RxScale creates a draft order, and Shopify sends the patient an invoice by email. The order is created in Shopify, and arrives in RxScale, once the patient has paid. weed.de must send `customer.email`; without it the delivery is refused before anything is created. |

> [!WARNING]
>
> Booking prepaid orders as paid needs the **Book prepaid orders as paid** setting from [step 2](#setup). Without it, a prepaid weed.de order stays an unpaid draft order in Shopify, and the patient receives no payment request either. A booked order cannot be turned back into a draft.

If Shopify does not book a prepaid order as paid, the delivery is answered with `502`. The `code` says whether the order may have been booked anyway; see [Prepaid Orders](https://docs.rxscale.com/api-reference/public/prescriptions.md#prepaid-orders).

## Delivery Method

RxScale takes the delivery method from `deliveryDetails.shippingProvider` (for example `DHL Standard`). When weed.de sends no shipping provider, it takes `deliveryDetails.deliveryForm` instead (for example `pickup`). It looks this value up in the shipping method mappings of your weed.de provider. The value must match exactly, including upper and lower case and spaces.

The shipping line then follows the same rules as for every telemedicine provider, described under [Shipping Method Mapping](https://docs.rxscale.com/api-reference/public/prescriptions.md#shipping-method-mapping):

* With a mapping, the shipping line carries the name of the mapped Shopify shipping method. Its price is that method's price, unless weed.de sent a different `deliveryPrice`.
* Without a mapping, a shipping line named after the weed.de value is added when weed.de sent a `deliveryPrice`. Without a price, the draft order gets no shipping line.

## Example Delivery

You can send a delivery yourself to try your setup. The request below is shortened: weed.de sends more fields. Replace `prescriptionBase64` with the Base64-encoded content of a signed prescription PDF, and the `externalId` values with variant IDs of your shop.

> [!NOTE]
>
> A request you send yourself is processed like a real weed.de order. It creates a draft order in your shop, and with `"prepaid": true` that order is booked as paid.

```bash theme={null}
curl -X POST "https://api.rxscale.com/v2/public-api/prescriptions/my-shop/weed/7d2c1e8a-4b6f-4f1e-9a3b-2c5d8e9f0a1b" \
  -H "X-Signature: your-weed-webhook-secret" \
  -H "Content-Type: application/json" \
  -d '{
    "event": "order.created",
    "timestamp": "2026-11-07T09:30:00.000Z",
    "data": {
      "id": "0A789AG9",
      "products": [
        {
          "id": "weed-product-1001",
          "externalId": "44012345678901",
          "pzn": "12345678",
          "name": "Cannabis flower 22/1",
          "unitPrice": 10.5,
          "quantity": 2,
          "totalPrice": 21.0,
          "unit": "g"
        },
        {
          "id": "weed-product-1002",
          "externalId": "44012345678902",
          "pzn": "87654321",
          "name": "Cannabis flower 18/1",
          "unitPrice": 7.0,
          "quantity": 1,
          "totalPrice": 7.0,
          "unit": "g"
        }
      ],
      "customer": {
        "firstName": "Max",
        "lastName": "Mustermann",
        "email": "max.mustermann@example.com",
        "phone": "+4917612345678",
        "address": {
          "street": "Hauptstraße",
          "houseNr": "42",
          "zipCode": "10115",
          "city": "Berlin",
          "state": "Berlin",
          "country": "Germany"
        }
      },
      "doctor": null,
      "deliveryDetails": {
        "deliveryForm": "delivery",
        "shippingProvider": "DHL Standard",
        "externalDelivery": false,
        "address": {
          "street": "Nebenstraße",
          "houseNr": "7",
          "zipCode": "10115",
          "city": "Berlin",
          "state": "Berlin",
          "country": "Germany"
        }
      },
      "prepaid": true,
      "isThirdPartyPrescription": false,
      "priceBreakdown": {
        "productsTotalPrice": 28.0,
        "deliveryPrice": 4.99,
        "totalPrice": 32.99
      },
      "prescriptionVersion": 1,
      "prescriptionBase64": "JVBERi0xLjQK..."
    }
  }'
```

With the mapping `DHL Standard` from [step 3](#setup), this creates a draft order with two lines: two units at €10.50 and one unit at €7.00. It has a shipping line for the mapped method at €4.99, the billing address `Hauptstraße 42` and the shipping address `Nebenstraße 7`, and it is booked as paid.

### Response

```json theme={null}
{
  "status": "success",
  "prescriptions": [
    {
      "id": "0A789AG9",
      "prescription_uid": "px-abc123"
    }
  ]
}
```

`prescriptions[].id` is the weed.de order number (`data.id`). `prescription_uid` identifies the prescription in RxScale. You can use it to look up the order with the [Orders endpoint](https://docs.rxscale.com/api-reference/public/orders.md).

A successful response can also carry a `warnings` list. It is only present when there is something to report, so check for the key rather than for an empty list. Currently its only entry is `phone_not_forwarded` with `field` `data.customer.phone`: the order was accepted, but `customer.phone` was not set as the contact phone number of the order, because it could not be converted to E.164 or Shopify rejected it. See [Warnings](https://docs.rxscale.com/api-reference/public/prescriptions.md#warnings).

```json theme={null}
{
  "status": "success",
  "prescriptions": [
    {
      "id": "0A789AG9",
      "prescription_uid": "px-abc123"
    }
  ],
  "warnings": [
    {
      "code": "phone_not_forwarded",
      "field": "data.customer.phone",
      "message": "The phone number is not a valid E.164 number (e.g. +4917612345678) and was not set as the contact phone number of the order."
    }
  ]
}
```

## Responses and Retries

weed.de waits up to 30 seconds for an answer. Any answer other than `2xx`, and no answer at all, counts as a failed delivery. In production, weed.de retries a failed `order.created` delivery up to four times: after 5 minutes, 30 minutes, 1 hour and 2 hours.

| Status | `status` / `code` | Meaning |
| - | - | - |
| `200` | `status: success` | The order was accepted, and the draft order was created. The body may carry [`warnings`](#response) |
| `200` | `status: not_configured` | No webhook secret is stored. Nothing was processed — see [Before the Secret Is Stored](#not-configured) |
| `200` | `status: ignored` | An event other than `order.created`. Nothing was processed |
| `400` | `code: validation_error` | The order cannot be processed as sent: a quantity or amount sent as text instead of a number, a quantity that is not a whole number from `1` to `1000`, an amount outside `0` to `99999.99` or with more than two decimal places, a `totalPrice` that does not equal `unitPrice` × `quantity`, an address without a country or with one that cannot be recognised, an email address that is not valid, a missing `customer.email` on an unpaid order, a product `id` or `externalId` longer than 255 characters, or a `deliveryPrice` without a shipping provider or delivery form. All problems are reported at once, and every product at fault is named, not only the first |
| `400` | `code: invalid_json` | The request body is not valid JSON |
| `400` | — | The signature-validation service was unavailable, so the prescription could not be checked. weed.de's retry normally succeeds |
| `401` | `code: invalid_api_key` | `X-Signature` is missing or does not match the stored webhook secret |
| `403` | `code: permission_denied` | The API key attached to the provider lacks `create_prescription_checkout` |
| `404` | `code: not_found` | The shop or the provider in the URL does not exist, or the provider belongs to another organisation |
| `404` | `code: unknown_sku` | At least one `externalId` is not the ID, or the `gid://shopify/ProductVariant/…` GID, of a variant in this shop. `lines` names every such product, in the order weed.de sent them, and only those |
| `409` | `code: duplicate_prescription_injection` or `order_already_exists` | This weed.de order was already accepted — see [Duplicates](#duplicates) |
| `409` | `code: product_unavailable_in_shop`, `shop_not_shopify` or `shop_misconfigured` | The shop cannot take this order: a product is no longer orderable in it (`lines` names it by the `externalId` weed.de sent), it is not a Shopify shop, or its Shopify connection is incomplete. Needs a fix on the shop side |
| `422` | — | The prescription is not a valid PDF, or it does not carry a qualified electronic signature (QES) and your provider does not allow unsigned prescriptions |
| `500` | `code: telemedicine_provider_misconfigured` | The weed.de provider's setup in RxScale is incomplete: no API key is attached to it, or the attached key no longer exists, belongs to another organisation or is attached to another provider. Attach a valid key in the Admin Tool |
| `500` | `code: internal_error` | An unexpected error on RxScale's side, including a stored webhook secret that can no longer be read. The order was not at fault |
| `502` | `code: shopify_error` | Shopify refused the draft order, or answered with an error |
| `502` | `code: draft_order_complete_failed` or `draft_order_complete_uncertain` | A prepaid order could not be booked as paid — see [Prepaid Orders](https://docs.rxscale.com/api-reference/public/prescriptions.md#prepaid-orders) |

Every error body carries a `code`, except the `422` and the `400` for an unavailable signature-validation service. See [Public API Reason Codes](https://docs.rxscale.com/error-handling.md#public-api-reason-codes).

> [accordion] 401 — missing or wrong X-Signature
>
> ```json theme={null}
> {
>   "code": "invalid_api_key",
>   "description": "Invalid API key",
>   "error": "Invalid API key"
> }
> ```

> [accordion] 404 — unknown shop or provider
>
> ```json theme={null}
> {
>   "code": "not_found",
>   "error": "Resource not found"
> }
> ```

> [accordion] 400 — a quantity that is not a whole number
>
> `details` names each refused field by its path in the delivery. A message about a product names it by its weed.de `id` and its `externalId`; messages never repeat the value that was sent. All problems are reported together: here the quantity `2.5` of the second product, and the `totalPrice` that no longer matches it. Other fields are reported the same way, for example `data.customer.address.country` with `Unknown country.` or `Country is required.`, a value sent as text with `Not a valid number.`, an overlong `id` with `Longer than maximum length 255.`, an overlong `externalId` with `Length must be between 1 and 255.`, and a missing email on an unpaid order, `data.customer.email`, with `Required when prepaid is false: the patient is sent the invoice by email.`
>
> ```json theme={null}
> {
>   "code": "validation_error",
>   "error": {
>     "data": {
>       "products": {
>         "1": {
>           "quantity": ["Must be a whole number from 1 to 1000 (product id 'weed-product-1002', externalId '44012345678902')."],
>           "totalPrice": ["Must equal unitPrice x quantity (product id 'weed-product-1002', externalId '44012345678902')."]
>         }
>       }
>     }
>   },
>   "details": {
>     "data.products.1.quantity": ["Must be a whole number from 1 to 1000 (product id 'weed-product-1002', externalId '44012345678902')."],
>     "data.products.1.totalPrice": ["Must equal unitPrice x quantity (product id 'weed-product-1002', externalId '44012345678902')."]
>   }
> }
> ```

> [accordion] 404 — products that are not in the shop
>
> `lines` holds every product whose `externalId` is not a variant of the shop, with the `externalId` and `quantity` weed.de sent. Products that were found are not listed.
>
> ```json theme={null}
> {
>   "code": "unknown_sku",
>   "error": "SKU not found in this shop.",
>   "lines": [
>     {
>       "sku_uid": null,
>       "external_id": "44012345678901",
>       "quantity": 2
>     },
>     {
>       "sku_uid": null,
>       "external_id": "44012345678902",
>       "quantity": 1
>     }
>   ]
> }
> ```

> [accordion] 500 — provider setup incomplete
>
> ```json theme={null}
> {
>   "code": "telemedicine_provider_misconfigured",
>   "error": "This telemedicine provider's setup in RxScale is incomplete."
> }
> ```

A delivery refused with a `4xx` creates nothing: no prescription and no draft order. Once you have fixed the cause, for example a missing `externalId` or a wrong secret, the next retry from weed.de can succeed. After the last retry, weed.de does not send the order again.

### Duplicates

Each weed.de order is accepted once. A second delivery of an order that was already accepted is answered with `409` and creates nothing. The `code` is `duplicate_prescription_injection` or `order_already_exists`; treat both the same way:

```json theme={null}
{
  "code": "duplicate_prescription_injection",
  "error": "Duplicate prescription injection: prescription id(s) ['0A789AG9'] already submitted by provider weed (existing prescription(s) ['px-abc123']); no order created.",
  "duplicates": [
    {
      "id": "0A789AG9",
      "prescription_uid": "px-abc123",
      "order_uid": null
    }
  ]
}
```

`duplicates[].id` is the weed.de order number. `order_uid` stays `null` until Shopify has created the order and it has arrived in RxScale.

This usually happens when RxScale accepted an order but weed.de did not receive the answer in time. weed.de counts the `409` as a failed delivery and retries, at most four times. Each retry is answered with `409` again, and nothing needs to be done. The one exception is an order whose first delivery was answered with `502` and `draft_order_complete_uncertain`: contact RxScale so the order can be reconciled.

An order whose earlier delivery was refused is not blocked: its next delivery is processed normally.

## See Also

* [Prescriptions & Treatments](https://docs.rxscale.com/api-reference/public/prescriptions.md) — the generic checkout endpoint, shipping method mapping and prepaid orders
* [Orders](https://docs.rxscale.com/api-reference/public/orders.md) — query order status by prescription UID
* [Telemedicine Providers](https://docs.rxscale.com/api-reference/management/telemedicine-providers.md) — list your providers and their UIDs
* [Error Handling](https://docs.rxscale.com/error-handling.md) — error formats and Public API reason codes


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.