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

# Class: Royalty

[resources/royalties](../modules/resources_royalties).RoyaltyClient

The RoyaltyClient handles the complex process of royalty management.
Royalties are the payments due to licensors based on the revenue generated by licensed products.
This client provides methods to register sales data (via invoices), calculate royalties,
and manage their payment and acceptance both on-chain and off-chain.

## Table of contents

#### Methods

* [register](#register)
* [payOffchain](#payoffchain)
* [acceptOffchain](#acceptoffchain)
* [denyOffchain](#denyoffchain)

### constructor

• **new RoyaltyClient**(`client`): [`RoyaltyClient`](./royalty)

#### Parameters

| Name     | Type                               |
| :------- | :--------------------------------- |
| `client` | [`SpaceportSDK`](../spaceport-sdk) |

#### Returns

[`RoyaltyClient`](./royalty)

## Methods

### register

▸ **register**(`params`): `Promise`\<[`RegisterRoyaltiesResponse`](../types/register-royalties-response)>

Registers royalties from a CSV invoice file.
This method uploads a CSV file containing invoice data and processes it for royalty registration.
It first imports the invoices, then creates royalty registration periods with the necessary signatures.

#### Parameters

| Name     | Type                                                            | Description                                                        |
| :------- | :-------------------------------------------------------------- | :----------------------------------------------------------------- |
| `params` | [`RegisterRoyaltiesParams`](../types/register-royalties-params) | Royalty registration parameters including CSV file and product IDs |

#### Returns

`Promise`\<[`RegisterRoyaltiesResponse`](../types/register-royalties-response)>

Promise resolving to registration response

**`Example`**

```typescript theme={null}
const csvFile = new File([csvData], 'invoices.csv', { type: 'text/csv' });

const result = await sdk.royalties.register({
  csvFile: csvFile,
  productIds: [123, 456, 789],
  userId: 'user-uuid',
  licenseeAddress: '0x1234567890abcdef1234567890abcdef12345678'
});

if (result.success) {
  console.log('Royalties registered with job ID:', result.jobId);
}
```

### payOffchain

▸ **payOffchain**(`params`): `Promise`\<[`OffchainPaymentResponse`](../types/offchain-payment-response)>

Pays royalties for a set of products.

#### Parameters

| Name     | Type                                                                 | Description                      |
| :------- | :------------------------------------------------------------------- | :------------------------------- |
| `params` | [`PayOffchainRoyaltiesInput`](../types/pay-offchain-royalties-input) | Parameters for paying royalties. |

#### Returns

`Promise`\<[`OffchainPaymentResponse`](../types/offchain-payment-response)>

A promise resolving to the response from the payment endpoint.

### acceptOffchain

▸ **acceptOffchain**(`royalties`): `Promise`\<[`OffchainAcceptanceDenialResponse`](../types/offchain-acceptance-denial-response)>

Accepts royalties.

#### Parameters

| Name        | Type                                                                  | Description                           |
| :---------- | :-------------------------------------------------------------------- | :------------------------------------ |
| `royalties` | [`AcceptDenyRoyaltiesInput`](../types/accept-deny-royalties-input)\[] | An array of royalty inputs to accept. |

#### Returns

`Promise`\<[`OffchainAcceptanceDenialResponse`](../types/offchain-acceptance-denial-response)>

A promise resolving to the response from the acceptance endpoint.

### denyOffchain

▸ **denyOffchain**(`royalties`): `Promise`\<[`OffchainAcceptanceDenialResponse`](../types/offchain-acceptance-denial-response)>

Denies royalties.

#### Parameters

| Name        | Type                                                                  | Description                         |
| :---------- | :-------------------------------------------------------------------- | :---------------------------------- |
| `royalties` | [`AcceptDenyRoyaltiesInput`](../types/accept-deny-royalties-input)\[] | An array of royalty inputs to deny. |

#### Returns

`Promise`\<[`OffchainAcceptanceDenialResponse`](../types/offchain-acceptance-denial-response)>

A promise resolving to the response from the denial endpoint.
