README
Installation
Requires:
- PHP version: ^7.3
- PHP extensions: guzzlehttp/guzzle, phpunit/phpunit, fakerphp/faker
You can install the package via composer:
composer require greencryptopay/greencryptopay-php
Tests
vendor/bin/phpunit --testsuite="tests"
Standard API
Getting Started:
require "vendor/autoload.php";
use GcpSdk\Api;
// Standard API
$standardApi = Api::make('standard');
// Standard API testnet
$standardApi = Api::make('standard', true);
// Sign up
if (empty($merchantId) || empty($secretKey)) {
$response = $standardApi->merchant('percent', 'https://example.com/callback');
$merchantId = $response['merchant_id'];
$secretKey = $response['secret_key'];
}
$standardApi->setMerchantId($merchantId);
$standardApi->setSecretKey($secretKey);
Sign up:
Name |
Parameters |
Validation |
Description |
merchant |
- string $feeType
- string $callbackUrl
|
- Enum: [percent, fix]
- Max: 200
|
- Fee type
- URL to send notifications about payments
|
Operations:
Name |
Parameters |
Validation |
Description |
paymentAddress |
- string $currency
- string $callbackUrl
- string $orderId
- string $currencyFrom
- string $amountFrom
|
- Enum: [btc]
- Max: 200
- Max: 50
- Enum: [usd]
- —
|
- Currency
- URL to send notifications about payments
- Order identifier in your system
- Currency to convert from
- Amount to convert
|
withdraw |
- string $currency
- array $recipients
|
|
- Currency
- Array structure: [['address' => 'Recipient address', 'amount' => 'Recipient's amount']]
|
withdrawAll |
- string $currency
- string $recipientAddress
|
|
- Currency
- Recipient address
|
Stats:
Name |
Parameters |
Validation |
Description |
merchantState |
|
|
|
merchantPaymentAddress |
- string $currency
- string / null $fromTimestamp
- string / null $toTimestamp
- int / null $limit
- int / null $page
- string / null $order
|
- Enum: [btc]
- Timestamp in UTC
- Timestamp in UTC
- Min:1, Max:200
- Min:1
- Enum: [asc, desc]
|
- Currency
- Address creation timestamp in UTC, from (inclusive, ex. "2035-12-31T15:30:59")
- Address creation timestamp in UTC, to (inclusive, ex. "2035-12-31T15:30:59")
- Number of records in the response
- Page number
- Records order ascending or descending
|
merchantIncomingPayments |
- string $currency
- string / null $paymentAddress
- string / null $txid
- string / null $fromTimestamp
- string / null $toTimestamp
- int / null $limit
- int / null $page
- string / null $order
|
- Enum: [btc]
- —
- —
- Timestamp in UTC
- Timestamp in UTC
- Min:1, Max:200
- Min:1
- Enum: [asc, desc]
|
- Currency
- Show only payments to specific payment address
- Show only payments with specific transaction
- Payment timestamp in UTC, from (inclusive, ex. "2035-12-31T15:30:59")
- Payment timestamp in UTC, to (inclusive, ex. "2035-12-31T15:30:59")
- Number of records in the response
- Page number
- Records order ascending or descending
|
merchantWithdrawals |
- string $currency
- string / null $fromTimestamp
- string / null $toTimestamp
- int / null $limit
- int / null $page
- string / null $order
|
- Enum: [btc]
- Timestamp in UTC
- Timestamp in UTC
- Min:1, Max:200
- Min:1
- Enum: [asc, desc]
|
- Currency
- Withdrawal timestamp in UTC, from (inclusive, ex. "2035-12-31T15:30:59")
- Withdrawal timestamp in UTC, to (inclusive, ex. "2035-12-31T15:30:59")
- Number of records in the response
- Page number
- Records order ascending or descending
|
paymentAddressCallbacks |
- string $currency
- string $paymentAddress
- string / null $txid
- string / null $fromTimestamp
- string / null $toTimestamp
- int / null $limit
- int / null $page
- string / null $order
|
- Enum: [btc]
- —
- —
- Timestamp in UTC
- Timestamp in UTC
- Min:1, Max:200
- Min:1
- Enum: [asc, desc]
|
- Currency
- Payment address
- Show only payment callbacks with specific transaction
- Callback timestamp in UTC, from (inclusive, ex. "2035-12-31T15:30:59")
- Callback timestamp in UTC, to (inclusive, ex. "2035-12-31T15:30:59")
- Number of records in the response
- Page number
- Records order ascending or descending
|
paymentAddressState |
- string $currency
- string $paymentAddress
|
|
|
Transfer API
Getting Started:
require "vendor/autoload.php";
use GcpSdk\Api;
// Transfer API
$transferApi = Api::make('transfer');
// Transfer API testnet
$transferApi = Api::make('transfer', true);
// Sign up
if (empty($merchantId) || empty($secretKey)) {
$response = $transferApi->merchant('percent', 'https://example.com/callback');
$merchantId = $response['merchant_id'];
$secretKey = $response['secret_key'];
}
$transferApi->setMerchantId($merchantId);
$transferApi->setSecretKey($secretKey);
Sign up:
Name |
Parameters |
Validation |
Description |
merchant |
- string $feeType
- string $callbackUrl
|
- Enum: [percent, fix]
- Max: 200
|
- Fee type
- URL to send notifications about payments
|
Operations:
Name |
Parameters |
Validation |
Description |
paymentAddress |
- string $currency
- string $recipientAddress
- string $feeType
- string $callbackUrl
- string $orderId
- string $currencyFrom
- string $amountFrom
|
- Enum: [btc]
- —
- Enum: [percent, fix]
- Max:200
- Max:50
- Enum: [usd, rub, try, eur, zar, gbp, uah, aud, brl, pln]
- —
|
- Currency
- Recipient address
- Fee type
- URL to send notifications about payments
- Order identifier in your system
- Currency to convert from
- Amount to convert
|
Stats:
Name |
Parameters |
Validation |
Description |
paymentAddressState |
- string $currency
- string $paymentAddress
|
|
- Currency
- Show only payments to specific payment address
|
paymentAddressPayments |
- string $currency
- string $paymentAddress
- string / null $txid
- string / null $fromTimestamp
- string / null $toTimestamp
- int / null $limit
- int / null $page
- string / null $order
|
- Enum: [btc]
- —
- —
- Timestamp in UTC
- Timestamp in UTC
- Min:1, Max:200
- Min:1
- Enum: [asc, desc]
|
- Currency
- Payment address
- Show only specific transaction payments
- Payment timestamp in UTC, from (inclusive, ex. "2035-12-31T15:30:59")
- Payment timestamp in UTC, to (inclusive, ex. "2035-12-31T15:30:59")
- Number of records in the response
- Page number
- Records order ascending or descending
|
paymentAddressCallbacks |
- string $currency
- string $paymentAddress
- string / null $txid
- string / null $fromTimestamp
- string / null $toTimestamp
- int / null $limit
- int / null $page
- string / null $order
|
- Enum: [btc]
- —
- —
- Timestamp in UTC
- Timestamp in UTC
- Min:1, Max:200
- Min:1
- Enum: [asc, desc]
|
- Currency
- Payment address
- Show only payment callbacks with specific transaction
- Payment timestamp in UTC, from (inclusive, ex. "2035-12-31T15:30:59")
- Payment timestamp in UTC, to (inclusive, ex. "2035-12-31T15:30:59")
- Number of records in the response
- Page number
- Records order ascending or descending
|
merchantState |
|
|
|
merchantPaymentAddress |
- string $currency
- string / null $fromTimestamp
- string / null $toTimestamp
- int / null $limit
- int / null $page
- string / null $order
|
- Enum: [btc]
- Timestamp in UTC
- Timestamp in UTC
- Min:1, Max:200
- Min:1
- Enum: [asc, desc]
|
- Currency
- Address creation timestamp in UTC, from (inclusive, ex. "2035-12-31T15:30:59")
- Address creation timestamp in UTC, to (inclusive, ex. "2035-12-31T15:30:59")
- Number of records in the response
- Page number
- Records order ascending or descending
|
merchantPayments |
- string $currency
- string / null $txid
- string / null $fromTimestamp
- string / null $toTimestamp
- int / null $limit
- int / null $page
- string / null $order
|
- Enum: [btc]
- —
- Timestamp in UTC
- Timestamp in UTC
- Min:1, Max:200
- Min:1
- Enum: [asc, desc]
|
- Currency
- Show only specific transaction payments
- Payment timestamp in UTC, from (inclusive, ex. "2035-12-31T15:30:59")
- Payment timestamp in UTC, to (inclusive, ex. "2035-12-31T15:30:59")
- Number of records in the response
- Page number
- Records order ascending or descending
|