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

# Calculate the price for an order batch

You can calculate the total price for an order batch before you create it, given a cart, recipients, and send method. To use a specific address, pass the `direct_send` send method.


## OpenAPI

````yaml POST /v1/order_batches/price
openapi: 3.0.1
info:
  title: Goody API
  version: 1.0.0
  contact:
    name: Goody Support
    email: support@ongoody.com
servers:
  - url: https://api.ongoody.com
    description: Production
  - url: https://api.sandbox.ongoody.com
    description: Sandbox
security: []
paths:
  /v1/order_batches/price:
    post:
      tags:
        - Order Batches
      summary: Calculate the price for an order batch
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderBatchPriceInput'
            examples:
              Order batch price calculated:
                summary: Order batch price calculated
                value:
                  send_method: direct_send
                  recipients:
                    - first_name: Alena
                      last_name: Kenter
                      email: alena@example.com
                      mailing_address:
                        first_name: Alena
                        last_name: Kenter
                        address_1: 140 E 55th St
                        address_2: ''
                        city: New York
                        state: NY
                        postal_code: '10022'
                        country: US
                  cart:
                    items:
                      - product_id: 65c4e577-4226-4a2f-8298-aaffd3e34081
                        quantity: 1
      responses:
        '200':
          description: Order batch price calculated
          content:
            application/json:
              examples:
                Order batch price calculated:
                  value:
                    cart_price:
                      price_product: 1000
                      price_shipping: 1000
                      price_processing_fee: 100
                      price_pre_tax: 2100
                      price_est_tax_low: 0
                      price_est_tax_high: 210
                      price_est_total_low: 2100
                      price_est_total_high: 2310
                    total_price:
                      recipients: 2
                      est_group_total_low: 4200
                      est_group_total_high: 4620
                Order batch price calculated for direct send:
                  value:
                    cart_price:
                      price_product: 1000
                      price_shipping: 1000
                      price_processing_fee: 100
                      price_pre_tax: 2100
                      price_est_tax_low: 0
                      price_est_tax_high: 210
                      price_est_total_low: 2100
                      price_est_total_high: 2310
                    total_price:
                      recipients: 1
                      est_tax_calculated: 187
                      est_total_calculated: 2287
              schema:
                $ref: '#/components/schemas/OrderBatchPrice'
        '400':
          description: Invalid parameters
          content:
            application/json:
              examples:
                Order batch price calculation error:
                  value:
                    error: 'Product not found: invalid'
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearer: []
components:
  schemas:
    OrderBatchPriceInput:
      type: object
      description: Input parameters for an order batch price calculation.
      properties:
        recipients:
          type: array
          items:
            $ref: '#/components/schemas/RecipientInput'
        cart:
          $ref: '#/components/schemas/CartInput'
        send_method:
          $ref: '#/components/schemas/OrderBatchSendMethod'
      required:
        - recipients
        - cart
        - send_method
    OrderBatchPrice:
      type: object
      description: The price for an order batch (all in cents).
      properties:
        cart_price_estimate:
          $ref: '#/components/schemas/OrderBatchPriceCart'
        total_price_estimate:
          $ref: '#/components/schemas/OrderBatchPriceTotal'
      required:
        - cart_price
        - total_price
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    RecipientInput:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        email:
          type: string
        phone:
          type: string
          nullable: true
          description: >-
            Optional. Phone number for text notifications. E164 format (e.g.
            +15552347890), US only.
        mailing_address:
          $ref: '#/components/schemas/MailingAddress'
          description: >-
            Optional mailing address to pre-populate into the order. This field
            is only available for approved API partners.
      required:
        - first_name
    CartInput:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/CartItemInput'
          description: An array of cart items.
    OrderBatchSendMethod:
      type: string
      enum:
        - email_and_link
        - link_multiple_custom_list
        - direct_send
      description: >-
        The method for sending a order batch. `email_and_link` sends a gift
        email to the recipient (specify `email` for each recipient).
        `link_multiple_custom_list` generates a gift link without an automatic
        email. `direct_send` ships the product directly to the recipient
        (specify `mailing_address` for each recipient). For more information,
        see [Send Methods](/introduction/send-methods).
    OrderBatchPriceCart:
      type: object
      description: >-
        Prices for a single recipient's cart in cents. This represents the price
        for each recipient in the order batch.
      properties:
        price_product:
          type: integer
          description: Total cost of products
        price_shipping:
          type: integer
          description: Total shipping cost
        price_processing_fee:
          type: integer
          description: Processing fee
        price_pre_tax:
          type: integer
          description: Subtotal before tax
        price_est_tax_low:
          type: integer
          description: Estimated tax (low-end, typically 0%)
        price_est_tax_high:
          type: integer
          description: Estimated tax (high-end, typically 10%)
        price_est_total_low:
          type: integer
          description: Estimated total (low-end tax, typically 0%)
        price_est_total_high:
          type: integer
          description: Estimated total (high-end tax, typically 10%)
      required:
        - price_product
        - price_shipping
        - price_processing_fee
        - price_pre_tax
        - price_est_tax_low
        - price_est_tax_high
        - price_est_total_low
        - price_est_total_high
    OrderBatchPriceTotal:
      type: object
      description: >-
        Total price estimates for the entire order batch in cents. This includes
        all recipients.
      properties:
        recipients:
          type: integer
          description: Number of recipients in the batch
        est_tax_calculated:
          type: integer
          nullable: true
          description: 'Direct send: calculated tax estimate when addresses are provided'
        est_total_calculated:
          type: integer
          nullable: true
          description: Calculated total estimate when addresses are provided
        est_group_total_low:
          type: integer
          nullable: true
          description: Estimated minimum group total
        est_group_total_high:
          type: integer
          nullable: true
          description: Estimated maximum group total
      required:
        - recipients
    MailingAddress:
      type: object
      properties:
        first_name:
          type: string
          nullable: true
        last_name:
          type: string
          nullable: true
        address_1:
          type: string
        address_2:
          type: string
          nullable: true
        city:
          type: string
        state:
          type: string
        postal_code:
          type: string
        country:
          type: string
          nullable: true
          description: >-
            The two-letter country code, e.g. "US". Only US is supported at this
            time.
      required:
        - address_1
        - city
        - state
        - postal_code
        - country
    CartItemInput:
      type: object
      properties:
        product_id:
          type: string
          format: uuid
          nullable: true
          description: >-
            ID of the product. Preferred over URL since this is always stable.
            Either `product_id` or `product_url` must be provided.
        product_url:
          type: string
          nullable: true
          description: >-
            URL of the product. Either `product_id` or `product_url` must be
            provided.
        quantity:
          type: integer
        variable_price:
          type: integer
          description: >-
            If this product has a variable price (e.g. a flex gift or a gift
            card), then this must be provided. A positive integer represented in
            cents.
        variants:
          type: array
          items:
            type: string
          description: >-
            An array of variant names (not IDs). When using the Direct Send send
            method with a product with variants, the variants must be provided.
            The length of the array must be equal to `variants_num_selectable`
            on the product, and the variants must come from the names of the
            `varaints` on the product. For example, for a t-shirt with
            `variants_num_selectable` = 1 and variants S, M, L, pass ['M']. Or,
            for a box of cookies with `variants_num_selectable` = 2 and variants
            Sugar, Caramel, Chocolate, pass ['Sugar', 'Chocolate'].
      required:
        - product_id
        - quantity
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: Your Goody API key.

````