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

# Create order from product line items

> Creates a server-side Shoppex order from product or variant line items. Use `gateway` to preselect a valid active gateway for the resulting pending order.



## OpenAPI

````yaml /openapi.json post /dev/v1/orders
openapi: 3.0.3
info:
  title: Shoppex Developer API
  description: Mintlify-compatible Developer API reference for Shoppex.
  version: 1.0.0
  contact:
    name: Shoppex Support
    email: support@shoppex.io
    url: https://shoppex.io
servers:
  - url: https://api.shoppex.io
security:
  - bearerAuth: []
paths:
  /dev/v1/orders:
    post:
      tags:
        - Orders
      summary: Create order from product line items
      description: >-
        Creates a server-side Shoppex order from product or variant line items.
        Use `gateway` to preselect a valid active gateway for the resulting
        pending order.
      operationId: postDevV1Orders
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - items
              properties:
                email:
                  type: string
                customer_email:
                  type: string
                coupon_code:
                  type: string
                  nullable: true
                affiliate_code:
                  type: string
                  nullable: true
                affiliateCode:
                  type: string
                  nullable: true
                referral_code:
                  type: string
                  nullable: true
                referralCode:
                  type: string
                  nullable: true
                affiliate_id:
                  type: string
                  nullable: true
                affiliateId:
                  type: string
                  nullable: true
                gateway:
                  type: string
                  nullable: true
                title:
                  type: string
                  nullable: true
                custom_fields:
                  type: object
                  additionalProperties: true
                customFields:
                  type: object
                  additionalProperties: true
                items:
                  type: array
                  items:
                    type: object
                    properties:
                      product_id:
                        type: string
                      productId:
                        type: string
                      variant_id:
                        type: string
                        nullable: true
                      variantId:
                        type: string
                        nullable: true
                      delivery_instructions:
                        nullable: true
                        type: string
                        maxLength: 500
                      deliveryInstructions:
                        nullable: true
                        type: string
                        maxLength: 500
                      quantity:
                        type: number
                      qty:
                        type: number
              example:
                email: buyer@example.com
                coupon_code: SPRING10
                gateway: STRIPE
                title: Starter Pack checkout
                custom_fields:
                  source: affiliate
                  campaign: spring_launch
                items:
                  - product_id: prod_starter
                    variant_id: var_standard
                    quantity: 1
                    delivery_instructions: 'Discord: shoppex'
          multipart/form-data:
            schema:
              type: object
              required:
                - items
              properties:
                email:
                  type: string
                customer_email:
                  type: string
                coupon_code:
                  type: string
                  nullable: true
                affiliate_code:
                  type: string
                  nullable: true
                affiliateCode:
                  type: string
                  nullable: true
                referral_code:
                  type: string
                  nullable: true
                referralCode:
                  type: string
                  nullable: true
                affiliate_id:
                  type: string
                  nullable: true
                affiliateId:
                  type: string
                  nullable: true
                gateway:
                  type: string
                  nullable: true
                title:
                  type: string
                  nullable: true
                custom_fields:
                  type: object
                  additionalProperties: true
                customFields:
                  type: object
                  additionalProperties: true
                items:
                  type: array
                  items:
                    type: object
                    properties:
                      product_id:
                        type: string
                      productId:
                        type: string
                      variant_id:
                        type: string
                        nullable: true
                      variantId:
                        type: string
                        nullable: true
                      delivery_instructions:
                        nullable: true
                        type: string
                        maxLength: 500
                      deliveryInstructions:
                        nullable: true
                        type: string
                        maxLength: 500
                      quantity:
                        type: number
                      qty:
                        type: number
              example:
                email: buyer@example.com
                coupon_code: SPRING10
                gateway: STRIPE
                title: Starter Pack checkout
                custom_fields:
                  source: affiliate
                  campaign: spring_launch
                items:
                  - product_id: prod_starter
                    variant_id: var_standard
                    quantity: 1
                    delivery_instructions: 'Discord: shoppex'
          text/plain:
            schema:
              type: object
              required:
                - items
              properties:
                email:
                  type: string
                customer_email:
                  type: string
                coupon_code:
                  type: string
                  nullable: true
                affiliate_code:
                  type: string
                  nullable: true
                affiliateCode:
                  type: string
                  nullable: true
                referral_code:
                  type: string
                  nullable: true
                referralCode:
                  type: string
                  nullable: true
                affiliate_id:
                  type: string
                  nullable: true
                affiliateId:
                  type: string
                  nullable: true
                gateway:
                  type: string
                  nullable: true
                title:
                  type: string
                  nullable: true
                custom_fields:
                  type: object
                  additionalProperties: true
                customFields:
                  type: object
                  additionalProperties: true
                items:
                  type: array
                  items:
                    type: object
                    properties:
                      product_id:
                        type: string
                      productId:
                        type: string
                      variant_id:
                        type: string
                        nullable: true
                      variantId:
                        type: string
                        nullable: true
                      delivery_instructions:
                        nullable: true
                        type: string
                        maxLength: 500
                      deliveryInstructions:
                        nullable: true
                        type: string
                        maxLength: 500
                      quantity:
                        type: number
                      qty:
                        type: number
              example:
                email: buyer@example.com
                coupon_code: SPRING10
                gateway: STRIPE
                title: Starter Pack checkout
                custom_fields:
                  source: affiliate
                  campaign: spring_launch
                items:
                  - product_id: prod_starter
                    variant_id: var_standard
                    quantity: 1
                    delivery_instructions: 'Discord: shoppex'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - uniqid
                      - shop_id
                      - customer_id
                      - affiliate_link_id
                      - affiliate_customer_id
                      - affiliate_code
                      - affiliate_discount_amount
                      - customer_email
                      - currency
                      - status
                      - status_details
                      - payment_status
                      - gateway
                      - blockchain
                      - apm_method
                      - flow_type
                      - provider_reference
                      - provider_reference_type
                      - subtotal
                      - discount
                      - discount_display
                      - tax
                      - tax_percentage
                      - total
                      - total_display
                      - exchange_rate
                      - crypto_exchange_rate
                      - balance_paid_amount
                      - coupon_id
                      - subscription_id
                      - custom_fields
                      - is_developer_invoice
                      - developer_title
                      - checkout_url
                      - items
                      - created_at
                      - updated_at
                    properties:
                      id:
                        type: string
                      uniqid:
                        type: string
                      shop_id:
                        type: string
                      customer_id:
                        type: string
                        nullable: true
                      affiliate_link_id:
                        type: string
                        nullable: true
                      affiliate_customer_id:
                        type: string
                        nullable: true
                      affiliate_code:
                        type: string
                        nullable: true
                      affiliate_discount_amount:
                        type: number
                      customer_email:
                        type: string
                        nullable: true
                      currency:
                        type: string
                      status:
                        type: string
                      status_details:
                        type: string
                        nullable: true
                      payment_status:
                        type: string
                        nullable: true
                      gateway:
                        type: string
                        nullable: true
                      blockchain:
                        type: string
                        nullable: true
                      apm_method:
                        type: string
                        nullable: true
                      flow_type:
                        type: string
                        nullable: true
                      provider_reference:
                        type: string
                        nullable: true
                      provider_reference_type:
                        type: string
                        nullable: true
                      subtotal:
                        type: number
                      discount:
                        type: number
                      discount_display:
                        type: number
                      tax:
                        type: number
                      tax_percentage:
                        type: number
                      total:
                        type: number
                      total_display:
                        type: number
                      exchange_rate:
                        type: number
                      crypto_exchange_rate:
                        type: number
                      balance_paid_amount:
                        type: number
                      coupon_id:
                        type: string
                        nullable: true
                      subscription_id:
                        type: string
                        nullable: true
                      custom_fields:
                        nullable: true
                        type: object
                        additionalProperties: true
                      license_keys:
                        type: array
                        items:
                          type: object
                          additionalProperties: true
                      is_developer_invoice:
                        type: boolean
                      developer_title:
                        type: string
                        nullable: true
                      checkout_url:
                        type: string
                      items:
                        type: array
                        items:
                          type: object
                          required:
                            - product_id
                            - product_title
                            - product_type
                            - variant_title
                            - quantity
                            - unit_price
                            - total
                            - custom_fields
                            - delivery_instructions
                            - delivery_instructions_label
                          properties:
                            product_id:
                              type: string
                              nullable: true
                            product_title:
                              type: string
                            product_type:
                              type: string
                            variant_title:
                              type: string
                              nullable: true
                            quantity:
                              type: number
                            unit_price:
                              type: number
                            total:
                              type: number
                            custom_fields:
                              nullable: true
                              type: object
                              additionalProperties: true
                            delivery_instructions:
                              type: string
                              nullable: true
                            delivery_instructions_label:
                              type: string
                              nullable: true
                            license_keys:
                              type: array
                              items:
                                type: object
                                additionalProperties: true
                            delivered_items:
                              type: object
                              additionalProperties: true
                      created_at:
                        type: number
                      updated_at:
                        type: number
                example:
                  data:
                    id: ord_123
                    uniqid: 11111111-1111-4111-8111-111111111111
                    shop_id: shop_1
                    customer_id: cus_1
                    affiliate_link_id: link_1
                    affiliate_customer_id: cus_aff_1
                    affiliate_code: creator123
                    affiliate_discount_amount: 3
                    customer_email: buyer@example.com
                    currency: USD
                    status: PENDING
                    status_details: null
                    payment_status: PENDING
                    gateway: STRIPE
                    flow_type: CHECKOUT
                    provider_reference: null
                    provider_reference_type: null
                    subtotal: 29.99
                    discount: 3
                    discount_display: 3
                    tax: 0
                    tax_percentage: 0
                    total: 26.99
                    total_display: 26.99
                    balance_paid_amount: 0
                    coupon_id: coupon_spring10
                    subscription_id: null
                    custom_fields:
                      source: affiliate
                      campaign: spring_launch
                    is_developer_invoice: false
                    developer_title: null
                    checkout_url: >-
                      https://checkout.shoppex.io/invoice/11111111-1111-4111-8111-111111111111
                    items:
                      - product_id: prod_starter
                        product_title: Starter Pack
                        product_type: DIGITAL
                        variant_title: Standard
                        quantity: 1
                        unit_price: 29.99
                        total: 29.99
                        delivery_instructions: 'Discord: shoppex'
                        delivery_instructions_label: Discord username
                        delivered_items:
                          access_url: https://downloads.example.com/starter-pack
                    created_at: 1711510800
                    updated_at: 1711510860
            multipart/form-data:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - uniqid
                      - shop_id
                      - customer_id
                      - affiliate_link_id
                      - affiliate_customer_id
                      - affiliate_code
                      - affiliate_discount_amount
                      - customer_email
                      - currency
                      - status
                      - status_details
                      - payment_status
                      - gateway
                      - blockchain
                      - apm_method
                      - flow_type
                      - provider_reference
                      - provider_reference_type
                      - subtotal
                      - discount
                      - discount_display
                      - tax
                      - tax_percentage
                      - total
                      - total_display
                      - exchange_rate
                      - crypto_exchange_rate
                      - balance_paid_amount
                      - coupon_id
                      - subscription_id
                      - custom_fields
                      - is_developer_invoice
                      - developer_title
                      - checkout_url
                      - items
                      - created_at
                      - updated_at
                    properties:
                      id:
                        type: string
                      uniqid:
                        type: string
                      shop_id:
                        type: string
                      customer_id:
                        type: string
                        nullable: true
                      affiliate_link_id:
                        type: string
                        nullable: true
                      affiliate_customer_id:
                        type: string
                        nullable: true
                      affiliate_code:
                        type: string
                        nullable: true
                      affiliate_discount_amount:
                        type: number
                      customer_email:
                        type: string
                        nullable: true
                      currency:
                        type: string
                      status:
                        type: string
                      status_details:
                        type: string
                        nullable: true
                      payment_status:
                        type: string
                        nullable: true
                      gateway:
                        type: string
                        nullable: true
                      blockchain:
                        type: string
                        nullable: true
                      apm_method:
                        type: string
                        nullable: true
                      flow_type:
                        type: string
                        nullable: true
                      provider_reference:
                        type: string
                        nullable: true
                      provider_reference_type:
                        type: string
                        nullable: true
                      subtotal:
                        type: number
                      discount:
                        type: number
                      discount_display:
                        type: number
                      tax:
                        type: number
                      tax_percentage:
                        type: number
                      total:
                        type: number
                      total_display:
                        type: number
                      exchange_rate:
                        type: number
                      crypto_exchange_rate:
                        type: number
                      balance_paid_amount:
                        type: number
                      coupon_id:
                        type: string
                        nullable: true
                      subscription_id:
                        type: string
                        nullable: true
                      custom_fields:
                        nullable: true
                        type: object
                        additionalProperties: true
                      license_keys:
                        type: array
                        items:
                          type: object
                          additionalProperties: true
                      is_developer_invoice:
                        type: boolean
                      developer_title:
                        type: string
                        nullable: true
                      checkout_url:
                        type: string
                      items:
                        type: array
                        items:
                          type: object
                          required:
                            - product_id
                            - product_title
                            - product_type
                            - variant_title
                            - quantity
                            - unit_price
                            - total
                            - custom_fields
                            - delivery_instructions
                            - delivery_instructions_label
                          properties:
                            product_id:
                              type: string
                              nullable: true
                            product_title:
                              type: string
                            product_type:
                              type: string
                            variant_title:
                              type: string
                              nullable: true
                            quantity:
                              type: number
                            unit_price:
                              type: number
                            total:
                              type: number
                            custom_fields:
                              nullable: true
                              type: object
                              additionalProperties: true
                            delivery_instructions:
                              type: string
                              nullable: true
                            delivery_instructions_label:
                              type: string
                              nullable: true
                            license_keys:
                              type: array
                              items:
                                type: object
                                additionalProperties: true
                            delivered_items:
                              type: object
                              additionalProperties: true
                      created_at:
                        type: number
                      updated_at:
                        type: number
                example:
                  data:
                    id: ord_123
                    uniqid: 11111111-1111-4111-8111-111111111111
                    shop_id: shop_1
                    customer_id: cus_1
                    affiliate_link_id: link_1
                    affiliate_customer_id: cus_aff_1
                    affiliate_code: creator123
                    affiliate_discount_amount: 3
                    customer_email: buyer@example.com
                    currency: USD
                    status: PENDING
                    status_details: null
                    payment_status: PENDING
                    gateway: STRIPE
                    flow_type: CHECKOUT
                    provider_reference: null
                    provider_reference_type: null
                    subtotal: 29.99
                    discount: 3
                    discount_display: 3
                    tax: 0
                    tax_percentage: 0
                    total: 26.99
                    total_display: 26.99
                    balance_paid_amount: 0
                    coupon_id: coupon_spring10
                    subscription_id: null
                    custom_fields:
                      source: affiliate
                      campaign: spring_launch
                    is_developer_invoice: false
                    developer_title: null
                    checkout_url: >-
                      https://checkout.shoppex.io/invoice/11111111-1111-4111-8111-111111111111
                    items:
                      - product_id: prod_starter
                        product_title: Starter Pack
                        product_type: DIGITAL
                        variant_title: Standard
                        quantity: 1
                        unit_price: 29.99
                        total: 29.99
                        delivery_instructions: 'Discord: shoppex'
                        delivery_instructions_label: Discord username
                        delivered_items:
                          access_url: https://downloads.example.com/starter-pack
                    created_at: 1711510800
                    updated_at: 1711510860
            text/plain:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - uniqid
                      - shop_id
                      - customer_id
                      - affiliate_link_id
                      - affiliate_customer_id
                      - affiliate_code
                      - affiliate_discount_amount
                      - customer_email
                      - currency
                      - status
                      - status_details
                      - payment_status
                      - gateway
                      - blockchain
                      - apm_method
                      - flow_type
                      - provider_reference
                      - provider_reference_type
                      - subtotal
                      - discount
                      - discount_display
                      - tax
                      - tax_percentage
                      - total
                      - total_display
                      - exchange_rate
                      - crypto_exchange_rate
                      - balance_paid_amount
                      - coupon_id
                      - subscription_id
                      - custom_fields
                      - is_developer_invoice
                      - developer_title
                      - checkout_url
                      - items
                      - created_at
                      - updated_at
                    properties:
                      id:
                        type: string
                      uniqid:
                        type: string
                      shop_id:
                        type: string
                      customer_id:
                        type: string
                        nullable: true
                      affiliate_link_id:
                        type: string
                        nullable: true
                      affiliate_customer_id:
                        type: string
                        nullable: true
                      affiliate_code:
                        type: string
                        nullable: true
                      affiliate_discount_amount:
                        type: number
                      customer_email:
                        type: string
                        nullable: true
                      currency:
                        type: string
                      status:
                        type: string
                      status_details:
                        type: string
                        nullable: true
                      payment_status:
                        type: string
                        nullable: true
                      gateway:
                        type: string
                        nullable: true
                      blockchain:
                        type: string
                        nullable: true
                      apm_method:
                        type: string
                        nullable: true
                      flow_type:
                        type: string
                        nullable: true
                      provider_reference:
                        type: string
                        nullable: true
                      provider_reference_type:
                        type: string
                        nullable: true
                      subtotal:
                        type: number
                      discount:
                        type: number
                      discount_display:
                        type: number
                      tax:
                        type: number
                      tax_percentage:
                        type: number
                      total:
                        type: number
                      total_display:
                        type: number
                      exchange_rate:
                        type: number
                      crypto_exchange_rate:
                        type: number
                      balance_paid_amount:
                        type: number
                      coupon_id:
                        type: string
                        nullable: true
                      subscription_id:
                        type: string
                        nullable: true
                      custom_fields:
                        nullable: true
                        type: object
                        additionalProperties: true
                      license_keys:
                        type: array
                        items:
                          type: object
                          additionalProperties: true
                      is_developer_invoice:
                        type: boolean
                      developer_title:
                        type: string
                        nullable: true
                      checkout_url:
                        type: string
                      items:
                        type: array
                        items:
                          type: object
                          required:
                            - product_id
                            - product_title
                            - product_type
                            - variant_title
                            - quantity
                            - unit_price
                            - total
                            - custom_fields
                            - delivery_instructions
                            - delivery_instructions_label
                          properties:
                            product_id:
                              type: string
                              nullable: true
                            product_title:
                              type: string
                            product_type:
                              type: string
                            variant_title:
                              type: string
                              nullable: true
                            quantity:
                              type: number
                            unit_price:
                              type: number
                            total:
                              type: number
                            custom_fields:
                              nullable: true
                              type: object
                              additionalProperties: true
                            delivery_instructions:
                              type: string
                              nullable: true
                            delivery_instructions_label:
                              type: string
                              nullable: true
                            license_keys:
                              type: array
                              items:
                                type: object
                                additionalProperties: true
                            delivered_items:
                              type: object
                              additionalProperties: true
                      created_at:
                        type: number
                      updated_at:
                        type: number
                example:
                  data:
                    id: ord_123
                    uniqid: 11111111-1111-4111-8111-111111111111
                    shop_id: shop_1
                    customer_id: cus_1
                    affiliate_link_id: link_1
                    affiliate_customer_id: cus_aff_1
                    affiliate_code: creator123
                    affiliate_discount_amount: 3
                    customer_email: buyer@example.com
                    currency: USD
                    status: PENDING
                    status_details: null
                    payment_status: PENDING
                    gateway: STRIPE
                    flow_type: CHECKOUT
                    provider_reference: null
                    provider_reference_type: null
                    subtotal: 29.99
                    discount: 3
                    discount_display: 3
                    tax: 0
                    tax_percentage: 0
                    total: 26.99
                    total_display: 26.99
                    balance_paid_amount: 0
                    coupon_id: coupon_spring10
                    subscription_id: null
                    custom_fields:
                      source: affiliate
                      campaign: spring_launch
                    is_developer_invoice: false
                    developer_title: null
                    checkout_url: >-
                      https://checkout.shoppex.io/invoice/11111111-1111-4111-8111-111111111111
                    items:
                      - product_id: prod_starter
                        product_title: Starter Pack
                        product_type: DIGITAL
                        variant_title: Standard
                        quantity: 1
                        unit_price: 29.99
                        total: 29.99
                        delivery_instructions: 'Discord: shoppex'
                        delivery_instructions_label: Discord username
                        delivered_items:
                          access_url: https://downloads.example.com/starter-pack
                    created_at: 1711510800
                    updated_at: 1711510860
        '401':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
        '403':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
        '422':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
        '429':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
        '500':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
      deprecated: false
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Use your Shoppex API key in the Authorization header.

````