Skip to content

Commit 276867a

Browse files
committed
update readme with new functions
1 parent 8987ccb commit 276867a

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,81 @@ $data = $ca->check_logs();
106106
Same parameters as before, the `$data` returned can be checked here: https://cryptapi.io/docs/#/Bitcoin/btclogs
107107

108108

109+
### Generating a QR code
110+
111+
```php
112+
<?php
113+
require 'vendor/autoload.php'; // Where your vendor directory is
114+
115+
$ca = new CryptAPI\CryptAPI($coin, $my_address, $callback_url, $parameters, $cryptapi_params);
116+
$payment_address = $ca->get_address();
117+
118+
$qrcode = $ca->get_qrcode($value, $size);
119+
```
120+
121+
For object creation, same parameters as before. You must first call `get_address` as this method requires the payment address to have been created.
122+
123+
For QR code generation:
124+
125+
``$value`` Value to request the user, in the main coin (BTC, ETH, etc). Optional, pass `false` to not add a value to the QR.
126+
127+
``$size`` Size of the QR Code image in pixels. Optional, pass `false` to use the default size of 512.
128+
129+
Response is an object with `qr_code` (base64 encoded image data) and `payment_uri` (the value encoded in the QR), see https://cryptapi.io/docs/#operation/btcqrcode for more information.
130+
131+
132+
### Estimating transaction fees
133+
134+
```php
135+
<?php
136+
require 'vendor/autoload.php'; // Where your vendor directory is
137+
138+
$fees = CryptAPI\CryptAPI::get_estimate($coin, $addresses, $priority);
139+
```
140+
141+
Where:
142+
143+
``$coin`` is the coin you wish to check, from CryptAPI's supported currencies (e.g `'btc', 'eth', 'erc20_usdt', ...`)
144+
145+
``$addresses`` The number of addresses to forward the funds to. Optional, defaults to 1.
146+
147+
``$priority`` Confirmation priority, needs to be one of `['fast', 'default', 'economic']`. Optional, defaults to `default`.
148+
149+
Response is an object with `estimated_cost` and `estimated_cost_usd`, see https://cryptapi.io/docs/#operation/btcestimate for more information.
150+
151+
152+
### Converting between coins and fiat
153+
154+
```php
155+
<?php
156+
require 'vendor/autoload.php'; // Where your vendor directory is
157+
158+
$conversion = CryptAPI\CryptAPI::get_convert($coin, $value, $from);
159+
```
160+
161+
Where:
162+
163+
``$coin`` the target currency to convert to, from CryptAPI's supported currencies (e.g `'btc', 'eth', 'erc20_usdt', ...`)
164+
165+
``$value`` Value to convert in `from`.
166+
167+
``$from`` Currency to convert from, FIAT or crypto.
168+
169+
Response is an object with `value_coin` and `exchange_rate`, see https://cryptapi.io/docs/#operation/btcconvert for more information.
170+
171+
172+
### Getting supported coins
173+
174+
```php
175+
<?php
176+
require 'vendor/autoload.php'; // Where your vendor directory is
177+
178+
$coins = CryptAPI\CryptAPI::get_supported_coins();
179+
```
180+
181+
Response is an array with all support coins.
182+
183+
109184
## Help
110185

111186
Need help?

0 commit comments

Comments
 (0)