> ## Documentation Index
> Fetch the complete documentation index at: https://docs-alpha.pepay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Return URL

> Manage the merchant default return URL for hosted checkout.

## Overview

This sets the merchant-level default return URL for hosted checkout. It is used when an invoice does **not** supply `payment_return_url`.

## Authentication

Requires merchant auth:

* `x-api-key` (server-to-server), or
* `Authorization: Bearer <jwt>` (dashboard session)

## Request

### Get the default return URL

```ts theme={null}
const current = await pepay.merchantSettings.getPaymentReturnUrl();
```

### Update the default return URL

```ts theme={null}
await pepay.merchantSettings.updatePaymentReturnUrl({
  payment_return_url: 'https://merchant.example.com/checkout/complete'
});
```

### Clear the default return URL

```ts theme={null}
await pepay.merchantSettings.updatePaymentReturnUrl({
  payment_return_url: null
});
```

## Response

```json theme={null}
{
  "payment_return_url": "https://merchant.example.com/checkout/complete",
  "payment_return_url_enabled": true
}
```

## Errors

* `400` invalid return URL (must be HTTPS)
* `401` missing/invalid dashboard bearer token
* `404` merchant not found

## Examples

```ts theme={null}
const current = await pepay.merchantSettings.getPaymentReturnUrl();
if (!current?.payment_return_url_enabled) {
  await pepay.merchantSettings.updatePaymentReturnUrl({
    payment_return_url: 'https://merchant.example.com/checkout/complete'
  });
}
```

Next: [Settlement](/sdk/merchants/settlement)
