# `Polarex.Orders`
[🔗](https://github.com/giusdp/polarex/blob/main/lib/polarex/operations/orders.ex#L1)

Provides API endpoints related to orders

# `customer_portal_orders_confirm_retry_payment`

```elixir
@spec customer_portal_orders_confirm_retry_payment(
  id :: String.t(),
  body :: Polarex.CustomerOrderConfirmPayment.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerOrderPaymentConfirmation.t()}
  | {:error,
     Polarex.ManualRetryLimitExceeded.t()
     | Polarex.OrderNotEligibleForRetry.t()
     | Polarex.PaymentAlreadyInProgress.t()
     | Polarex.ResourceNotFound.t()}
```

Confirm Retry Payment

Confirm a retry payment using a Stripe confirmation token.

## Request Body

**Content Types**: `application/json`

# `customer_portal_orders_generate_invoice`

```elixir
@spec customer_portal_orders_generate_invoice(id :: String.t(), opts :: keyword()) ::
  {:ok, map()}
  | {:error,
     Polarex.MissingInvoiceBillingDetails.t() | Polarex.NotPaidOrder.t()}
```

Generate Order Invoice

Trigger generation of an order's invoice.

# `customer_portal_orders_get`

```elixir
@spec customer_portal_orders_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrder.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order

Get an order by ID for the authenticated customer.

# `customer_portal_orders_get_payment_status`

```elixir
@spec customer_portal_orders_get_payment_status(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrderPaymentStatus.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Payment Status

Get the current payment status for an order.

# `customer_portal_orders_invoice`

```elixir
@spec customer_portal_orders_invoice(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrderInvoice.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Invoice

Get an order's invoice data.

# `customer_portal_orders_list`

```elixir
@spec customer_portal_orders_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerOrder.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Orders

List orders of the authenticated customer.

## Options

  * `product_id`: Filter by product ID.
  * `product_billing_type`: Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases.
  * `subscription_id`: Filter by subscription ID.
  * `query`: Search by product or organization name.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `customer_portal_orders_receipt`

```elixir
@spec customer_portal_orders_receipt(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrderReceipt.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Receipt

Get a presigned URL to download an order's receipt PDF.

# `customer_portal_orders_update`

```elixir
@spec customer_portal_orders_update(
  id :: String.t(),
  body :: Polarex.CustomerOrderUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerOrder.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Order

Update an order for the authenticated customer.

## Request Body

**Content Types**: `application/json`

# `orders_export`

```elixir
@spec orders_export(opts :: keyword()) ::
  {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Export Orders

Export orders as a CSV file.

**Scopes**: `orders:read`

## Options

  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.

# `orders_generate_invoice`

```elixir
@spec orders_generate_invoice(id :: String.t(), opts :: keyword()) ::
  {:ok, map()}
  | {:error,
     Polarex.MissingInvoiceBillingDetails.t() | Polarex.NotPaidOrder.t()}
```

Generate Order Invoice

Trigger generation of an order's invoice.

**Scopes**: `orders:read`

# `orders_get`

```elixir
@spec orders_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Order.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order

Get an order by ID.

**Scopes**: `orders:read`

# `orders_invoice`

```elixir
@spec orders_invoice(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.OrderInvoice.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Invoice

Get an order's invoice data.

**Scopes**: `orders:read`

# `orders_list`

```elixir
@spec orders_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceOrder.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Orders

List orders.

**Scopes**: `orders:read`

## Options

  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.
  * `product_billing_type`: Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases.
  * `discount_id`: Filter by discount ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by customer external ID.
  * `checkout_id`: Filter by checkout ID.
  * `subscription_id`: Filter by subscription ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `orders_receipt`

```elixir
@spec orders_receipt(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.OrderReceipt.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Receipt

Get a presigned URL to download an order's receipt PDF.

**Scopes**: `orders:read`

# `orders_update`

```elixir
@spec orders_update(
  id :: String.t(),
  body :: Polarex.OrderUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Order.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Order

Update an order.

**Scopes**: `orders:write`

## Request Body

**Content Types**: `application/json`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
