承接 vas2nets/b2bapi 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vas2nets/b2bapi

最新稳定版本:v1.0.0

Composer 安装命令:

composer require vas2nets/b2bapi

包简介

An SDK for interacting with B2b APIs using Basic Authentication

README 文档

README

  • This sdk is available for PHP Appliocation with a version not less than 7.0 version.

Description

This is software developlent kit(SDK) which user/client can consume via composer and have access to VAS2Nets b2b web services. Please note that categories(),billers() and bouquetService() methods needs to be called to know services that has been profiled for client/user's account as well as services that are bouquet oriented. i.e biller services that comes with their fixed amount and has thier own bouquet code respectively. Please note that this bouquet code will require during when you are calling pay() method for this particular service purchase.

Also note that the status in response payload comes wit three value which could either be Failed, Success or Pending. when a status value is pending, there is a method named requery() which you have to call to get the final status which could either be Failed or Success. you will find this example at the last item on this documentation.

when you call the categories method, you will see all categories available on b2b web services. Please use their category_id value for any biller profiled for your account that you want to validate or purchase under this category.Follow the following guide for proper use of the kit

  • Example of biller ids are MTN-AIRTIME, AIRTEL-AIRTIME, DSTV, IKEJA-PREPAID etc.

    • Example of category ids are disco,vtu,tv etc.

you can call categories() and billers() methods to know categories and billers which has been profiled for your account respectively. if you pass true as a third argument to billers method, you will get all billers available on b2b platform

Please note that the validate() call to one of the biller services must be successfull before calling pay method(), otherwise it will not make pay() method call to be successfull.

  1. Requirement

  • You have to be profiled on vas2nets b2b platform and your test api username and password will be sent to you.
  • Your Environmental IP to which you are accessing the sdk must be whitelisted in the backoffice portal. this portal login credentials would be share with you after profiling you on the playform.
  • There is a sandbox credentials to use throughout the integration, however, you must credit your wallet to have access to the live web services on the platform.
  1. Installation

1.1. install composer first before you run the following in your IDE or Terminal project root

	composer require vas2nets/b2bapi
  1. Getting Started

       use VAS2Nets\B2b\B2b;

       use VAS2Nets\B2b\Exceptions\B2bException;

follow the following B2b and B2bException Classes Example usage.

    $b2b = B2b::client($username,$password,true);

The client() method is called statistically and do not pass anything as the third argument if you are in sandbox environment. Like this

    $b2b = B2b::client($username,$password);

You can use the B2bException like the follwoing

 try {
		$validation_respinse = $b2b->validation('vtu', array('customerId' => '08027618122', 'requestId' => 129394873));
		print_r($validation_respinse);

 } catch (B2bException $e) {
            echo $e->getMessage();
   }

3.1 Get User Profile

 $b2b->profile();

3.2 Get User Service categories

    $b2b->categories();

3.3 Get User Service categories

    $b2b->categories();

3.4 Get All Available Billers in VAS2Nets b2b platform.

Fourt argumnent can be either Active, Inactive or Disabled to get status of all billers fifth argument is Yes or No , this indicate whether you want to get bouquet service or non bouquet service.

$b2b->billers
(
	" ",
	" ",
	true
	'Active|Inactive|Disabled',
	'Yes|No',
);

3.5 Get User Profiled Billers in b2b platform

$b2b->billers
(
	category_id,
	billerId,
);

3.6 Get User Bouquet Service

$b2b->bouquetService
(
category_id,
billerId
);
  1. Validation and Payment method are the same for all b2b web services, what differ is the payload data argument passing to the methods which is type of an array

4.1 Generic Validation and make payment methods Formats.

	$b2b->validation(
	{category_id},
	payload(values...)
	);
	$b2b->pay(
	{category_id},
	payload(values..)
	);
  • Sample Payload Data to Validate Airtime and Data
$payload = [
            customerId => '2348132586075', 
            requestId => '4292'
];
  • The customerid is the user phone number and could be in any format like 2348027839144 or 08027839144.

  • This request is generated from third party platform.

  • Sample Payload Data to make Payment for Airtime

  $payload = [
		customerId => '08132586075',
		requestId =>'4923392', 
		'billerId'=> 'MTN-AIRTIME',
		'amount' => 100,
         ];
  • Sample Payload to Make payment for Data and any bouquet service like DSTV, GOTV, etc
  $payload = [
		customerId => '08132586075',
		requestId =>'4923392', 
		'billerId'=> 'MTN-AIRTIME',
		'amount' => 100,
		'bouquetCode' => 'MTN100MB1Day100'
         ];

