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

Low-level HTTP client for all Worldpay REST APIs.

Wraps `Req` with:

- Basic Auth injection
- `WP-Api-Version` header management
- `WP-CorrelationId` per-request tracing header
- JSON encode/decode
- Telemetry spans on every call
- Auto-generated idempotency keys on mutations
- Optional circuit breaker via `:fuse`
- XML client for WPG (`wpg_post/2`)

# `header`

```elixir
@type header() :: {String.t(), String.t()}
```

# `headers`

```elixir
@type headers() :: [header()]
```

# `result`

```elixir
@type result() :: {:ok, map() | nil} | {:error, Worldpay.Error.t()}
```

# `xml_result`

```elixir
@type xml_result() :: {:ok, String.t()} | {:error, Worldpay.Error.t()}
```

# `delete`

```elixir
@spec delete(String.t(), keyword(), Worldpay.Config.t()) :: result()
```

DELETE request.

# `get`

```elixir
@spec get(String.t(), keyword(), Worldpay.Config.t()) :: result()
```

GET request against the Access API.

# `patch`

```elixir
@spec patch(String.t(), map(), keyword(), Worldpay.Config.t()) :: result()
```

PATCH request.

# `post`

```elixir
@spec post(String.t(), map(), keyword(), Worldpay.Config.t()) :: result()
```

POST request against the Access API.

# `put`

```elixir
@spec put(String.t(), map(), keyword(), Worldpay.Config.t()) :: result()
```

PUT request.

# `wpg_post`

```elixir
@spec wpg_post(String.t(), Worldpay.Config.t()) :: xml_result()
```

POST XML to the WPG endpoint.

---

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