# CoinPayments

class CoinPayments (View source)

## Properties

protected Credentials | $credentials |  |
protected RequestAgent | $requestAgent |  |
protected string|null | $ipnUrl | Optional URL for your IPN callbacks. |

## Methods

__construct(string $merchantID, string $publicKey, string $privateKey, string $ipnSecret)

CoinPayments constructor.

ApiCall
apiCall(string $command, array $parameters)

No description

ApiCall
getRates(bool $short = true, bool $accepted = true)

Get current exchange rates

ApiCall
getBasicInfo()

Get basic account info

ApiCall
getDepositAddress(string $currency)

Addresses returned by this API are for personal use deposits and reuse the same personal address(es) in your wallet. There is no fee for these deposits but they don't send IPNs.

ApiCall
getBalances(bool $all = false)

Gets your current coin balances (only includes coins with a balance unless all = true).

ApiCall
createTransaction(float $amount, string $currencyIn, string $currencyOut, array $additional = [])

Create a transaction

ApiCall
getTransactionInfo(string $txID, bool $all = true)

Get transaction information via transaction ID

ApiCall
getTransactionsList(int|null $limit = null, int|null $start = null, int|null $newer = null, bool|null $all = null)

No description

ApiCall
getCallbackAddress(float $currency)

Creates an address for receiving payments into your CoinPayments Wallet.

ApiCall
createWithdrawal(float $amount, string $currency, string $address, bool $autoConfirm = false)

Creates a withdrawal from your account to a specified address.

ApiCall
sendToPayByName(float $amount, string $currency, string $pbnTag, bool $autoConfirm = false)

Creates a transfer from your account to a specified $PayByName tag.

ApiCall
createTransfer(float $amount, string $currency, string $merchant, bool $autoConfirm = false)

Creates a transfer from your account to a specified merchant.

ApiCall
queryAPI(string $command, array $parameters)

Makes a query to API Not recommended

Credentials
getCredentials()

No description

mixed
getIpnUrl()

No description

setIpnUrl(mixed $ipnUrl)

No description

setCredentials(string $merchantID, string $publicKey, string $privateKey, string $ipnSecret)

No description

mixed
getRequestAgent()

No description

setRequestAgent(mixed $requestAgent)

No description

## Details

###
at line 38
`__construct(string $merchantID, string $publicKey, string $privateKey, string $ipnSecret)`

CoinPayments constructor.

#### Parameters

string | $merchantID |
string | $publicKey |
string | $privateKey |
string | $ipnSecret |

###
at line 50
`protected ApiCall apiCall(string $command, array $parameters)`

#### Parameters

string | $command |
array | $parameters |

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 68
`ApiCall getRates(bool $short = true, bool $accepted = true)`

Get current exchange rates

#### Parameters

bool | $short | The output won't include the currency names and confirms needed to save bandwidth.
bool | $accepted | The response will include coin acceptance on your Coin Acceptance Settings page.

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 79
`ApiCall getBasicInfo()`

Get basic account info

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 94
`ApiCall getDepositAddress(string $currency)`

Addresses returned by this API are for personal use deposits and reuse the same personal address(es) in your wallet. There is no fee for these deposits but they don't send IPNs.

For commercial-use addresses see 'get_callback_address'.

#### Parameters

string | $currency | The currency the buyer will be sending.

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 107
`ApiCall getBalances(bool $all = false)`

Gets your current coin balances (only includes coins with a balance unless all = true).

#### Parameters

bool | $all | If true it will return all coins, even those with a 0 balance.

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 123
`ApiCall createTransaction(float $amount, string $currencyIn, string $currencyOut, array $additional = [])`

Create a transaction

#### Parameters

float | $amount | The amount of the transaction (floating point to 8 decimals).
string | $currencyIn | The source currency (ie. USD), this is used to calculate the exchange rate.
string | $currencyOut | The cryptocurrency of the transaction.
array | $additional | Optionally set additional fields

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 157
`ApiCall getTransactionInfo(string $txID, bool $all = true)`

Get transaction information via transaction ID

#### Parameters

string | $txID |
bool | $all |

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 176
`ApiCall getTransactionsList(int|null $limit = null, int|null $start = null, int|null $newer = null, bool|null $all = null)`

#### Parameters

int|null | $limit |
int|null | $start |
int|null | $newer |
bool|null | $all |

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 196
`ApiCall getCallbackAddress(float $currency)`

Creates an address for receiving payments into your CoinPayments Wallet.

#### Parameters

float | $currency | The cryptocurrency to create a receiving address for.

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 217
`ApiCall createWithdrawal(float $amount, string $currency, string $address, bool $autoConfirm = false)`

Creates a withdrawal from your account to a specified address.

#### Parameters

float | $amount | The amount of the transaction (floating point to 8 decimals).
string | $currency | The cryptocurrency to withdraw.
string | $address | The address to send the coins to.
bool | $autoConfirm | If true, then the withdrawal will be performed without an email confirmation.

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 241
`ApiCall sendToPayByName(float $amount, string $currency, string $pbnTag, bool $autoConfirm = false)`

Creates a transfer from your account to a specified $PayByName tag.

#### Parameters

float | $amount | The amount of the transaction (floating point to 8 decimals).
string | $currency | The cryptocurrency to withdraw.
string | $pbnTag | The $PayByName tag to send funds to.
bool | $autoConfirm | If true, then the transfer will be performed without an email confirmation.

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 264
`ApiCall createTransfer(float $amount, string $currency, string $merchant, bool $autoConfirm = false)`

Creates a transfer from your account to a specified merchant.

#### Parameters

float | $amount | The amount of the transaction (floating point to 8 decimals).
string | $currency | The cryptocurrency to withdraw.
string | $merchant | The merchant ID to send the coins to.
bool | $autoConfirm | If true, then the transfer will be performed without an email confirmation.

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 286
`ApiCall queryAPI(string $command, array $parameters)`

Makes a query to API Not recommended

#### Parameters

string | $command |
array | $parameters |

#### Return Value

ApiCall |

#### Exceptions

RequestException |

###
at line 294
`Credentials getCredentials()`

#### Return Value

Credentials |

###
at line 302
`mixed getIpnUrl()`

#### Return Value

mixed |

###
at line 310
`setIpnUrl(mixed $ipnUrl)`

#### Parameters

mixed | $ipnUrl |

###
at line 321
`setCredentials(string $merchantID, string $publicKey, string $privateKey, string $ipnSecret)`

#### Parameters

string | $merchantID |
string | $publicKey |
string | $privateKey |
string | $ipnSecret |

###
at line 329
`mixed getRequestAgent()`

#### Return Value

mixed |

###
at line 341
`setRequestAgent(mixed $requestAgent)`

#### Parameters

mixed | $requestAgent |