GithubHelp home page GithubHelp logo

smobilpay-php's Introduction

Smobilpay S3P API Client for PHP

Php library for the Smobilpay S3P API

Note Only use this branch with PHP 8.1 and above

Note Compatbility with PHP releases < 8.1 are being maintained in the v1.0 branch

Getting Started

Composer

To install the library via Composer, add composer.json:

{
  "require": {
    "maviance/smobilpay-php": "*"
  }
}

Usage

The official API documentation can be found at : https://apidocs.smobilpay.com

Samplecode to call account details:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// inject credentials
$token = "public access key";
$secret = "access secret";
$url = "https://XXXXX";

$xApiVersion = "3.0.0"; // string | api version info

// init
$config = new \Maviance\S3PApiClient\Configuration();
$config->setHost($url);
$client = new \Maviance\S3PApiClient\ApiClient($token, $secret, ['verify' => false]);

// trigger request
$apiInstance = new Maviance\S3PApiClient\Service\AccountApi($client, $config);

try {
    $result = $apiInstance->accountGet($xApiVersion);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountGet: ', $e->getMessage(), PHP_EOL;
}
?>

Please visit https://apidocs.smobilpay.com for usage documentation

Latest Stable Version Latest Unstable Version Total Downloads License

Documentation for API Endpoints

All URIs are relative to /v2

Class Method HTTP request Description
AccountApi accountGet GET /account Retrieve account information and remaining account balance
AccountValidationApi verifyGet GET /verify Verify service number
ConfirmApi collectstdPost POST /collectstd Execute payment collection
HealthcheckApi pingGet GET /ping Check on the availability of the api
InitiateApi billGet GET /bill Get bill payment handler
InitiateApi quotestdPost POST /quotestd Request quote with price details about the payment
InitiateApi subscriptionGet GET /subscription Get subscription payment handler
MasterdataApi cashinGet GET /cashin Retrieve available cashin packages
MasterdataApi cashoutGet GET /cashout Retrieves available cashout packages
MasterdataApi merchantGet GET /merchant Retrieve list of merchants supported by the system.
MasterdataApi productGet GET /product Retrieve list of available products
MasterdataApi serviceGet GET /service Retrieve list of services supported by the system.
MasterdataApi serviceIdGet GET /service/{id} Retrieve single service
MasterdataApi topupGet GET /topup Retrieve available topup packages
MasterdataApi voucherGet GET /voucher Retrieve list of available vouchers to purchase
VerifyApi historystdGet GET /historystd Retrieve list of historic payment collection.
VerifyApi verifytxGet GET /verifytx Get the current payment collection status

Documentation For Models

smobilpay-php's People

Contributors

jephte-maviance avatar gawonmi avatar narek-kerobian avatar camoo avatar

Watchers

 avatar  avatar Kostas Georgiou avatar

smobilpay-php's Issues

cURL error code 3: Malformed url

I have been trying to configure te API bit on my codeignter project hosted on a plesk server . i have serious issues. The error code when i call masterdata or cashout get is

An error occured: string(75) "[0] cURL error 3: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)" NULL string(710) "#0 /var/www/vhosts/trusting-ride.217-160-71-127.plesk.page/ci/application/vendor/maviance/smobilpay-php/src/Service/AccountApi.php(103): Maviance\S3PApiClient\Service\AccountApi->accountGetWithHttpInfo() #1 /var/www/vhosts/trusting-ride.217-160-71-127.plesk.page/ci/application/helpers/rc_helper.php(108): Maviance\S3PApiClient\Service\AccountApi->accountGet() #2 /var/www/vhosts/trusting-ride.217-160-71-127.plesk.page/ci/application/controllers/App.php(122): masterdata() #3 /var/www/vhosts/trusting-ride.217-160-71-127.plesk.page/ci/system/core/CodeIgniter.php(532): App->masterdata() #4 /var/www/vhosts/trusting-ride.217-160-71-127.plesk.page/ci/index.php(315): require_once('/var/www/vhosts...') #5 {main}"

From my research this corresponds to a malformed URL. I have tried every possible solution to know avail.

Service\HealthcheckApi not found

I tried the ping route but got an error
Class "App\Http\Controllers\Maviance\S3PApiClient\Service\HealthcheckApi" not found

Steps to reproduce

  1. Adds dependency as directed
"require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^10.8",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8",
        "maviance/smobilpay-php": "*"
    },
  1. Creates a function ping in my controller
/// //
 private string $xApiVersion = "3.0.0"; // string | api version info
///
///

 public function ping()
    {
        $apiInstance = new Maviance\S3PApiClient\Service\HealthcheckApi();

        try {
            $result = $apiInstance->pingGet($this->xApiVersion);
            return response()->json([
                'data' => $result,
            ]);
            //print_r($result);
        } catch (Exception $e) {
            return response()->json([
                'message' => 'Exception when calling HealthcheckApi->pingGet: ', $e->getMessage(), PHP_EOL
            ]);
            // echo 'Exception when calling HealthcheckApi->pingGet: ', $e->getMessage(), PHP_EOL;
        }
    }
  1. Adds the routes in my routes/api.php
    Route::get('ping', [MobilePaymentController::class, 'ping'])->name('ping');

  2. Calls the route on the browser http://127.0.0.1:8000/api/ping

  3. Error

Error

Class "App\Http\Controllers\Maviance\S3PApiClient\Service\HealthcheckApi" not found

Accessing Variables from protected array in object response

Hi, Good day. Trying to setup your cashout/Cashin Api and i am stucked at this point. When i call cashoutget, the server response has the format

Array
(
[0] => Maviance\S3PApiClient\Model\Cashout Object
(
[container:protected] => Array
(
[serviceid] => 20053
[merchant] => MTNMOMO
[payItemId] => S-112-949-MTNMOMO-20053-200050001-1
[payItemDescr] =>
[amountType] => CUSTOM
[localCur] => XAF
[name] => CASH-OUT
[amountLocalCur] =>
[description] => Cash out a custom amount
[optStrg] =>
[optNmb] =>
)

    )

)

Do you guys have a method in one of your classes that i can call to access these a variables.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.