Please note that bouquetCode is included when a payment is only to make to bouquet service like DSTV, DATA etc.

  • Sample Payload Data to Validate Disco meter or account number, please note that customerId could be meter number or account number
$payload = [
			customerId = '12345678910',
			requestId ='39293995425', 
			'billerId'=> 'AEDCA')
	       ]
  • Sample Payload to Make Payment for Disco Service
	$payload = [
					customerId = '12345678910',
					requestId ='492949392', 
					'billerId'=> 'IBEDCA',
					'amount' = 1500,
					'customerName'=>'CLIFFORD NWIGWE',
					'customerAddress'=>'NYSC AREA 5 Und St. Garki 80'
                ];
  • Sample Payload to validate tv smartcard number or UIC Number, please note that customerId could be Smart Card number or UIC Number
		$payload = [
					customerId = '7030935900',
					requestId ='48294929492', 
					'billerId'=> 'DSTV'
                    ];
  • Sample Payload to make payment for tv category
		$payload = [
					customerId = '7030935900',
					requestId ='59385823582', 
					'billerId'=> 'DSTV',
					'amount' = 10450,
					'customerName'=>'Sten Mockett',
					'bouquetCode' => 'DSTVCNFM',
					'customerNumber' =>'71048760',
					'addonCode' => 'FRN11E36'
                    ];

Please note that customer can choose to select addon for a particular package and vice-versa, addonCode is the code to addon that customer wants. And bouquet is only available on DSTV/GOTV.

DSTVR/GOTVR are DSTV Renewal and GOTV Renewal Respectively, these service should be available to the user that wants to renew their current package. And Multichoice sometimes gives commission to their customers and these customers can only benefits from these commissions through the renewal service. i.e a field should always availbe for user to enter a specific amount to top up their package. Startimes is also a bouquet service. However,startimes gives room for their customer to pay any amount of their choice at any time, and startimes will charge the customer a daily tariff depending on the bouquet the customer is subscribed to.

  • Sample Payload data for ShowMax Voucher Purchase
	$payload  =	[
				customerId = '08132586075',
				requestId ='49394958245', 
				'billerId'=> 'SHOWMAX',
				'amount' = 11880,
				'bouquetCode' => 'SHOWMAXPRO3MONTH'
           ];
  • Sample Payload to Validate betting

      	$payload = [
      	customerId = '34382',
      	requestId ='4994924203', 
      	'billerId'=> 'BT9J'
         ];
  • Sample Payload to make payment for betting category

	$payload =[
		customerId = '34382',
		requestId ='49394924544', 
		'billerId'=> 'BT9J',
		'amount' = 1000,
		'customerName'=>'Test Account 2'
      ];
  • Sample Payload to Validate customer id for internet category
	$payload  =	[
		customerId = '1402000567',
		requestId ='5939395923', 
		'billerId'=> 'SMILE'
      ];
  • Sample Payload to make payment for internet category
		$payload = [
		customerId = '1402000567',
		requestId ='385929522', 
		'billerId'=> 'SMILE',
		'amount' = 1200,
		'customerName'=>'Olumide Pablo'),
		'bouquetCode'=>'SMILE2GB30Days'),
		'customerAddress'=>'isolo'
         ];
  • Sample Payload to Validate customer account number for payment service.
		$payload  = [
		customerId = '3057071087',
		requestId ='32932', 
		'billerId'=> 'FTOUTWARD')
		'bankCode'=> '000016'
        ];
  • Sample Payload to make payment in banking service
		$payload = [
		customerId = '3057071087',
		requestId ='5939949593', 
		'billerId'=> 'FTOUTWARD',
		'amount' => 1000,
		'bankCode'=> '000016',
		'customerName'=>'Gabriel Oluwadamilare Oyetunde'),
		'senderName'=>'Chika Ladipo',
		'beneficiaryReference'=>'22000000089',
		'sessionId'=>'110015231101103400123486131462',
		'kycLevel'=>'3',
		'narration'=>'New B2B test'
        ];
  • Sample Payload to make payment in Education Category
		$payload  = [
		'requestId' =>'49392', 
		'billerId'=> 'WAEC',
		'amount' => 2900,
		'bouquetCode'=> 'WAECPIN'
         ];
  • Sample Payload to make payment in banking service
		$payload =[
		requestId =>'3949219', 
		'billerId'=> 'MTN-VOUCHER',
		'amount' => 100,
		'bouquetCode'=> 'EPINMTN100'
         ];
  1. Requery payload for pending transactions.
		$b2b->requery([
		'requestId' => '299492939955'
		]);

Please note that the requestId is a transaction request id that previously in pending status after a pay method is called.It advisable to called this method every 10 minutes to ascertain the final statis which could either be Success or Failed.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-10