ericmuigai/pesapal

该软件包最新版本(dev-master)没有可用的许可信息。

这是一个 Laravel 5 的 Pesapal 软件包。请先测试后再部署。

dev-master / 3.0.x-dev 2015-12-26 15:51 UTC

This package is auto-updated.

Last update: 2024-09-10 16:34:14 UTC


README

简介

这是一个 Laravel 5.* 的 pesapal 软件包。我提供这个软件包是为了帮助那些没有为 Laravel 提供软件包的用户。由于 Pesapal 没有提供测试方法,所以您可能需要发送货币支付来测试。如果您需要任何帮助,请随时联系我。

对于 Laravel 4.2

安装

在您的 composer.json 中添加
"ericmuigai/pesapal": "3.0.x-dev"
然后
composer update
这将安装软件包。一旦安装完成,请将
'Ericmuigai\Pesapal\PesapalServiceProvider',
添加到提供者中。之后,通过以下方式发布配置文件
php artisan config:publish ericmuigai/pesapal
然后使用以下方式迁移软件包表
php artisan vendor:publish
访问您的 Pesapal 账户,并在 ipn url 中输入
yoursite.com/listenipn
或或您公开路径/listenipn 的 url
现在您应该在
config/pesapal.php 

配置

这是您应该在 config.php 中看到的内容
/**
 * this settings are needed in order to work with pesapal
 * enabled(bool) -if true sets the pesapal to live instead of demo website that was not functioning at the time of writing this package
 * consumer_key the consumer key gotten from the pesapal website
 * consumer_secret- The consumer secret gotten from the pesapal website.
 * controller - This is the controller that will be called if the status is valid. A method updateItem($key, $pesapal_merchant_reference) will be called.
 * please note the method that will be called will be updateItem and should be static that is update($key,$reference)
 * Key- the key to protect the method from being called elsewhere
 * redirectTo - the link to where your thankyou page is
 * email - Your email address where you will be emailed on complete transaction
 * name - your name
 * currency - the currency that will be used on payment
 *
 */
return array(
'enabled' => true,
'consumer_key' => "",
'consumer_secret'=>"",
'controller'=>"YourController",
'key'=>"12345",
'redirectTo'=>"/",
'email'=>"your@email.com",
'mail'=>true,
'name'=>"Admin",
'currency'=>"KES",

);

输入正确的信息后,您现在就可以设置了。

如何使用

现在您应该能够在任何您希望出现 iframe 的视图中调用
Pesapal::Iframe($array)
数组中应包含以下信息
$array
/**
     * generates the iframe from the given details
     * @param array $values this array should contain the fields required by pesapal
     * description - description of the item or service
     * currency - if set will override the config settings you have of currency
     * user -which should be your client user id if you have a system of users
     * first_name- the first name of the user that is paying
     * last_name - the last name of the user that is paying
     * email - this should be a valid email or pesapal will throw an error
     * phone_number -which is optional if you have the email
     * amount - the total amount to be posted to pesapal
     * reference Please Make sure this is a unique key to the transaction. An example is the id of the item or something
     * type - default is MERCHANT
     * frame_height- this is the height of the iframe please provide integers as in 900 without the px
     *
     */'
     

作者

Eric Muigai - http://www.hot254.co.ke

许可

根据 MIT 许可证授权