# `OpenPayments.PaymentPointer`
[🔗](https://github.com/interledger/open-payments-elixir/blob/v1.0.0/lib/open_payments/payment_pointer.ex#L1)

Converts payment-pointer shorthand into an HTTPS discovery URL.

Payment pointers use `$host[/path]` syntax. A missing or root path resolves to
`/.well-known/pay`. Other paths, including their percent encoding and trailing
slashes, are preserved. User-info, explicit ports, queries, and fragments are
forbidden, including empty query and fragment components.

This is a pure syntax conversion. Whether the resulting endpoint supports Open
Payments must be checked during discovery. Apply it to user input rather than
to wallet-address response fields.

See the [payment-pointer specification](https://paymentpointers.org/syntax/).

## Examples

    iex> OpenPayments.PaymentPointer.to_url("$wallet.example.com")
    {:ok, "https://wallet.example.com/.well-known/pay"}

    iex> OpenPayments.PaymentPointer.to_url("$wallet.example.com/")
    {:ok, "https://wallet.example.com/.well-known/pay"}

    iex> OpenPayments.PaymentPointer.to_url("$wallet.example.com/alice")
    {:ok, "https://wallet.example.com/alice"}

# `to_url`

```elixir
@spec to_url(String.t()) :: {:ok, String.t()} | {:error, OpenPayments.Error.t()}
```

Converts a valid payment pointer to a full HTTPS URL without making a request.

---

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