algocashdev/algocash

v1.1.0 2023-06-20 16:25 UTC

This package is not auto-updated.

Last update: 2024-04-24 01:04:32 UTC


README

This is a Algocash API

  • API version: 1.0.0

Requirements

PHP 5.5 and later

Installation & Usage

Composer

composer require algocashdev/algocash

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/Algocash/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');
    $algo = Algocash::getInstance()
        ->setApiKey('merchant_key', 'merchant_secret')
        ->setAccessToken('api_access_token');
        // ->enableProdMode(false); // default prod mode

    $apiInstance = new DepositApi($algo);
    $payer = new Payer("email", "phone");
    $url = new Url("callback_url", "pending_url", "success_url", "error_url");
    $body = new DepositRequest("invioceId", "amount", $payer, $url, "payment method");

    try {
        $result = $apiInstance->createDeposit($body);
        print_r($result);
    } catch (\Algocash\ApiException $e) {
        echo 'Api Exception when calling DepositApi->createDeposit: ', json_encode($e->getError()), PHP_EOL;
    } catch (\Exception $e) {
        echo 'Exception when calling DepositApi->createDeposit: ', $e->getMessage(), PHP_EOL;
    }
?>

Callback Payload

<?php
    $payload = @file_get_contents('php://input');
    $sig_header = $_SERVER['Signature'];

    try {
        /**
         * @var CallbackPayload body
         */
        $body = \Algocash\Callback::constructCallback($payload, $sig_header, 'accessToken');
        http_response_code(200);
    } catch (\Algocash\SignatureVerificationException $e) {
        http_response_code(401);
    } catch (\Throwable $th) {
        http_response_code(500);
    }
?>

Documentation for API Endpoints

All URIs are relative to https://app.swaggerhub.com/apis-docs/gitdevstar/Algocash/1.0.0

Class Method HTTP request Description
DepositApi createDeposit POST /payin create a deposit
PayoutApi createPayout POST /payout create payout

Documentation For Models

Author

loganph.work@gmail.com

https://github.com/gitdevstar