yzh52521/think-omnipay 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

yzh52521/think-omnipay

最新稳定版本:v1.0.5

Composer 安装命令:

composer require yzh52521/think-omnipay

包简介

Integrates Omnipay with thinkphp and provides an easy configuration.

README 文档

README

Total Downloads Latest Version

Integrates the Omnipay PHP library with Laravel to make Configuring multiple payment tunnels a breeze!

Installation

Include the laravel-omnipay package as a dependency in your composer.json:

composer require yzh52521/think-omnipay

Note: You don't need to include the omnipay/common in your composer.json - it has already been included think-omnipay.

Install Required Providers

Now just include each gateway as you require, to included PayPal for example:

composer require omnipay/paypal "3.*"

Alternatively you can include every gateway by the following:

composer require omnipay/omnipay "3.*"

Note: this requires a large amount of composer work as it needs to fetch each seperate repository. This is not recommended.

Configuration

PayPal Express Example

Here is an example of how to configure password, username and, signature with paypal express checkout driver

...
'gateways' => [
    'paypal' => [
        'driver'  => 'PayPal_Express',
        'options' => [
            'username'  => 'coolusername',
            'password'  => 'strongpassword',
            'signature' => '',
            'solutionType' => '',
            'landingPage'    => '',
            'headerImageUrl' => '',
            'brandName' =>  'Your app name',
            'testMode' => true
        ]
    ],
]
...

Usage

$cardInput = [
	'number'      => '4444333322221111',
	'firstName'   => 'MR. WALTER WHITE',
	'expiryMonth' => '03',
	'expiryYear'  => '16',
	'cvv'         => '333',
];

$card = \ThinkOmnipay\Facade::creditCard($cardInput);

$response = \ThinkOmnipay\Facade::purchase([
	'amount'    => '100.00',
	'returnUrl' => 'http://bobjones.com/payment/return',
	'cancelUrl' => 'http://bobjones.com/payment/cancel',
	'card'      => $cardInput
])->send();

dd($response->getMessage());

This will use the gateway specified in the config as default.

However, you can also specify a gateway to use.

\ThinkOmnipay\Facade::setGateway('paypal');

$response = \ThinkOmnipay\Facade::purchase([
	'amount' => '100.00',
	'card'   => $cardInput
])->send();

dd($response->getMessage());

In addition you can make an instance of the gateway.

$gateway = \ThinkOmnipay\Facade::gateway('paypal');

License

This package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-21