pesamoni / composer
dev-master
2019-02-06 10:22 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is not auto-updated.
Last update: 2024-09-26 17:37:38 UTC
README
Pesamoni Pesaway php 库提供对 Pesamoni 服务的集成访问。您可以通过点击链接 https://pesamoni.com/developers#features-intro 查看API功能。
要求
PHP 5.5 及以上版本
安装
使用 Composer
通过 点击此处 下载 Pesamoni github 仓库,然后在你的文件根目录下运行 composer install
。你也可以
require 'pesamoni_php'
或使用 composer require pesamoni/composer
,无需指定 Composer 应该在哪里查找包。
手动安装
通过 点击此处 下载 Pesamoni github 仓库中的文件,并包含 autoload.php
require_once('/path/to/pesamoni/vendor/autoload.php');
快速入门示例
SDK 需要通过您的 API 用户名和 API 密码进行实例化,您可以从您的 Pesamoni 商业账户 获取。
您可以在 此处 注册新的 Pesamoni 商业账户或 此处 登录
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: apipassword $config = psm\Configuration::getDefaultConfiguration()->setApiKey('apipassword', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = psm\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apipassword', 'Bearer'); // Configure API key authorization: apiusername $config = psm\Configuration::getDefaultConfiguration()->setApiKey('apiusername', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = psm\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apiusername', 'Bearer'); $apiInstance = new psm\Api\DefaultApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config );
接受来自移动用户缴费
// you can either use method acreceive or acreceivekeac as explained below // method acreceive // This method enables you receive funds from a mobile subscriber in your registered native currency on the Pesamoni platform. If for instance your account is registered in currency UGX and you request money from a Kenyan number e.g 254712346789, a Pesamoni exchange rate will automatically be applied and money deposited into your Pesamoni wallet in your default currency // method acreceivekeac // You can have two native currencies on your Pesamoni account on request. If you would like to deposit funds from a mobile subscriber to your Kenyan Pesamoni wallet account then this is the method you use. // example $method = "acreceive"; // string | Enter a request method. To check for request methodsref=''>click here</a> $amount = "amount_example"; // string | Enter the amount you would like to request for. <p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, acsendbank, pesab2c, sendairtime, cardaccept</b></p> $mobile = "mobile_example"; // string | Enter the mobile number you would like to execute the above method in format 256.... or 254...<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, senderid, sendsms, sendairtime</b></p> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> $genericmsg = "genericmsg_example"; // string | Enter your user generated generic message for the requested transaction<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $token = "token_example"; // string | Enter your user generated token for the above mentioned method<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
向移动用户发送资金
// you can either use method acreceive or acreceivekeac as explained below // acsend // This method enables you send funds to a mobile subscriber in your registered native currency on the Pesamoni platform. If for instance your account is registered in currency UGX and you send money to a kenyan number e.g 254712346789, a Pesamoni exchange rate will automatically be applied and the equivalent exchange amount deducted from your Pesamoni wallet in your default currency // acsendkeac // You can have two native currencies on your Pesamoni account on request. If you would like to send funds from your Pesamoni wallet to a mobile subscriber from your Kenyan Pesamoni wallet account then this is the method you use. $method = "acsend"; // string | Enter a request method. To check for request methodsref=''>click here</a> $amount = "amount_example"; // string | Enter the amount you would like to send funds to. <p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, acsendbank, pesab2c, sendairtime, cardaccept</b></p> $mobile = "mobile_example"; // string | Enter the mobile number you would like to execute the above method in format 256.... or 254...<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, senderid, sendsms, sendairtime</b></p> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> $genericmsg = "genericmsg_example"; // string | Enter your user generated generic message for the requested transaction<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $token = "token_example"; // string | Enter your user generated token for the above mentioned method<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
接受卡支付,例如 VISA/MASTERCARD
$method = "cardaccept"; // string | Enter a request method. To check for request methods <a href=''>click here</a> $holdername = "holdername_example"; // string | Enter name of payer for Visa/MasterCard transactions<p style=\"color:red\">This method applies for request method <b>cardaccept</b></p> $cardnumber = "cardnumber_example"; // string | Enter the Visa/MasterCard cardnumber<p style=\"color:red\">This method applies for request method <b>cardaccept</b></p> $cvv = "cvv_example"; // string | Enter the Visa/MasterCard cvv<p style=\"color:red\">This method applies for request method <b>cardaccept</b></p> $exp = "exp_example"; // string | Enter the Visa/MasterCard expiry date in the format MM/YYYY e.g 07/2030<p style=\"color:red\">This method applies for request method <b>cardaccept</b></p> $currency = "currency_example"; // string | Enter the currency you intend to make the transaction for Visa/MasterCard based transactions<p style=\"color:red\">This method applies for request method <b>cardaccept</b></p> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> $genericmsg = "genericmsg_example"; // string | Enter your user generated generic message for the requested transaction<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $token = "token_example"; // string | Enter your user generated token for the above mentioned method<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
银行转账
// you can either use method acsendbank or acsendbankeac as explained below // acsendbank // This method enables you send funds to a users bank account. A Pesamoni exchange rate will automatically be applied and the equivalent exchange amount deposited to your bank account dependent on your default currency. // acsendbankeac // You can have two native currencies on your Pesamoni account on request. If you would like to send funds from your Pesamoni wallet to a mobile subscriber from your Kenyan Pesamoni wallet account then this is the method you use. $method = "acsendbank"; // string | Enter a request method. To check for request methods <a href=''>click here</a> $amount = "amount_example"; // string | Enter the amount you would like to send to. <p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, acsendbank, pesab2c, sendairtime, cardaccept</b></p> $account = "account_example"; // string | Enter the Pesamoni account you would like to use for this transaction<p style=\"color:red\">This method applies for request method <b>paybills</b></p> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> $genericmsg = "genericmsg_example"; // string | Enter your user generated generic message for the requested transaction<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $token = "token_example"; // string | Enter your user generated token for the above mentioned method<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
向移动用户发送话费
$method = "sendairtime"; // string | Enter a request method. To check for request methods <a href=''>click here</a> $amount = "amount_example"; // string | Enter the amount you would like to send funds to. <p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, acsendbank, pesab2c, sendairtime, cardaccept</b></p> $mobile = "mobile_example"; // string | Enter the mobile number you would like to execute the above method in format 256.... or 254...<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, senderid, sendsms, sendairtime</b></p> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> $genericmsg = "genericmsg_example"; // string | Enter your user generated generic message for the requested transaction<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $token = "token_example"; // string | Enter your user generated token for the above mentioned method<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
向 Pesamoni 用户钱包发送
$method = "pesab2c"; // string | Enter a request method. To check for request methods <a href=''>click here</a> $amount = "amount_example"; // string | Enter the amount you would like to send funds to. <p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, acsendbank, pesab2c, sendairtime, cardaccept</b></p> $account = "account_example"; // string | Enter the Pesamoni account you would like to use for this transaction<p style=\"color:red\">This method applies for request method <b>paybills</b></p> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> $genericmsg = "genericmsg_example"; // string | Enter your user generated generic message for the requested transaction<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $token = "token_example"; // string | Enter your user generated token for the above mentioned method<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
支付公共事业账单
$method = "paybills"; // string | Enter a request method. To check for request methods <a href=''>click here</a> $amount = "amount_example"; // string | Enter the amount you would like to request for. <p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, acsendbank, pesab2c, sendairtime, cardaccept</b></p> $mobile = "mobile_example"; // string | Enter the mobile number you would like to execute the above method in format 256.... or 254...<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, senderid, sendsms, sendairtime</b></p> $currency = "currency_example"; // string | Enter the currency you intend to make the transaction for Visa/MasterCard based transactions<p style=\"color:red\">This method applies for request method <b>cardaccept</b></p> $account = "account_example"; // string | Enter the Pesamoni account you would like to use for this transaction<p style=\"color:red\">This method applies for request method <b>paybills</b></p> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> $genericmsg = "genericmsg_example"; // string | Enter your user generated generic message for the requested transaction<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $token = "token_example"; // string | Enter your user generated token for the above mentioned method<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $bouquet = "bouquet_example"; // string | Enter the bouquet or package you would like to pay for<p style=\"color:red\">This method applies for request methods <b>paybills</b></p> $payoption = "payoption_example"; // string | Enter your prefered payment option<p style=\"color:red\">This method applies for request methods <b>paybills</b></p> $meternumber = "meternumber_example"; // string | Enter the meter number for the intended payment<p style=\"color:red\">This method applies for request methods <b>paybills</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
检查交易状态
$method = "transactionstatus"; // string | Enter a request method. To check for request methods <a href=''>click here</a> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
检查您的 Pesamoni 商业钱包余额
$method = "acbalance"; // string | Enter a request method. To check for request methods <a href=''>click here</a> ry { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
向移动用户发送短信
$method = "sendsms"; // string | Enter a request method. To check for request methods <a href=''>click here</a> $mobile = "mobile_example"; // string | Enter the mobile number you would like to execute the above method in format 256.... or 254...<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, senderid, sendsms, sendairtime</b></p> $message = "message_example"; // # String | Enter your message <p style=\"color:red\">This method applies for request methods <b>sendsms</b></p> $reference = "reference_example"; // string | Enter your user generated transaction reference<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, transactionstatus, sendairtime, pesab2c, sendsms, cardaccept</b></p> $genericmsg = "genericmsg_example"; // string | Enter your user generated generic message for the requested transaction<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> $token = "token_example"; // string | Enter your user generated token for the above mentioned method<p style=\"color:red\">This method applies for request methods <b>acreceive, acreceivekeac, acsend, acsendkeac, sendsms, sendairtime, pesab2c, sendsms, cardaccept</b></p> try { $result = $apiInstance->transactionsPost($method, $amount, $mobile, $holdername, $cardnumber, $cvv, $exp, $currency, $account, $reference, $genericmsg, $token, $bouquet, $payoption, $meternumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->transactionsPost: ', $e->getMessage(), PHP_EOL; } ?>
API 端点文档
所有 URI 都相对于 https://pesamoni.com/api/live/v1
贡献
欢迎在 GitHub 上提交错误报告和拉取请求 https://github.com/Pesamoni。
许可证
Pesamoni php Api 库在 Apache License 2.0 许可证条款下作为开源软件提供。