Inttegro.Orders.PayRequest (inttegro v0.2.0)

Copy Markdown View Source

Parameters for Pay Request in the Orders API.

Build this struct with new!/1 and pass it to the corresponding function on Inttegro.Orders. Required keys are enforced immediately; optional values left as nil are omitted from the request sent to Inttegro.

Manages the complete commercial and payment lifecycle of an order.

Orders bind customer information, immutable commercial terms, line items, totals, payment state, and invoice or receipt documents. Create an order, finalize it when its terms are ready, and then collect or record payment. Payment execution can require a later confirmation step; inspect the returned order and its next action instead of treating the first request as final.

Looking up an order

request = Inttegro.Orders.LookupRequest.new!(order_id: "or_...")

case Inttegro.Orders.lookup(client, request) do
  {:ok, %Inttegro.Orders.Order{status: :completed} = order} ->
    order

  {:ok, order} ->
    {:pending, order.status}

  {:error, %Inttegro.Errors.APIError{} = error} ->
    {:retry_or_reject, error}
end

See the Orders and payments guide for creation, idempotency, confirmation, and hosted checkout.

Summary

Types

t()

A validated pay request request.

Functions

Builds a Inttegro.Orders.PayRequest and raises KeyError when a required field is missing.

Types

t()

@type t() :: %Inttegro.Orders.PayRequest{
  order_id: String.t(),
  paid_out_of_band: boolean() | nil,
  payment_method_data: Inttegro.PaymentMethods.DataInput.t() | nil,
  payment_method_id: String.t() | nil
}

A validated pay request request.

Functions

new!(attrs \\ %{})

@spec new!(map() | keyword()) :: t()

Builds a Inttegro.Orders.PayRequest and raises KeyError when a required field is missing.