heinzawhtet/myanpay

此包的最新版本(dev-master)没有提供许可证信息。

MyanPay 的 PHP 包

dev-master 2014-12-10 10:16 UTC

This package is not auto-updated.

Last update: 2024-09-28 15:59:58 UTC


README

MyanPay PHP 集成,操作简便。

安装

您可以通过两种方式安装此包。

通过 Composer PHP(推荐)

在终端中要求此包

composer require heinzawhtet/myanpay

或者在 composer.json 中要求此包并运行 composer update

{
    "require": {
        "heinzawhtet/myanpay": "dev-master"
    }
}

快速开始

首先设置您的 MyanPay API 凭据并向服务器发送请求。

	$items = [
		[
			'number' 	=> 'P001',
			'name' 		=> 'A pecial Birthday', 
			'ammount'	=> '1000',
			'quantity'	=> '1',
			'desc'		=> 'Hi Hi'
		],
		[
			'number' 	=> 'P002',
			'name' 		=> 'Spray oses', 
			'ammount'	=> '1000',
			'quantity'	=> '1',
			'desc'		=> 'Hi Hi'
		],
	];

	$pay = new Heinzawhtet\Myanpay\Myanpay;

	$pay->setApiUsername('API_USERNAME');
	$pay->setApiPassword('API_PASSWORD');
	$pay->setApiSignature('API_SIGNATURE');
	$pay->setDev(true); // if you are on development

	$pay->setHeaderImg('YOUR_BRAND_IMG_PATH');
	$pay->setCustomerServiceNumber('09 12345678');
	$pay->setBrandName('YOUR_STORE_NAME');

	$pay->setReturnUrl('https://:1200/return'); // Return Url when payment is ready to complete
	$pay->setCancelUrl('https://:1200/cancel'); // Cancel Url when payment is canceled

	return $pay->purchase(array( 'amount' => '2000' , 'items' => $items));

然后完成购买

	$pay = new Heinzawhtet\Myanpay\Myanpay;

	$pay->setApiUsername('_junio7482443442_myanpayAPI');
	$pay->setApiPassword('Z687FL3W036I06D0');
	$pay->setApiSignature('b98qL7734zo0Fw50mFP4u55p583bkLz44ZY524EMe5rO7hfdzlWq5AN2rx8d');
	
	$pay->setDev(true);

	$com = $pay->completePurchase(); // complete the purchase
	$detail = $pay->fetchDetail(); // fetch payment details such as buyer's email or shipping address

更多详细文档,即将推出。