---
agentTools:
  projectIndex: https://cannaflow.readme.io/llms.txt
---

# Create a checkout session

Creates a checkout session of a prescription and optional service baskets. Returns a checkout URL where the patient can complete the purchase. Prescription products and basket items are paid as split payments to different payment accounts.

**Possible errors:**

`InsufficientStock` (409 CONFLICT): One or more prescribed products do not have sufficient stock at the designated pharmacy. Example response body:
```json
{
  "message": "Insufficient stock",
  "code": "CONFLICT",
  "id": "InsufficientStock",
  "payload": {
    "pharmacyId": "pha_123456",
    "products": [
      { "productId": "CF0001", "registryItemId": "RI0042" }
    ]
  }
}
```

# OpenAPI definition

````json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Cannaflow API",
    "description": "## Rate limits\n\nThe API limits the requests of each telemedicine provider. All API keys of a provider share the limits. Each limit is a token bucket that refills continuously. `RateLimit-Policy` and `RateLimit` describe the buckets of a request; the format follows draft-ietf-httpapi-ratelimit-headers-11.\n\nWhen a bucket is empty, the API answers HTTP 429 with the error id `RateLimited` and a `Retry-After` header. Wait at least `Retry-After` seconds, then retry with exponential backoff and jitter. Do not retry in a tight loop.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api-pharmacy.cannaflow.de/api/v1",
      "description": "production"
    },
    {
      "url": "https://api-pharmacy.sandbox.cannaflow.de/api/v1",
      "description": "sandbox"
    },
    {
      "url": "https://api-pharmacy.cannaflow-staging.de/api/v1",
      "description": "staging"
    }
  ],
  "externalDocs": {
    "url": "https://api-pharmacy.sandbox.cannaflow.de/document/v1"
  },
  "paths": {
    "/checkout": {
      "post": {
        "operationId": "checkout-create",
        "summary": "Create a checkout session",
        "description": "Creates a checkout session of a prescription and optional service baskets. Returns a checkout URL where the patient can complete the purchase. Prescription products and basket items are paid as split payments to different payment accounts.\n\n**Possible errors:**\n\n`InsufficientStock` (409 CONFLICT): One or more prescribed products do not have sufficient stock at the designated pharmacy. Example response body:\n```json\n{\n  \"message\": \"Insufficient stock\",\n  \"code\": \"CONFLICT\",\n  \"id\": \"InsufficientStock\",\n  \"payload\": {\n    \"pharmacyId\": \"pha_123456\",\n    \"products\": [\n      { \"productId\": \"CF0001\", \"registryItemId\": \"RI0042\" }\n    ]\n  }\n}\n```",
        "tags": [
          "Checkout"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "referenceId": {
                    "type": "string",
                    "description": "Unique reference ID from telemedicine provider"
                  },
                  "redirectUrls": {
                    "type": "object",
                    "properties": {
                      "back": {
                        "type": "string",
                        "format": "uri",
                        "description": "URL to redirect when user clicks back"
                      },
                      "success": {
                        "type": "string",
                        "format": "uri",
                        "description": "URL to redirect after successful checkout"
                      }
                    },
                    "required": [
                      "back",
                      "success"
                    ]
                  },
                  "notifications": {
                    "description": "Notification settings",
                    "type": "object",
                    "properties": {
                      "useSystemEmails": {
                        "default": true,
                        "description": "Whether to send system emails to patient",
                        "type": "boolean"
                      }
                    }
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "doctor": {
                        "description": "Doctor information. Can be provided later when submitting documents.",
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Doctor's full name"
                          },
                          "phone": {
                            "description": "Doctor's phone number",
                            "type": "string"
                          },
                          "email": {
                            "description": "Doctor's email address",
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          }
                        },
                        "required": [
                          "name"
                        ]
                      },
                      "patient": {
                        "type": "object",
                        "properties": {
                          "firstName": {
                            "type": "string",
                            "description": "Patient's first name"
                          },
                          "lastName": {
                            "type": "string",
                            "description": "Patient's last name"
                          },
                          "birthDate": {
                            "type": "string",
                            "description": "Patient birth date in YYYY-MM-DD format"
                          },
                          "email": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "Patient's email address"
                          },
                          "phone": {
                            "description": "Patient's phone number",
                            "type": "string"
                          },
                          "deliveryAddress": {
                            "type": "object",
                            "properties": {
                              "street": {
                                "type": "string",
                                "description": "Street name"
                              },
                              "houseNumber": {
                                "type": "string",
                                "description": "House or building number"
                              },
                              "addressLine2": {
                                "description": "Additional address line",
                                "type": "string"
                              },
                              "postalCode": {
                                "type": "string",
                                "description": "Postal/ZIP code"
                              },
                              "city": {
                                "type": "string",
                                "description": "City name"
                              },
                              "country": {
                                "description": "ISO 3166-1 alpha-2 country code",
                                "default": "DE",
                                "type": "string",
                                "minLength": 1
                              },
                              "latitude": {
                                "description": "Latitude",
                                "type": "number"
                              },
                              "longitude": {
                                "description": "Longitude",
                                "type": "number"
                              }
                            },
                            "required": [
                              "street",
                              "houseNumber",
                              "postalCode",
                              "city"
                            ],
                            "description": "Delivery address"
                          },
                          "billingAddress": {
                            "description": "Billing address if different from delivery address",
                            "type": "object",
                            "properties": {
                              "street": {
                                "type": "string",
                                "description": "Street name"
                              },
                              "houseNumber": {
                                "type": "string",
                                "description": "House or building number"
                              },
                              "addressLine2": {
                                "description": "Additional address line",
                                "type": "string"
                              },
                              "postalCode": {
                                "type": "string",
                                "description": "Postal/ZIP code"
                              },
                              "city": {
                                "type": "string",
                                "description": "City name"
                              },
                              "country": {
                                "description": "ISO 3166-1 alpha-2 country code",
                                "default": "DE",
                                "type": "string",
                                "minLength": 1
                              },
                              "latitude": {
                                "description": "Latitude",
                                "type": "number"
                              },
                              "longitude": {
                                "description": "Longitude",
                                "type": "number"
                              }
                            },
                            "required": [
                              "street",
                              "houseNumber",
                              "postalCode",
                              "city"
                            ]
                          }
                        },
                        "required": [
                          "firstName",
                          "lastName",
                          "birthDate",
                          "email",
                          "deliveryAddress"
                        ]
                      },
                      "prescriptionDate": {
                        "description": "Prescription date in YYYY-MM-DD format",
                        "type": "string"
                      },
                      "products": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "description": "Cannaflow registry item ID (e.g., CF0001)"
                            },
                            "quantity": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "description": "Quantity of the product"
                            },
                            "dosageInstructions": {
                              "description": "Optional dosage instructions for this prescription item. Text longer than 700 characters is truncated to the first 700 characters per item.",
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "quantity"
                          ]
                        },
                        "description": "Prescription products (RX cannabis products)"
                      }
                    },
                    "required": [
                      "patient",
                      "products"
                    ]
                  },
                  "pharmacy": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Cannaflow pharmacy ID"
                      },
                      "products": {
                        "description": "Non-prescription pharmacy products (goodies, packaging, etc.)",
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "description": "Cannaflow product ID"
                            },
                            "quantity": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "description": "Quantity of the product"
                            }
                          },
                          "required": [
                            "id",
                            "quantity"
                          ]
                        }
                      }
                    },
                    "required": [
                      "id"
                    ]
                  },
                  "baskets": {
                    "description": "Service item baskets paid to external payment accounts",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "accountId": {
                          "type": "string",
                          "description": "PaymentAccount ID that receives payment for these items"
                        },
                        "section": {
                          "type": "string",
                          "description": "Display section name (e.g., \"Behandlung\")"
                        },
                        "items": {
                          "minItems": 1,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "Item name/description"
                              },
                              "subTitle": {
                                "description": "Optional subtitle for display",
                                "type": "string"
                              },
                              "imageUrl": {
                                "description": "Optional image URL",
                                "type": "string",
                                "format": "uri"
                              },
                              "priceCent": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991,
                                "description": "Gross price per unit in cents, including tax."
                              },
                              "vat": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991,
                                "description": "VAT percentage (e.g. 19 for 19%)"
                              },
                              "originalPriceCent": {
                                "description": "Original price in cents before discount.",
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "discountReason": {
                                "description": "Reason for discount e.g. campaign name. Will be displayed to the patient.",
                                "type": "string"
                              },
                              "quantity": {
                                "default": 1,
                                "description": "Quantity of the item",
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "name",
                              "priceCent",
                              "vat"
                            ]
                          },
                          "description": "Basket items"
                        }
                      },
                      "required": [
                        "accountId",
                        "section",
                        "items"
                      ]
                    }
                  }
                },
                "required": [
                  "referenceId",
                  "redirectUrls",
                  "prescription",
                  "pharmacy"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "checkoutUrl": {
                      "type": "string",
                      "format": "uri",
                      "description": "URL to the checkout page"
                    },
                    "checkoutSessionId": {
                      "type": "string",
                      "description": "ID of the created checkout session"
                    }
                  },
                  "required": [
                    "checkoutUrl",
                    "checkoutSessionId"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "description": "The buckets of the request (draft-ietf-httpapi-ratelimit-headers-11): `q` is the capacity, `w` the seconds of a full refill.",
                "schema": {
                  "type": "string"
                },
                "example": "\"total\";q=2000;w=360, \"catalogue\";q=600;w=600"
              },
              "RateLimit": {
                "description": "The requests that remain in each bucket of the request (draft-ietf-httpapi-ratelimit-headers-11).",
                "schema": {
                  "type": "string"
                },
                "example": "\"total\";r=87, \"catalogue\";r=0"
              }
            }
          },
          "409": {
            "description": "InsufficientStock – one or more products are out of stock at the designated pharmacy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error.CONFLICT"
                }
              }
            }
          },
          "429": {
            "description": "A rate limit bucket is empty. Retry after `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the bucket holds one request again.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "RateLimit-Policy": {
                "description": "The buckets of the request (draft-ietf-httpapi-ratelimit-headers-11): `q` is the capacity, `w` the seconds of a full refill.",
                "schema": {
                  "type": "string"
                },
                "example": "\"total\";q=2000;w=360, \"catalogue\";q=600;w=600"
              },
              "RateLimit": {
                "description": "The requests that remain in each bucket of the request (draft-ietf-httpapi-ratelimit-headers-11).",
                "schema": {
                  "type": "string"
                },
                "example": "\"total\";r=87, \"catalogue\";r=0"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "message",
                    "payload"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "enum": [
                        "RateLimited"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "payload": {
                      "type": "object",
                      "required": [
                        "group",
                        "retryAfterSeconds"
                      ],
                      "properties": {
                        "group": {
                          "type": "string",
                          "description": "The empty bucket, as named in `RateLimit`."
                        },
                        "retryAfterSeconds": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "error.CONFLICT": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "The error message",
            "example": "PriceMismatch – one or more product prices differ from expectedPriceCent. Returned when expectedPriceCent is provided on all products and at least one does not match the pharmacy's current price. Example response body: { \"message\": \"Product prices have changed since checkout was initiated\", \"id\": \"PriceMismatch\", \"payload\": { \"pharmacyId\": \"pha_123456\", \"products\": [{ \"registryItemId\": \"CF0001\", \"expectedPriceCent\": 1200, \"actualPriceCent\": 1350, \"mismatch\": true }, { \"registryItemId\": \"CF0002\", \"expectedPriceCent\": 800, \"actualPriceCent\": 800, \"mismatch\": false }] } }"
          },
          "code": {
            "type": "string",
            "description": "The error code",
            "example": "CONFLICT"
          },
          "issues": {
            "description": "An array of issues that were responsible for the error",
            "example": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "message"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "message",
          "code"
        ],
        "additionalProperties": false,
        "title": "PriceMismatch – one or more product prices differ from expectedPriceCent. Returned when expectedPriceCent is provided on all products and at least one does not match the pharmacy's current price. Example response body: { \"message\": \"Product prices have changed since checkout was initiated\", \"id\": \"PriceMismatch\", \"payload\": { \"pharmacyId\": \"pha_123456\", \"products\": [{ \"registryItemId\": \"CF0001\", \"expectedPriceCent\": 1200, \"actualPriceCent\": 1350, \"mismatch\": true }, { \"registryItemId\": \"CF0002\", \"expectedPriceCent\": 800, \"actualPriceCent\": 800, \"mismatch\": false }] } } error (409)",
        "description": "The error information",
        "example": {
          "code": "CONFLICT",
          "message": "PriceMismatch – one or more product prices differ from expectedPriceCent. Returned when expectedPriceCent is provided on all products and at least one does not match the pharmacy's current price. Example response body: { \"message\": \"Product prices have changed since checkout was initiated\", \"id\": \"PriceMismatch\", \"payload\": { \"pharmacyId\": \"pha_123456\", \"products\": [{ \"registryItemId\": \"CF0001\", \"expectedPriceCent\": 1200, \"actualPriceCent\": 1350, \"mismatch\": true }, { \"registryItemId\": \"CF0002\", \"expectedPriceCent\": 800, \"actualPriceCent\": 800, \"mismatch\": false }] } }",
          "issues": []
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "description": "Access token for the API",
        "name": "x-cannaflow-api-key",
        "in": "header"
      }
    }
  },
  "webhooks": {
    "prescription.checkout_completed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription checkout completed event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_checkout_completed"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.payment_confirmed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription payment confirmed event. Sent when a payment is captured after checkout, e.g. a bank transfer confirmed by the pharmacy or a self-pickup order paid at the pharmacy (POS terminal or cash). Not sent for payments completed during checkout itself. Every order emits exactly one payment signal: prescription_checkout_completed if it was paid during checkout, or prescription_payment_confirmed if the payment was captured afterwards.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_payment_confirmed"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.authorized": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription authorized event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_authorized"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "invoiceId": {
                    "type": "string",
                    "description": "Invoice ID"
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "invoiceId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.packaged": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription packaged event. Opt-in replacement for `prescription.authorized`, enabled per telemedicine provider — you receive one or the other, never both.  `prescription.authorized` can only be sent when an invoice is created, so orders that are never invoiced at packaging (patient invoicing disabled, or payment collected later such as pay on delivery and pay at pickup) produce no event at all. This event is sent for every packaged order instead, with `invoiceId` null when no invoice exists yet.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_packaged"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "invoiceId": {
                    "type": "string",
                    "nullable": true,
                    "description": "Invoice ID, or null when the order has no invoice at packaging"
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "invoiceId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.courier_requested": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Courier requested event, enabled per telemedicine provider. Sent for externally shipped orders (shipping.isExternal: true) when the pharmacy calls the courier after packaging. Book the courier for requestedPickupAt; that is when the pharmacy expects the driver. Sent once per delivery attempt. If a delivery fails and you report the return with POST /prescriptions/{id}/external-shipping/return, the pharmacy can call the courier again, and you receive this event again with the next attempt number.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_courier_requested"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "requestedPickupAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "When the courier should pick up the package at the pharmacy (ISO 8601, UTC)"
                  },
                  "attempt": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Delivery attempt of the order: 1 for the first courier, 2 after the first return, and so on"
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "requestedPickupAt",
                  "attempt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.cancelled": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription cancelled event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_cancelled"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "description": "Cancellation reason"
                  },
                  "cancelledBy": {
                    "type": "string",
                    "enum": [
                      "telemedicineProvider",
                      "pharmacy"
                    ]
                  },
                  "refundedAmountCent": {
                    "type": "number",
                    "description": "Refunded amount in cents. If payment method supports it this amount was refunded to the patient."
                  },
                  "patientEmailSuppressed": {
                    "type": "boolean",
                    "description": "Only present when cancelledBy is \"pharmacy\". If you send your own patient emails (notifications.useSystemEmails is false): true when the pharmacy does not want you to email the patient about the cancellation, because the pharmacist turned the notification off or the pharmacy's system tells the patient itself. Otherwise (Cannaflow emails the patient): true when Cannaflow skips the cancellation email, for example because the pharmacist turned the notification off or the email was filtered. It can also be true when sending failed. false does not confirm that the email reached the patient."
                  },
                  "patientMessage": {
                    "type": "string",
                    "description": "The pharmacist's message to the patient. Only present when the pharmacist chose to notify the patient and wrote one."
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "reason",
                  "cancelledBy",
                  "refundedAmountCent"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.completed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription completed event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_completed"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.ready_for_pickup": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription ready for pickup event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_ready_for_pickup"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "readyForPickupAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Timestamp when the prescription became ready for pickup"
                  },
                  "pickupCode": {
                    "type": "string",
                    "nullable": true,
                    "description": "Code the patient enters at the pickup terminal (Abholautomat). Only present when the pickup location is a pickup terminal whose codes the pharmacy enters in cannaflow; absent when the terminal sends the code to the patient itself. Null when the pharmacy has not entered a code. When the pharmacy changes the code later, this event is sent again with the current code."
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "readyForPickupAt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.announced": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription announced event.The package was registered by the pharmacy to the fulfillment provider.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_announced"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "tracking": {
                    "type": "object",
                    "nullable": true,
                    "properties": {
                      "trackingNumber": {
                        "type": "string",
                        "nullable": true,
                        "description": "Tracking number"
                      },
                      "trackingUrl": {
                        "type": "string",
                        "nullable": true,
                        "description": "Tracking URL"
                      }
                    }
                  },
                  "shippingOption": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Option ID"
                      },
                      "type": {
                        "type": "string",
                        "description": "Option type"
                      }
                    },
                    "required": [
                      "id",
                      "type"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "shippingOption"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.checkout_payment_failed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "deprecated": true,
        "summary": "Payment failed (deprecated)",
        "description": "This webhook is no longer in use and should be ignored. Please contact our support team for assistance with payment failure handling.",
        "requestBody": {
          "description": "Payment failed event (deprecated)",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_checkout_payment_failed"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "nullable": true,
                        "description": "Prescription ID. Null for draft/TP-initiated checkouts."
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.shipped": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription shipped event",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_shipped"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "tracking": {
                    "type": "object",
                    "nullable": true,
                    "properties": {
                      "trackingNumber": {
                        "type": "string",
                        "nullable": true,
                        "description": "Tracking number"
                      },
                      "trackingUrl": {
                        "type": "string",
                        "nullable": true,
                        "description": "Tracking URL"
                      },
                      "currentLocationDriver": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                          "lat": {
                            "type": "number",
                            "nullable": true,
                            "description": "Driver lat"
                          },
                          "long": {
                            "type": "number",
                            "nullable": true,
                            "description": "Driver long"
                          }
                        }
                      }
                    }
                  },
                  "shippingOption": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Option ID"
                      },
                      "type": {
                        "type": "string",
                        "description": "Option type"
                      }
                    },
                    "required": [
                      "id",
                      "type"
                    ]
                  },
                  "estimatedDelivery": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "Estimated delivery"
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "shippingOption"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.billing_address_updated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription billing address updated event. Sent when the pharmacy updates the billing address on an order.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_billing_address_updated"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "previousBillingAddress": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "houseNumber": {
                        "type": "string"
                      },
                      "addressLine2": {
                        "type": "string",
                        "nullable": true
                      },
                      "postalCode": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "lat": {
                        "type": "number",
                        "nullable": true,
                        "description": "Latitude"
                      },
                      "long": {
                        "type": "number",
                        "nullable": true,
                        "description": "Longitude"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "street",
                      "houseNumber",
                      "addressLine2",
                      "postalCode",
                      "city",
                      "country",
                      "lat",
                      "long"
                    ]
                  },
                  "billingAddress": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "houseNumber": {
                        "type": "string"
                      },
                      "addressLine2": {
                        "type": "string",
                        "nullable": true
                      },
                      "postalCode": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "lat": {
                        "type": "number",
                        "nullable": true,
                        "description": "Latitude"
                      },
                      "long": {
                        "type": "number",
                        "nullable": true,
                        "description": "Longitude"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "street",
                      "houseNumber",
                      "addressLine2",
                      "postalCode",
                      "city",
                      "country",
                      "lat",
                      "long"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "previousBillingAddress",
                  "billingAddress"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "affiliation.activated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Affiliation activated event. Sent when a pharmacy switches a telemedicine provider on (the onboarding trigger). Carries a fixed snapshot of the pharmacy onboarding data so the provider can complete onboarding without a separate API round-trip. Opt-in per provider and only sent when a webhook URL is configured.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "affiliation_activated"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "affiliation": {
                    "type": "object",
                    "properties": {
                      "pharmacyId": {
                        "type": "string",
                        "description": "Cannaflow's canonical pharmacy ID. Always present."
                      },
                      "telemedicineProviderId": {
                        "type": "string",
                        "description": "Telemedicine provider ID."
                      },
                      "externalPharmacyId": {
                        "type": "string",
                        "nullable": true,
                        "description": "The TP's own pharmacy ID. On affiliation_activated this is typically null for TPs that assign it during onboarding — its absence is not an error."
                      }
                    },
                    "required": [
                      "pharmacyId",
                      "telemedicineProviderId",
                      "externalPharmacyId"
                    ]
                  },
                  "pharmacy": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "officialName": {
                        "type": "string"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "contactEmail": {
                        "type": "string"
                      },
                      "contactPhone": {
                        "type": "string",
                        "nullable": true
                      },
                      "website": {
                        "type": "string",
                        "nullable": true
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "street": {
                            "type": "string"
                          },
                          "houseNumber": {
                            "type": "string"
                          },
                          "postalCode": {
                            "type": "string"
                          },
                          "city": {
                            "type": "string"
                          },
                          "country": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "street",
                          "houseNumber",
                          "postalCode",
                          "city",
                          "country"
                        ],
                        "description": "Operating address (where the pharmacy is / ships from)."
                      },
                      "billing": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "ownerName": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "taxNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "vatNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "address": {
                            "type": "object",
                            "properties": {
                              "street": {
                                "type": "string"
                              },
                              "houseNumber": {
                                "type": "string"
                              },
                              "postalCode": {
                                "type": "string"
                              },
                              "city": {
                                "type": "string"
                              },
                              "country": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "street",
                              "houseNumber",
                              "postalCode",
                              "city",
                              "country"
                            ],
                            "description": "Billing address (where invoices go)."
                          }
                        },
                        "required": [
                          "name",
                          "ownerName",
                          "email",
                          "address"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "officialName",
                      "slug",
                      "contactEmail",
                      "address",
                      "billing"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "affiliation",
                  "pharmacy"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "affiliation.deactivated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Affiliation deactivated event. Sent when a pharmacy switches a telemedicine provider off. Carries only the affiliation identifier (no pharmacy data block). Opt-in per provider and only sent when a webhook URL is configured.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "affiliation_deactivated"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "affiliation": {
                    "type": "object",
                    "properties": {
                      "pharmacyId": {
                        "type": "string",
                        "description": "Cannaflow's canonical pharmacy ID. Always present."
                      },
                      "telemedicineProviderId": {
                        "type": "string",
                        "description": "Telemedicine provider ID."
                      },
                      "externalPharmacyId": {
                        "type": "string",
                        "nullable": true,
                        "description": "The TP's own pharmacy ID. On affiliation_activated this is typically null for TPs that assign it during onboarding — its absence is not an error."
                      }
                    },
                    "required": [
                      "pharmacyId",
                      "telemedicineProviderId",
                      "externalPharmacyId"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "affiliation"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    },
    "prescription.delivery_address_updated": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "description": "Prescription delivery address updated event. Sent when the pharmacy updates the delivery address on an order.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "prescription_delivery_address_updated"
                    ]
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp"
                  },
                  "prescription": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Prescription ID"
                      },
                      "referenceId": {
                        "type": "string",
                        "description": "Reference ID"
                      }
                    },
                    "required": [
                      "id",
                      "referenceId"
                    ]
                  },
                  "previousDeliveryAddress": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "houseNumber": {
                        "type": "string"
                      },
                      "addressLine2": {
                        "type": "string",
                        "nullable": true
                      },
                      "postalCode": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "lat": {
                        "type": "number",
                        "nullable": true,
                        "description": "Latitude"
                      },
                      "long": {
                        "type": "number",
                        "nullable": true,
                        "description": "Longitude"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "street",
                      "houseNumber",
                      "addressLine2",
                      "postalCode",
                      "city",
                      "country",
                      "lat",
                      "long"
                    ]
                  },
                  "deliveryAddress": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "houseNumber": {
                        "type": "string"
                      },
                      "addressLine2": {
                        "type": "string",
                        "nullable": true
                      },
                      "postalCode": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string"
                      },
                      "lat": {
                        "type": "number",
                        "nullable": true,
                        "description": "Latitude"
                      },
                      "long": {
                        "type": "number",
                        "nullable": true,
                        "description": "Longitude"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName",
                      "street",
                      "houseNumber",
                      "addressLine2",
                      "postalCode",
                      "city",
                      "country",
                      "lat",
                      "long"
                    ]
                  }
                },
                "required": [
                  "action",
                  "timestamp",
                  "prescription",
                  "previousDeliveryAddress",
                  "deliveryAddress"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event processed successfully"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 103,
      "1": 44,
      "2": 25,
      "3": 148,
      "4": 73,
      "5": 233,
      "6": 9,
      "7": 0,
      "8": 61,
      "9": 87,
      "10": 29,
      "11": 226
    }
  }
}
````