# Apps Contracts

***Apps Contract*** is the main contract of subs apps that can be use for interaction with apps.

## **View Methods**

### getAppPayments

```solidity
function getAppPayments(uint256 _appId)
```

Returns `all app payments ids (bytes32).`

### getAppByOwner

```solidity
function getAppByOwner(address _owner)
```

Returns `all app ids by owner (uint256[]).`

## **Write Methods**

### createApp

```solidity
function createApp(
    bytes32 _name,
    Payment[] calldata _payments
)
```

Create new subs app

### deleteApp

```solidity
function deleteApp(uint _appId)
```

Delete subs app.

### addPayment

```solidity
function addPayment(uint256 _appId, Payment[] calldata _payments)
```

Add new payment to an existed app.

### deletePayment

```solidity
function deletePayment(uint256 _appId, bytes32 _paymentId)
```

Delete app Payment

### changeTokenPayment

```solidity
function changeTokenPayment(
        uint256 _appId,
        bytes32 _paymentId,
        address _oldToken,
        address _newToken,
        uint256 _newPrice,
        uint256 _firstAmount
)
```

change payment Token properties.

### modifyPayment

```solidity
function modifyPayment(
        uint256 _appId,
        bytes32 _oldPaymentId,
        bytes32 name
        address owner,
        uint256 fee,
        uint256 trialPeriod,
        uint256 loadingTime
    )
```

Change payment properties

### addTokenPaymentToMyApp

```solidity
function addTokenPaymentToMyApp(
        uint256 _appId,
        bytes32 _paymentId,
        address _newToken,
        uint256 _price,
        uint256 _firstAmount
)
```

Add new token to an existed payment

### removeTokenPaymentFromMyApp

```solidity
function removeTokenPaymentFromMyApp(
        uint256 _appId,
        bytes32 _paymentId,
        address _token
)
```

Remove existed token from a payment

### transferAppOwnership

```solidity
function transferAppOwnership(uint _appId, address _newOwner)
```

Transfer app ownership to new address

### renounceAppOwnership

```solidity
function renounceAppOwnership(uint _appId)
```

Renounce app ownership<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.subsprotocol.com/developer-docs/apps-contracts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
