# Getting started

{% hint style="info" %}
To authorize your requests and use SDK you have to obtain [private key](https://docs.0xpay.app/integration-cookbook/getting-started/merchant-setup#api-keys).
{% endhint %}

0xPay SDK allows to integrate and start work with [Merchant Public API](https://docs.0xpay.app/public-api/endpoints) in several moves.

## Getting started

### Prerequisites&#x20;

To start using 0xPay SDK you need merchant id and [private key](https://docs.0xpay.app/integration-cookbook/getting-started/merchant-setup#api-keys). So you must [register an account](https://docs.0xpay.app/public-api/js-ts-sdk/broken-reference) and [create a merchant](https://docs.0xpay.app/integration-cookbook/getting-started/merchant-setup#creating-a-merchant) to obtain API credentials.

{% hint style="info" %}
**Note:** If you want to receive and [process webhook notifications](https://docs.0xpay.app/public-api/notifications), you will need to [setup your merchant](https://docs.0xpay.app/integration-cookbook/getting-started/merchant-setup#notifications).
{% endhint %}

### Installation

```javascript
// NPM
npm i @0xpay/sdk
// Yarn
yarn add @0xpay/sdk
```

### Create instance

```ts
import { XPay } from '@0xpay/sdk'

const MERCHANT_ID = 'your-merchant-id'
const MERCHANT_PRIVATE_KEY = 'your-merchant-private-key'

// Create XPay instance
const xpay = new XPay(MERCHANT_ID, MERCHANT_PRIVATE_KEY)
```

### Get available crypto assets

```ts
import { XPay } from '@0xpay/sdk'

// Create XPay instance
const xpay = new XPay(...)

// Use 0xPay API 
xpay.getAvailableCryptoAssets().then((assets) => console.log(assets))
```

### Create receiving crypto address

```ts
import { XPay } from '@0xpay/sdk'

// Create XPay instance
const xpay = new XPay(...)

// Use 0xPay API
xpay.createReceiveAddress({ blockchain: 'BITCOIN', meta: 'user 1' })
    .then((address) => console.log(address))
```
