aimtoget/aimtoget-agent-lib

Aimtoget代理的PHP库

0.1.9 2023-11-29 06:51 UTC

README

Aimtoget API的PHP封装器

安装

使用composer

composer install aimtoget/aimtoget-agent-lib

通过包含 autoload.php 文件将库添加到您的PHP代码中

require_once "__DIR__/aimtoget-agent-lib/autoload.php";

用法

  • 配置:您需要使用您的私钥和钱包PIN初始化配置(请始终记住将您的私钥保持 私密!!!
<?php

use Aimtoget\Agent\Config;

$config = new Config('--Secret key--', '--Wallet Pin--');

现在可以使用此配置来使用其他方法。

  • 检索您的钱包余额
<?php

use Aimtoget\Agent\Account;

$account = new Account($config);
echo $account->getBalance();
  • 空中购买:
<?php

use Aimtoget\Agent\Airtime;

$airtime = new Airtime($config);

//Purchase NGN100 Airtime
$reference = $airtime->purchase([
    'phone' => '09061668519',
    'network_id' => 1,
    'amount' => 100
]);
  • 获取所有网络:这是空中购买和购买数据所必需的
<?php

use Aimtoget\Agent\Networks;

$networks = new Networks($config);
$all_networks = $networks->getAllNetworks();
  • 获取所有数据计划:购买数据所必需的
<?php

use Aimtoget\Agent\Data;

$data = new Data($config);

//All Plans
$all = $data->getAllVariations();

//Retrieve plans for a certain network
$plans = $data->getNetworkVariations($network_id);
  • 购买数据
//Purchase 1GB of MTN data
$reference = $data->purchase([
    'phone' => '09061668519',
    'network_id' => 1,
    'variation' => 'M1024'
]);
  • 支付账单与服务
<?php

use Aimtoget\Agent\Services;

$services = new Services($config);

//Get all services
$all = $services->getAll();

检索服务数据与变化

$service = $services->getService($service_id);

验证服务客户

$verify = $services->verifyCustomer($service_id, $customer_id);

购买服务

$reference = $service->pay($service_id, [
    'customer_id' => $customer_id,
    'amount' => $amount, //For services WITHOUT variations,
    'variation' => $variaiton, //For services WITH variations,
    'phone' => $customer_phone,
    'email' => $customer_email
 ]);

银行转账

  • 获取所有银行
<?php

use Aimtoget\Agent\BankTransfer;

$bank = new BankTransfer($config);

//Get banks
$banks = $bank->getBanks();
  • 解析账户详情
<?php

use Aimtoget\Agent\BankTransfer;

$bank = new BankTransfer($config);
$account_name = $bank->resolveAccount('-bank code--', '-account number-');

echo $account_name;
  • 执行银行转账
<?php

use Aimtoget\Agent\BankTransfer;

$bank = new BankTransfer($config);
$reference = $bank->transfer([
    'amount' => 2000,
    'bank_code' => '00007',
    'account_number' => '0123456789',
    'description' => 'Transfer narration'
]);

echo $reference;

交易详情

  • 检索您的交易

使用我们的API获取所有交易的列表

<?php

use Aimtoget\Agent\Transactions;

$transactions = new Transactions($config);
$list = $transactions->getTransactions(); //Fetches first 10 transactions

获取单个交易的详情

$details = $transactions->getTransaction($reference_code);

对于任何问题或投诉,请通过 developer@aimtoget.com 联系我们