## Payus API SDK
Payment Gateway API to process crypto currency.

## Documentation
This page describes how to use this package.

## Usage

Run `npm install @payus/payus-sdk`

const PayusAPI = require('@payus/payus-sdk')

const payus = new PayusAPI('Access token pass here')

#### Get Address Balance

var balance = payus.getAddressBalance({coin: 'BTC', address: 'put coin address here'})

For `XRP`

var result = payus.getAddressBalance({coin: 'XRP', address: 'put coin address here', destination_tag: 'put here'})

result.then(res => {

    console.log(res)

}).catch(err => {

    console.log(err)

})

### All methods

| method  | params | description |
| ------------- | ------------- | ------------- |
| getAccountBalance  | coin_code (comma separated for multiple coins, example: "BTC,ETH,BCH")  | Get merchant account balance |
| getAddressBalance  | coin, address, destination_tag(only for [XRP, BNB, XLM])  | Get address balance |
| paymentCryptoRest  | currency, return_url, coin_code, product_amount, invoice_id  | To create new customer transaction |
| getBalance  | transaction_id  | Get balance |
| getDepositTransactions  | coin_code, limit(default: 10), page(default: 1), time or transaction | Get deposite transactions example: ({ "coin_code": "ETH", "limit": 10, "page": 1, "time": { "start": 1557324618, "end": 1557809939 }, "transaction": { "txhash": "transaction hash", "condition": "after" } }) |
| withdraw  | apikey, coin_code, amount, withdraw_address, order_id(unique id: like as unix timestamp)  | Withdraw |
| getWithdrawTransaction  | order_id(unique id sent previously with withdraw request)  | Getting the details for withdraw transaction |
| generateAddress  | coin_code | Generate address |
| saveAddress  | coin_code, m_id, request_data, response_data, coin_address | Save address |
| isValidAddress  | coin, address | Address valid check |
| isGreenAddress  | coin, address | Green address check |
| isGreenTransaction  | coin_code, transaction_id | Green transaction |
| getMyAddresses  | coin | Get address |
| getMycoinlist  | (No need to pass data) | Get coin list |
| getRawTransaction  | coin, transaction_id | Get Raw transaction |
| trackPayment  | id | Track payment |
| sendEmail  | status, to_email, transaction_id | Send email |
| getPaymentButtonCoin  | merchant_id, button_type | Get payment button coin |
| payusModelApi  | app_id, api_key | Payus model API |
| getDepositCoinAddress  | coin_code, customer_address | get deposit coin address |
| getDepositToken  | coin_code, customer_address, deposit_transaction, destination_tag(only for [XRP, BNB, XLM]), amount | get deposit token |
| getWithdrawTokenAddress  | coin_code, customer_address, amount | get withdraw token address |
| getWithdrawCoin  | coin_code, customer_address, token_transaction, destination_tag(only for [XRP, BNB, XLM]), amount | get withdraw coin |
