---
title: "Compra de fretes"
method: POST
path: "/api/v2/me/shipment/checkout"
---

# Compra de fretes

`POST /api/v2/me/shipment/checkout`

## Request

- Base URL: `https://sandbox.melhorenvio.com.br`
- URL: `https://sandbox.melhorenvio.com.br/api/v2/me/shipment/checkout`
- Auth: none required
- TypeScript: <https://skmtc.dev/melhorenvio/apis/api-melhor-envio-sandbox/docs/api/v2/me/shipment/checkout/post.ts> (a function with typed inputs; its response is checked against the schema)

Pagamento de envios (Checkout)

## Headers

- `Accept` string, required
- `Content-Type` string, required
- `Authorization` string, required
- `User-Agent` string, required

## Request body

- object
  - `orders` string[], required: Pedidos
  - `gateway` string: yapay
  - `redirect` string: https://example.com/redirect

## Response `200`

200

- object
  - `purchase` object
    - `id` string
    - `protocol` string
    - `total` number
    - `discount` number
    - `status` string
    - `paid_at` string
    - `canceled_at` unknown
    - `created_at` string
    - `updated_at` string
    - `payment` unknown
    - `transactions` object[]
      - `id` string
      - `protocol` string
      - `value` number
      - `type` string
      - `status` string
      - `description` string
      - `authorized_at` string
      - `unauthorized_at` unknown
      - `reserved_at` unknown
      - `canceled_at` unknown
      - `created_at` string
      - `description_internal` unknown
      - `reason` object
        - `id` integer
        - `label` string
        - `description` string
    - `orders` object[]
      - `id` string
      - `protocol` string
      - `service_id` integer
      - `agency_id` integer
      - `contract` unknown
      - `service_code` unknown
      - `quote` number
      - `price` number
      - `coupon` unknown
      - `discount` number
      - `delivery_min` integer
      - `delivery_max` integer
      - `status` string
      - `reminder` unknown
      - `insurance_value` integer
      - `weight` unknown
      - `width` unknown
      - `height` unknown
      - `length` unknown
      - `diameter` unknown
      - `format` string
      - `billed_weight` number
      - `receipt` boolean
      - `own_hand` boolean
      - `collect` boolean
      - `collect_scheduled_at` unknown
      - `reverse` boolean
      - `non_commercial` boolean
      - `authorization_code` unknown
      - `tracking` unknown
      - `self_tracking` unknown
      - `delivery_receipt` unknown
      - `additional_info` unknown
      - `cte_key` unknown
      - `paid_at` string
      - `generated_at` unknown
      - `posted_at` unknown
      - `delivered_at` unknown
      - `canceled_at` unknown
      - `suspended_at` unknown
      - `expired_at` unknown
      - `created_at` string
      - `updated_at` string
      - `parse_pi_at` unknown
      - `from` object
        - `name` string
        - `phone` string
        - `email` string
        - `document` string
        - `company_document` string
        - `state_register` string
        - `postal_code` string
        - `address` string
        - `location_number` string
        - `complement` string
        - `district` string
        - `city` string
        - `state_abbr` string
        - `country_id` string
        - `latitude` unknown
        - `longitude` unknown
        - `note` string
      - `to` object
        - `name` string
        - `phone` string
        - `email` string
        - `document` string
        - `company_document` string
        - `state_register` string
        - `postal_code` string
        - `address` string
        - `location_number` string
        - `complement` string
        - `district` string
        - `city` string
        - `state_abbr` string
        - `country_id` string
        - `latitude` unknown
        - `longitude` unknown
        - `note` string
      - `service` object
        - `id` integer
        - `name` string
        - `status` string
        - `type` string
        - `range` string
        - `restrictions` string
        - `requirements` string
        - `optionals` string
        - `company` object
          - `id` integer
          - `name` string
          - `status` string
          - `picture` string
          - `use_own_contract` boolean
      - `agency` object
        - `id` integer
        - `company_id` integer
        - `name` string
        - `initials` string
        - `code` string
        - `status` string
        - `company_name` string
        - `email` string
        - `note` unknown
        - `created_at` string
        - `updated_at` string
        - `address` object
          - `id` integer
          - `label` string
          - `postal_code` string
          - `address` string
          - `number` unknown
          - `complement` unknown
          - `district` string
          - `latitude` number
          - `longitude` number
          - `confirmed_at` unknown
          - `created_at` string
          - `updated_at` string
          - `city` object
            - `id` integer
            - `city` string
            - `state` object
              - …
        - `phone` object
          - `id` integer
          - `label` string
          - `phone` string
          - `type` string
          - `country_id` string
          - `confirmed_at` unknown
          - `created_at` string
          - `updated_at` string
      - `invoice` object
        - `model` string
        - `number` string
        - `serie` string
        - `key` string
        - `value` unknown
        - `cfop` unknown
        - `issued_at` string
        - `uploaded_at` unknown
        - `to_document` unknown
      - `tags` object[]
      - `products` object[]
        - `name` string
        - `quantity` integer
        - `unitary_value` integer
        - `weight` unknown
      - `generated_key` unknown
    - `paypal_discounts` object[]
  - `digitable` unknown
  - `redirect` unknown
  - `message` unknown
  - `token` unknown
  - `payment_id` unknown

## Other responses

- `422`: 422

## Changes

- **2026-11-03** `ffbe3939fc36`: 2 info
  - added the new optional request property `gateway`
  - added the new optional request property `redirect`

[Operation history](https://skmtc.dev/melhorenvio/apis/api-melhor-envio-sandbox/changes/api/v2/me/shipment/checkout/post.md)

---

[API](https://skmtc.dev/melhorenvio/apis/api-melhor-envio-sandbox.md) - [All operations](https://skmtc.dev/melhorenvio/apis/api-melhor-envio-sandbox/llms.txt) - [OpenAPI document](https://skmtc.dev/melhorenvio/apis/api-melhor-envio-sandbox/revisions/ffbe3939fc36?raw)
