# Getting Started

The Galliun Payment SDK provides a TypeScript interface to interact with the Galliun Payment Protocol smart contracts.

## Installation

```bash
npm install @galliun/galliun-payment-sdk
# or
yarn add @galliun/galliun-payment-sdk
```

## Initialization

The main entry point is the `PaymentClient` class which provides access to all protocol features:

```typescript
import { PaymentClient } from '@galliun/payment-sdk';

const client = new PaymentClient({
	network: 'mainnet', // or 'testnet', 'devnet'
	packageId: '0x...', // Protocol package ID
	configId: '0x...', // Protocol config ID
	adminCapId: '0x...', // Optional: Admin capability ID
	sender: '0x...', // Optional: Default sender address
	signTransaction: async (tx) => {
		// Your transaction signing logic
		return signedTx;
	},
});
```

you can find the contract addresses in the PAYMENT\_IDS

### Required Parameters

* `network`: The Sui network to connect to ('mainnet' or 'testnet')
* `packageId`: The protocol package ID
* `configId`: The protocol configuration object ID
* `signTransaction`: Function to sign transactions

### Optional Parameters

* `adminCapId`: Admin capability ID (only needed for admin operations)
* `sender`: Default sender address
* `suiClient`: Custom Sui client instance

## Available Managers

The client provides specialized managers for different protocol features:

```typescript
// Bill Management (One-time and Recurring)
const { billManager } = client;

// Payment Request Management
const { paymentRequestManager } = client;

// Product Management
const { productManager } = client;

// Configuration Management
const { configManager } = client;
```

Each manager provides specific methods for its domain. See the respective documentation sections for details:

* [Bill Management](https://galliun-1.gitbook.io/galliun/sdk-reference/bill-management)
* [Payment Requests](https://galliun-1.gitbook.io/galliun/sdk-reference/payment-requests)
* [Product Management](https://galliun-1.gitbook.io/galliun/sdk-reference/product-management)

## Error Handling

The SDK throws typed errors for various failure cases. Always wrap SDK calls in try-catch blocks:

```typescript
try {
	await client.billManager.createBill(/* ... */);
} catch (error) {
	if (error.code === 'UNSUPPORTED_COIN') {
		// Handle unsupported coin error
	}
	// Handle other errors
}
```

## Next Steps

* Learn about [Bill Management](https://galliun-1.gitbook.io/galliun/sdk-reference/bill-management)
* Explore [Payment Requests](https://galliun-1.gitbook.io/galliun/sdk-reference/payment-requests)
* Set up [Product Management](https://galliun-1.gitbook.io/galliun/sdk-reference/product-management)
* Read the [API Reference](https://github.com/Galliun/GallyPay/blob/main/docs/gitbook/sdk/reference/globals.md)
