bitcko/yii2-bitcko-paypal-api
Composer 安装命令:
composer require bitcko/yii2-bitcko-paypal-api
包简介
Bitcko Yii2 Paypal Api Extension use to integrate Paypal payments in your project using Paylpal php SDK
关键字:
README 文档
README
Yii2 Bitcko PayPal Api extension use to integrate simple PayPal payment in your website.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require bitcko/yii2-bitcko-paypal-api:dev-master
or add
"bitcko/bitcko/yii2-bitcko-paypal-api": "dev-master"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
- Create developer account in PayPal and then create an app. PayPal Developer Dashboard.
- Copy and paste the client Id and client secret in params.php file that exists in app config directory:
<?php return [ 'adminEmail' => 'admin@example.com', 'payPalClientId'=>'app client id here', 'payPalClientSecret'=>'app client secret here' ];
- Configure the extension in components section in web.php file exists in app config directory:
<?php 'components'=> [ ... 'PayPalRestApi'=>[ 'class'=>'bitcko\paypalrestapi\PayPalRestApi', 'redirectUrl'=>'/site/make-payment', // Redirect Url after payment ] ... ]
- Controller example: call first the checkout action that will redirect you to the redirectUrl you mentioned in the previous step, in this example ("/site/make-payment")
<?php namespace app\controllers; use Yii; use yii\web\Controller; class SiteController extends Controller { public function actionCheckout(){ // Setup order information array with all items $params = [ 'method'=>'paypal', 'intent'=>'sale', 'order'=>[ 'description'=>'Payment description', 'subtotal'=>44, 'shippingCost'=>0, 'total'=>44, 'currency'=>'USD', 'items'=>[ [ 'name'=>'Item one', 'price'=>10, 'quantity'=>1, 'currency'=>'USD' ], [ 'name'=>'Item two', 'price'=>12, 'quantity'=>2, 'currency'=>'USD' ], [ 'name'=>'Item three', 'price'=>1, 'quantity'=>10, 'currency'=>'USD' ], ] ] ]; // In this action you will redirect to the PayPpal website to login with you buyer account and complete the payment Yii::$app->PayPalRestApi->checkOut($params); } public function actionMakePayment(){ // Setup order information array $params = [ 'order'=>[ 'description'=>'Payment description', 'subtotal'=>44, 'shippingCost'=>0, 'total'=>44, 'currency'=>'USD', ] ]; // In case of payment success this will return the payment object that contains all information about the order // In case of failure it will return Null return Yii::$app->PayPalRestApi->processPayment($params); } }
bitcko/yii2-bitcko-paypal-api 适用场景与选型建议
bitcko/yii2-bitcko-paypal-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.19k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 07 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「payment」 「extension」 「paypal」 「yii2」 「PayPal API」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bitcko/yii2-bitcko-paypal-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bitcko/yii2-bitcko-paypal-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bitcko/yii2-bitcko-paypal-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
UI Kit 3 Extension for Yii2
Adds more BBCode
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 9.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-07-04