# `Worldpay.Payments`
[🔗](https://github.com/iamkanishka/worldpay/blob/v1.0.0/lib/worldpay/access/payments.ex#L1)

Worldpay **Payments API** — orchestrated single-call flow.

Combines FraudSight, 3DS authentication, token creation, and card
authorization in a single POST. Supports all payment instrument types:
plain card, Checkout SDK session, stored token, network token, Apple Pay,
Google Pay, and AI agent delegate tokens (ACP).

## Example

    {:ok, auth} =
      Worldpay.Payments.authorize(
        %{
          "transactionReference" => "order-001",
          "merchant" => %{"entity" => "default"},
          "instruction" => %{
            "narrative" => %{"line1" => "My Store"},
            "value" => %{"amount" => 1999, "currency" => "GBP"},
            "paymentInstrument" => %{
              "type" => "card/plain",
              "cardHolderName" => "Jane Doe",
              "cardNumber" => "4444333322221111",
              "cardExpiryDate" => %{"month" => 5, "year" => 2035},
              "cvc" => "123"
            }
          }
        },
        config
      )

# `authorize`

```elixir
@spec authorize(map(), Worldpay.Config.t(), keyword()) ::
  {:ok, map()} | {:error, Worldpay.Error.t()}
```

Authorize a payment.

The `instruction` map is submitted as the request body.

## Options

- `:idempotency_key` — string; auto-generated if not supplied

# `cancel`

```elixir
@spec cancel(String.t(), Worldpay.Config.t(), keyword()) ::
  {:ok, map()} | {:error, Worldpay.Error.t()}
```

Cancel / reverse an authorized payment.

# `get`

```elixir
@spec get(String.t(), Worldpay.Config.t()) ::
  {:ok, map()} | {:error, Worldpay.Error.t()}
```

Retrieve a payment by ID.

# `partial_refund`

```elixir
@spec partial_refund(
  String.t(),
  non_neg_integer(),
  String.t(),
  Worldpay.Config.t(),
  keyword()
) ::
  {:ok, map()} | {:error, Worldpay.Error.t()}
```

Partial refund.

# `partial_settle`

```elixir
@spec partial_settle(
  String.t(),
  non_neg_integer(),
  String.t(),
  Worldpay.Config.t(),
  keyword()
) ::
  {:ok, map()} | {:error, Worldpay.Error.t()}
```

Partial settlement.

# `refund`

```elixir
@spec refund(String.t(), Worldpay.Config.t(), keyword()) ::
  {:ok, map()} | {:error, Worldpay.Error.t()}
```

Full refund.

# `settle`

```elixir
@spec settle(String.t(), map(), Worldpay.Config.t(), keyword()) ::
  {:ok, map()} | {:error, Worldpay.Error.t()}
```

Full settlement of an authorized payment.

---

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