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.Unique identifier for the shop
create_prescription_checkout
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
reserved_draft_order_id | string | No | Shopify legacy DraftOrder ID returned by the product reservation endpoint. When present, RxScale updates that draft order instead of creating a new checkout |
prescriptions | array | No | List of prescription objects with id and pdf_base64 |
prescriptions[].id | string | Yes | Your internal ID for this prescription (used to link line items) |
prescriptions[].pdf_base64 | string | Yes | Base64-encoded PDF of the signed prescription |
lines | array | No | Line items for the checkout |
lines[].sku_uid | string | Yes | SKU UID from the product catalog |
lines[].quantity | integer | Yes | Quantity to order |
lines[].prescription_id | string | No | Links the line item to a prescription by its id |
patient_data | object | Yes | Patient demographic data |
patient_data.first_name | string | Yes | Patient first name |
patient_data.last_name | string | Yes | Patient last name |
patient_data.date_of_birth | integer | Yes | Date of birth as Unix timestamp |
patient_data.gender | string | Yes | Patient gender (male, female, divers) |
buyerIdentity | object | Conditional | Shopify cart buyer identity. Required when checkout_type is draft_order_without_checkout_request; used for checkout_link carts and draft-order checkout requests |
buyerIdentity.email | string | No | Buyer email address |
buyerIdentity.phone | string | No | Buyer phone number |
buyerIdentity.countryCode | string | No | Shopify country code for the buyer |
buyerIdentity.customerAccessToken | string | No | Shopify Storefront customer access token. When provided with checkout_type: "checkout_link", Shopify associates the cart with the customer’s account |
checkout_type | string | No | Checkout type: checkout_link, draft_order (default), or draft_order_without_checkout_request |
prepaid | boolean | No | Whether 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_id | string | No | Your external order identifier. When present, RxScale attaches it to Shopify order attributes as external_order_id |
delivery | object | No | Delivery metadata to attach to the Shopify order attributes |
delivery.delivery_type | string | No | Delivery type. The store owner maps this value to their own shipping methods |
delivery.delivery_price | integer | No | Delivery price to attach to the Shopify order attributes |
transaction | object | No | Transaction metadata to attach to the Shopify order attributes |
transaction.transaction_id | string | No | Transaction identifier to attach to the Shopify order attributes |
transaction.transaction_amount | integer | No | Transaction amount to attach to the Shopify order attributes |
billing_address | object | No | Billing address attached to the Shopify draft order. Ignored when checkout_type is checkout_link |
billing_address.first_name | string | No | Recipient first name |
billing_address.last_name | string | No | Recipient last name |
billing_address.address1 | string | No | Single-line street address including house number |
billing_address.city | string | No | City |
billing_address.province | string | No | State, province, or region. Populated for countries like IE; sent as an empty string for countries like DE |
billing_address.country_code | string | No | ISO country code |
billing_address.zip | string | No | Postal code |
shipping_address | object | No | Shipping address attached to the Shopify draft order. Ignored when checkout_type is checkout_link |
shipping_address.first_name | string | No | Recipient first name |
shipping_address.last_name | string | No | Recipient last name |
shipping_address.address1 | string | No | Single-line street address including house number |
shipping_address.city | string | No | City |
shipping_address.province | string | No | State, province, or region. Populated for countries like IE; sent as an empty string for countries like DE |
shipping_address.country_code | string | No | ISO country code |
shipping_address.zip | string | No | Postal code |
buyerIdentity.customerAccessToken only applies when checkout_type is checkout_link, because Shopify uses it on Storefront carts. It does not attach a customer account to Shopify draft orders.Send
buyerIdentity when using checkout_type: "draft_order_without_checkout_request". RxScale rejects the request without it because no Shopify checkout request is sent to collect customer details later.Checkout Types
Thecheckout_type field controls how the order is created in Shopify:
| Value | Description |
|---|---|
draft_order | Creates a Shopify draft order and sends a checkout request to the customer (default) |
checkout_link | Returns a Shopify checkout link for the customer to complete payment directly |
draft_order_without_checkout_request | Creates a Shopify draft order without sending a checkout request to the customer. Requires buyerIdentity because customer details are not collected through a Shopify checkout request |
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
Response
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).Unique identifier for the shop
create_treatment_checkout
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
lines | array | Yes | Line items for the checkout |
lines[].sku_uid | string | Yes | SKU UID from the product catalog |
lines[].quantity | integer | Yes | Quantity to order |
lines[].anamnesis_id | string | No | Anamnesis ID for linking to a patient questionnaire |
buyerIdentity | object | Conditional | Shopify cart buyer identity. Required when checkout_type is draft_order_without_checkout_request; used for checkout_link carts and draft-order checkout requests |
buyerIdentity.email | string | No | Buyer email address |
buyerIdentity.phone | string | No | Buyer phone number |
buyerIdentity.countryCode | string | No | Shopify country code for the buyer |
buyerIdentity.customerAccessToken | string | No | Shopify Storefront customer access token. When provided with checkout_type: "checkout_link", Shopify associates the cart with the customer’s account |
checkout_type | string | No | Checkout type: checkout_link, draft_order (default), or draft_order_without_checkout_request |
buyerIdentity.customerAccessToken only applies when checkout_type is checkout_link, because Shopify uses it on Storefront carts. It does not attach a customer account to Shopify draft orders.Send
buyerIdentity when using checkout_type: "draft_order_without_checkout_request". RxScale rejects the request without it because no Shopify checkout request is sent to collect customer details later.