codelords/ssentezo-wallet
Composer 安装命令:
composer require codelords/ssentezo-wallet
包简介
A package to help integrate ssentezo wallet into your php application
README 文档
README
A package to help integrate ssentezo wallet into your php application
Getting started
- Create a ssentezo wallet account
Installation
The recommended way to install ssentezo wallet is through Composer:
$ composer require codelords/ssentezo-wallet
After ssentezo wallet installs, you can copy an example file to the project root.
$ cp vendor/code-lords/ssentezo-wallet/resources/example.php .
Making tranasactions
To make transactions you only need to create an instance of the ssentezo wallet
use Codelords\SsentezoWallet; $username = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; $password = "zzzzzzzzzzzzzzzzzzzzzzzzzzzz"; $wallet = new SentezoWallet($username, $password);
With the wallet object you can easily check balance, make deposits withdrawals and as well check status of a transaction.
Configurations
Before we look at how you can make transactions, Let's first look at the configurations.
/** * Environment * You can choose which environment you are using your wallet. * There are two possibilites production and sandbox * For testing purposes always use sandbox to avoid making errors that may result int real * money losses. */ $wallet->setEnvironment("sandbox"); /** * Currency * You can also select a currency you want to use * */ $wallet->setCurrency("UGX");
Here is a list of all the possible configurations and the various methods you can use to manipulate them.
| Configuration | Description | Values | Setter | Getter |
|---|---|---|---|---|
| Environment | The enviroment you are using your wallet in | production, sandbox | setEnvironment($value) | getEnvironment() |
| Currency | The currency | UGX, KES | setCurrency($value) | getCurrency() |
| Callback | A valid url which ssentezo wallet calls incase the transaction completes | A valid url | setCallback($url) | getCallback() |
Making a deposit
use Codelords\SsentezoWallet; $wallet = new SsentezoWallet($username, $password); $username = "xxxxxxxxxxxxxxxxxxxxx";//Put here your API username $password = "xxxxxxxxxxxxxxxxxxxxx";//Put here your API password $phone_number = "+256771234567"; $amount = 10000.00; $transaction_ref = "xxx";//Some unique reference to the transaction $narrative = "xxx"; //A description of the transaction $successCallbackUrl = "https://example.com/success";//A call back once the transaction is successful try { $ret = $wallet->deposit($phone_number,$amount,$transaction_ref,$narrative,$successCallbackUrl); // }catch(\Exception $e){ //Something wrong happened echo "Exception: ". $e->getMessage(); }
Check Status of Transaction
$transaction_ref = "xxx";//The unique identifier of the transaction $username = "xxxxxxxxxxxxxxxxxxxxx";//Put here your API username $password = "xxxxxxxxxxxxxxxxxxxxx";//Put here your API password $wallet = new SsentezoWallet($username, $password); try { $response = $wallet->checkStatus($prn);//The response object has all the information about the transaction //You can then find the status switch ($response->status) { case "SUCCEEDED": // For success break; case "FAILED": //Failed the transaction break; case "PENDING": //Still Pending break; case "INDETERMINATE": //As the name suggests break; default:// WTF } } catch (Exception $e) { //Something went wrong echo "Exception: ".$e->getMessage(); }
Making a Withrawal
use Codelords\SsentezoWallet; $wallet = new SsentezoWallet($username, $password); $username = "xxxxxxxxxxxxxxxxxxxxx";//Put here your API username $password = "xxxxxxxxxxxxxxxxxxxxx";//Put here your API password $phone_number = "+256771234567"; $amount = 10000.00; $transaction_ref = "xxx";//Some unique reference to the transaction $narrative = "xxx"; //A description of the transaction $successCallbackUrl = "https://example.com/success";//A call back once the transaction is successful try { $response = $wallet->withdraw($phone_number, $amount, $transaction_ref, $narrative, $successCallback); // }catch(\Exception $e){ //Something wrong happened echo "Exception: ". $e->getMessage(); }
codelords/ssentezo-wallet 适用场景与选型建议
codelords/ssentezo-wallet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 707 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 codelords/ssentezo-wallet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codelords/ssentezo-wallet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 707
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-02