Skip to main content

Prescriptions & Treatments

Create checkout sessions for prescriptions or treatments. These endpoints handle prescription validation, checkout creation, and return a checkout URL or draft order for the patient to complete their purchase.

Create Prescription Checkout

Upload one or more signed prescriptions (as base64 PDFs) along with line items and patient data to create a checkout.
POST /v2/public/prescriptions/{shop_identifier}
shop_identifier
string
required
Unique identifier for the shop
Required permission: create_prescription_checkout

Request Body

{
  "prescriptions": [
    {
      "id": "my-prescription-001",
      "pdf_base64": "JVBERi0xLjQK..."
    }
  ],
  "lines": [
    {
      "sku_uid": "sku-456",
      "quantity": 1,
      "prescription_id": "my-prescription-001"
    }
  ],
  "patient_data": {
    "first_name": "Max",
    "last_name": "Mustermann",
    "date_of_birth": 631152000,
    "gender": "male"
  },
  "checkout_type": "draft_order"
}
FieldTypeRequiredDescription
prescriptionsarrayNoList of prescription objects with id and pdf_base64
prescriptions[].idstringYesYour internal ID for this prescription (used to link line items)
prescriptions[].pdf_base64stringYesBase64-encoded PDF of the signed prescription
linesarrayNoLine items for the checkout
lines[].sku_uidstringYesSKU UID from the product catalog
lines[].quantityintegerYesQuantity to order
lines[].prescription_idstringNoLinks the line item to a prescription by its id
patient_dataobjectYesPatient demographic data
patient_data.first_namestringYesPatient first name
patient_data.last_namestringYesPatient last name
patient_data.date_of_birthintegerYesDate of birth as Unix timestamp
patient_data.genderstringYesPatient gender (male, female, divers)
checkout_typestringNoCheckout type: checkout_link, draft_order (default), or draft_order_without_checkout_request

Checkout Types

The checkout_type field controls how the order is created in Shopify:
ValueDescription
draft_orderCreates a Shopify draft order and sends a checkout request to the customer (default)
checkout_linkReturns a Shopify checkout link for the customer to complete payment directly
draft_order_without_checkout_requestCreates a Shopify draft order without sending a checkout request to the customer. Useful when you handle customer communication separately

Example Request

curl -X POST "https://api.rxscale.com/v2/public/prescriptions/my-shop" \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "prescriptions": [
      {
        "id": "rx-001",
        "pdf_base64": "JVBERi0xLjQK..."
      }
    ],
    "lines": [
      {
        "sku_uid": "sku-456",
        "quantity": 1,
        "prescription_id": "rx-001"
      }
    ],
    "patient_data": {
      "first_name": "Max",
      "last_name": "Mustermann",
      "date_of_birth": 631152000,
      "gender": "male"
    }
  }'

Response

{
  "status": "success",
  "prescriptions": [
    {
      "id": "rx-001",
      "prescription_uid": "px-abc123"
    }
  ]
}
The response maps your prescription IDs to the RxScale prescription UIDs. Use these UIDs to query order status via the Orders endpoint.

Error Responses

Status CodeDescription
400Validation error in the request body
404SKU not found in the specified shop
422Invalid PDF or unsigned prescription

QES Validation

Prescription PDFs are validated for qualified electronic signatures (QES). If a prescription does not contain a valid qualified electronic signature, the API returns a 422 error.
Prescriptions must be digitally signed with a qualified electronic signature (QES). Unsigned or invalidly signed prescriptions will be rejected with a 422 response. Some telemedicine providers may have this requirement relaxed based on their configuration — contact RxScale support if you need to discuss QES requirements for your integration.

Create Treatment Checkout

Create a checkout for treatment-based orders (no prescription required).
POST /v2/public/treatments/{shop_identifier}
shop_identifier
string
required
Unique identifier for the shop
Required permission: create_treatment_checkout

Request Body

{
  "lines": [
    {
      "sku_uid": "sku-789",
      "quantity": 1,
      "anamnesis_id": "anam-001"
    }
  ],
  "checkout_type": "draft_order"
}
FieldTypeRequiredDescription
linesarrayYesLine items for the checkout
lines[].sku_uidstringYesSKU UID from the product catalog
lines[].quantityintegerYesQuantity to order
lines[].anamnesis_idstringNoAnamnesis ID for linking to a patient questionnaire
checkout_typestringNoCheckout type: checkout_link, draft_order (default), or draft_order_without_checkout_request
See Checkout Types above for details on each option.

Example Request

curl -X POST "https://api.rxscale.com/v2/public/treatments/my-shop" \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "lines": [
      {
        "sku_uid": "sku-789",
        "quantity": 1
      }
    ]
  }'

Response

{
  "status": "success",
  "checkout_url": "https://shop.example.com/checkout/abc123"
}