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(string $command, array $parameters)

No description

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

Get current exchange rates

getBasicInfo()

Get basic account info

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.

getBalances(bool $all = false)

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

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

Create a transaction

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

Get transaction information via transaction ID

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

No description

getCallbackAddress(float $currency)

Creates an address for receiving payments into your CoinPayments Wallet.

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

Creates a withdrawal from your account to a specified address.

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

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

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

Creates a transfer from your account to a specified merchant.

queryAPI(string $command, array $parameters)

Makes a query to API Not recommended

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

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

CoinPayments constructor.

Parameters

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

protected ApiCall apiCall(string $command, array $parameters)

Parameters

string $command
array $parameters

Return Value

ApiCall

Exceptions

RequestException

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

ApiCall getBasicInfo()

Get basic account info

Return Value

ApiCall

Exceptions

RequestException

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

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

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

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

Get transaction information via transaction ID

Parameters

string $txID
bool $all

Return Value

ApiCall

Exceptions

RequestException

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

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

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

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

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

ApiCall queryAPI(string $command, array $parameters)

Makes a query to API Not recommended

Parameters

string $command
array $parameters

Return Value

ApiCall

Exceptions

RequestException

Credentials getCredentials()

Return Value

Credentials

mixed getIpnUrl()

Return Value

mixed

setIpnUrl(mixed $ipnUrl)

Parameters

mixed $ipnUrl

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

Parameters

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

mixed getRequestAgent()

Return Value

mixed

setRequestAgent(mixed $requestAgent)

Parameters

mixed $requestAgent