Ipay88 菲律宾支付网关模块

dev-master 2022-10-04 11:01 UTC

This package is auto-updated.

Last update: 2024-09-04 14:59:40 UTC


README

Build Status Join the chat at https://gitter.im/alvarezallen99/ipay88

Ipay88 菲律宾支付网关模块。

注意:您需要从 techsupport@ipay88.com.my 请求演示账户。

安装

我已经通过以下命令使此项目可通过 Composer 安装

composer require alvarezallen99/ipay88 dev-master

环境

IPAY88_URL="sandbox.ipay88.com.ph"
IPAY88_MERCHANT_CODE="IPAY88_MERCHANT_CODE"
IPAY88_MERCHANT_KEY="IPAY88_MERCHANT_KEY"

示例控制器

<?php

class Payment {

	protected $merchantCode;
	protected $merchantKey;
    	protected $payment_response;
    	protected $backend_response;

	public function __construct()
	{
		parent::__construct();
		$this->merchantCode = env('IPAY88_MERCHANT_CODE'); //MerchantCode confidential
		$this->merchantKey = env('IPAY88_MERCHANT_KEY'); //MerchantKey confidential
		$this->payment_response = 'http://example.com/response';
        	$this->backend_response = 'http://example.com/backend';
	}

	public function index()
	{
		$request = new IPay88\Payment\Request($this->merchantKey);
		$this->_data = array(
			'merchantCode' => $request->setMerchantCode($this->merchantCode),
			'paymentId' =>  $request->setPaymentId(1),
			'refNo' => $request->setRefNo('EXAMPLE0001'),
			'amount' => $request->setAmount('0.50'),
			'currency' => $request->setCurrency('MYR'),
			'prodDesc' => $request->setProdDesc('Testing'),
			'userName' => $request->setUserName('Your name'),
			'userEmail' => $request->setUserEmail('email@example.com'),
			'userContact' => $request->setUserContact('0123456789'),
			'remark' => $request->setRemark('Some remarks here..'),
			'lang' => $request->setLang('UTF-8'),
			'signature' => $request->getSignature(),
			'responseUrl' => $request->setResponseUrl($this->payment_response),
			'backendUrl' => $request->setBackendUrl($this->backend_response)
			);

		IPay88\Payment\Request::make($this->merchantKey, $this->_data);
	}

	public function response()
	{
		$response = (new IPay88\Payment\Response)->init($this->merchantCode);
		echo "<pre>";
		print_r($response);
	}
}

致谢

Leow Kah Thong

Fikri Marhan

Pijoe

aa6my

参考资料

https://github.com/cchitsiang/ipay88

https://github.com/fastsafety/ipay88

许可证

MIT © Karyamedia。请参阅 许可证文件 获取更多信息。