dhfinance / dhf-pay-php
DHF Pay phpsdk
dev-main
2022-07-16 16:12 UTC
Requires
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- ext-curl: *
- phpunit/phpunit: ^8.5.5 || ^9.3.5
- psr/log: ^1.1 || ^2.0 || ^3.0
- vlucas/phpdotenv: ^5.4@dev
This package is not auto-updated.
Last update: 2024-11-13 18:34:20 UTC
README
PHP SDK to integrate with DHFinance in minutes.
Getting Started
- Sign up - Before you begin, you need to sign up for your payment gateway account (https://pay.dhfi.online as example) and retrieve your store API token (add Store - APIKey Generate) and API url (https://pay.dhfi.online/api/ as example).
- Requirements – To run the SDK, your system will need to have PHP >= 7.2, cURL and Composer installed . We highly recommend having it compiled with the cURL extension and cURL 7.16.2+ compiled with a TLS backend (e.g., NSS or OpenSSL).
- Install sdk using composer
"require": { dhfinance/dhf-pay-php": "dev-main" }
Create payment
$dhfPay = new DHFPay('<API endpoint>', '<Token>'); $params = [ "amount"=> 2500000000, "comment"=> "test comment" ]; $payment = $dhfPay ->payments() ->add($params);
Payments List
$dhfPay->payments()->getAll();
Get payments by id
$dhfPay->payments()->getOne($id);
Get transactions list
$dhfPay->transaction()->getAll()
Run tests
Install dependencies
composer install
Set variables in tests/.env file (see .env.example)
TEST_SERVER_API=<API endpoint> TEST_SERVER_TOKEN=<token> TEST_STORE_ID=<store id>
then run
./vendor/bin/phpunit tests/DhfInIntegrationTestCasse.php