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

# PaymentLinks

[@qonto/embed-sdk](../README) / paymentLinks

# Variable: paymentLinks

> `const` **paymentLinks**: `object`

The paymentLinks namespace contains all the client-side functions related to payment link
operations such as starting the payment link creation flow.

**Client-side only** - This namespace uses proxy-based authentication
(`proxyEndpointDescriptor`).

For server-side operations using access token, import from
`'@qonto/embed-sdk/server/payment-links'`.

It can be accessed like this:

```ts theme={null}
import { paymentLinks } from '@qonto/embed-sdk/payment-links';
```

Then, the paymentLinks object contains the functions to perform payment link operations:

```ts theme={null}
// Preferred: Using proxyEndpointDescriptor
const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
  paymentLinkSettings: {
    items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
    callbackUrl: 'https://example.com/callback',
  },
  operationSettings: { proxyEndpointDescriptor }
});
```

## Type declaration

### getPaymentLinkCreationFlowUrl()

> **getPaymentLinkCreationFlowUrl**: (`params`) => `Promise`\<`string`>

Generates the URL for initiating a payment link creation flow with specified items.

**Client-side only** - Uses proxy-based authentication.
For server-side operations, import from `'@qonto/embed-sdk/server/payment-links'`.

#### Parameters

##### params

[`PaymentLinkParams`](../interfaces/PaymentLinkParams)\<[`CreatePaymentLinkSettings`](../interfaces/CreatePaymentLinkSettings), [`ClientOperationSettings`](../-internal-/interfaces/ClientOperationSettings)>

An object containing:

* `paymentLinkSettings`: An object containing:
  * `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
  * `callbackUrl`: Required callback URL to redirect to after payment link creation.
* `operationSettings`: An object with operation-level settings such as
  `proxyEndpointDescriptor` (required).

#### Returns

`Promise`\<`string`>

Promise resolving to the full URL as a string, which can be used to launch the payment link creation flow in an iframe or browser.

#### Throws

`InvalidParametersError` If `proxyEndpointDescriptor` is not provided, or if the provided items array is invalid, or if callbackUrl is missing or invalid.

#### Throws

`AuthenticationError` If authentication fails (e.g., proxy authentication is rejected).

#### Example

```
const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
  paymentLinkSettings: {
    items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
    callbackUrl: 'https://example.com/callback',
  },
  operationSettings: { proxyEndpointDescriptor }
});
```

### redirectToPaymentLinkCreationFlow()

> **redirectToPaymentLinkCreationFlow**: (`params`) => `Promise`\<`void`>

Redirects to the payment link creation flow with specified items.

**Client-side only** - Uses proxy-based authentication and browser redirect.
This function is not available in server-side imports.

#### Parameters

##### params

[`PaymentLinkParams`](../interfaces/PaymentLinkParams)\<[`CreatePaymentLinkSettings`](../interfaces/CreatePaymentLinkSettings), [`ClientOperationSettings`](../-internal-/interfaces/ClientOperationSettings)>

An object containing:

* `paymentLinkSettings`: An object containing:
  * `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
  * `callbackUrl`: Required callback URL to redirect to after payment link creation.
* `operationSettings`: An object with operation-level settings such as
  `proxyEndpointDescriptor` (required).

#### Returns

`Promise`\<`void`>

This function redirects the browser to the payment link creation flow. Due to the redirect, the returned promise will not resolve.

#### Throws

`InvalidParametersError` If `proxyEndpointDescriptor` is not provided, or if the provided items array is invalid, or if callbackUrl is missing or invalid.

#### Throws

`AuthenticationError` If authentication fails (e.g., proxy authentication is rejected).

#### Example

```
await paymentLinks.redirectToPaymentLinkCreationFlow({
  paymentLinkSettings: {
    items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
    callbackUrl: 'https://example.com/callback',
  },
  operationSettings: { proxyEndpointDescriptor }
});
```
