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

{
  "reserved_draft_order_id": "123",
  "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",
  "prepaid": false,
  "external_order_id": "order-123",
  "delivery": {
    "delivery_type": "pickup",
    "delivery_price": 499
  },
  "transaction": {
    "transaction_id": "txn-123",
    "transaction_amount": 4299
  }
}
FieldTypeRequiredDescription
reserved_draft_order_idstringNoShopify legacy DraftOrder ID returned by the product reservation endpoint. When present, RxScale updates that draft order instead of creating a new checkout
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
prepaidbooleanNoWhether the order has already been paid externally. Defaults to false and is attached to Shopify order attributes as prepaid=true or prepaid=false. It does not change checkout_type behavior
external_order_idstringNoYour external order identifier. When present, RxScale attaches it to Shopify order attributes as external_order_id
deliveryobjectNoDelivery metadata to attach to the Shopify order attributes
delivery.delivery_typestringNoDelivery type. The store owner maps this value to their own shipping methods
delivery.delivery_priceintegerNoDelivery price to attach to the Shopify order attributes
transactionobjectNoTransaction metadata to attach to the Shopify order attributes
transaction.transaction_idstringNoTransaction identifier to attach to the Shopify order attributes
transaction.transaction_amountintegerNoTransaction amount to attach to the Shopify order attributes

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
If reserved_draft_order_id is present, checkout_type is ignored. RxScale stores the signed prescriptions and adds _prescription_uid metadata to the matching reserved draft-order line items. Matching is based on the Shopify variant resolved from sku_uid; duplicate sku_uid values are rejected because they are ambiguous. The reserved draft order must belong to the telemedicine provider linked to the API key.

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 '{
    "reserved_draft_order_id": "123",
    "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"
    },
    "prepaid": false,
    "external_order_id": "order-123",
    "delivery": {
      "delivery_type": "pickup",
      "delivery_price": 499
    },
    "transaction": {
      "transaction_id": "txn-123",
      "transaction_amount": 4299
    }
  }'

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. When reserved_draft_order_id is used, no new checkout or draft order is created. The existing reserved draft order is updated and can continue through the normal Shopify order and fulfillment process after payment.

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"
}