dhfinance/dhf-pay-php

dev-main 2022-07-16 16:12 UTC

This package is not auto-updated.

Last update: 2024-07-10 16:46:04 UTC


README

PHP SDK to integrate with DHFinance in minutes.

Getting Started

  1. 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).
  2. 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).
  3. 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