cullylarson/paypal-experience-cli
Composer 安装命令:
composer require cullylarson/paypal-experience-cli
包简介
A set of command-line tools for managing 'web experience profiles' in Paypal.
关键字:
README 文档
README
A set of command-line tools for managing "web experience profiles" in Paypal.
PayPal now allows you to customize the payment experience your customers have, when they go to PayPal to make a payment (what used to be called Express Checkout). To do this, you need to create web experience profiles in PayPal, using their new REST API. It's stupid. I don't know why they don't just let you do that in your Developer Dashboard, but it's the way it is. This is a simple command line tool that allows you to Create, List, Update, and Remove experience profiles. I hope it saves some of you the headache of having to implement something yourself.
- PayPal REST API: https://developer.paypal.com/docs/api/
- PayPal PHP SDK: https://github.com/paypal/PayPal-PHP-SDK
Install
curl -s http://getcomposer.org/installer | php
php composer.phar require cullylarson/paypal-experience-cli
Configuration
Configuration is done using environment variables. You can set these yourself, or set them in a .env file (https://github.com/vlucas/phpdotenv) which the experience commands will load automatically. An example file is provided, named .env.dist. You can just copy it and set appropriately. If you want to use the .env file, it needs to be in the directory from which you are going to run commands. If you want to set the environment variables yourself, just look at the .env.dist file to see which ones you need to set.
Profiles
You'll need to create some Profile classes. These define the experience profile you'd like to create in Paypal. They must extend \PayPal\ExperienceCli\Profile, and must at least implement the GetProfileName function. There are a couple examples in the sample-profiles directory.
Create a directory for your profiles, and put them in there. Then set PAYPAL_EXPERIENCE_CLI_PROFILES_DIR in your .env file to this directory.
A few of the commands ask for a profile name. This is the class name of your profile, without the namespace (though, a namespace can be provided as another argument). It also needs to be the name of the PHP file that contains the class (without the .php extension). For example, if you put your profiles in a directory named profiles, and you created a profile class named MyFirstProfile, then that class needs to be defined in the profiles/MyFirstProfile.php file.
Commands
create-experience-profile
Create a web experience profile in PayPal.
USAGE
> php ./vendor/bin/create-experience-profile PROFILE_CLASS_NAME [PROFILE_NAMESPACE]
ARGUMENTS
- PROFILE_CLASS_NAME (required) -- The name of your class (e.g.
MyFirstProfile). Don't include the .php extension. - PROFILE_NAMESPACE (optional) -- If your profile class has a namespace, provide it here (e.g.
"\\My\\Favorite\\Namespace"). Don't include a final\(it won't work).
list-experience-profiles
List all of the web experience profiles you have in PayPal.
USAGE
> php ./vendor/bin/list-experience-profiles
update-experience-profile
Update a web experience profile in PayPal. You can do this by first editing the Profile class you originally used to create this experience profile, or you can create a new class and just pass it as an argument. Basically any changes to the class will be sent to PayPal.
USAGE
> php ./vendor/bin/update-experience-profile EXPERIENCE_PROFILE_ID PROFILE_CLASS_NAME [PROFILE_NAMESPACE]
ARGUMENTS
- EXPERIENCE_PROFILE_ID (required) -- The web experience profile ID of the profile you'd like to modify. You can get this by listing your profiles.
- PROFILE_CLASS_NAME (required) -- The name of your class (e.g.
MyFirstProfile). Don't include the .php extension. Info from this class will be used to update your experience profile in PayPal. - PROFILE_NAMESPACE (optional) -- If your profile class has a namespace, provide it here (e.g.
"\\My\\Favorite\\Namespace"). Don't include a final\(it won't work).
remove-experience-profile
Remove a web experience profile from PayPal.
USAGE
> php ./vendor/bin/remove-experience-profile EXPERIENCE_PROFILE_ID
ARGUMENTS
- EXPERIENCE_PROFILE_ID (required) -- The web experience profile ID of the profile you'd like to remove. You can get this by listing your profiles.
Example of Everything
1. Create a directory for your profiles.
> mkdir profiles
2. Set the directory in your .env file.
PAYPAL_EXPERIENCE_CLI_PROFILES_DIR="profiles"
3. Create a MyFirstProfile.php file in your profiles directory.
> touch profiles/MyFirstProfile.php
4. Edit your MyFirstProfile.php file.
<?php
namespace My\Preferred\Namespace; // not necessary to namespace your profiles
use PayPal\ExperienceCli\Profile;
class MyFirstProfile extends Profile {
public function GetProfileName() { return "This Needs to be Unique"; }
public function GetBrandName() { return "My Business"; }
public function GetLogoUrl() { return "https://www.google.com/images/srpr/logo11w.png"; }
}
5. Create this experience profile in Paypal.
> php ./vendor/bin/create-experience-profile MyFirstProfile "\\My\\Preferred\\Namespace"
6. List the experience profiles you have in Paypal, to see your new profile.
> php ./vendor/bin/list-experience-profiles
7. Update your profile, by first editing your profiles/MyFirstProfile.php file and making some changes.
<?php
// no more namespace
use PayPal\ExperienceCli\Profile;
class MyFirstProfile extends Profile {
public function GetProfileName() { return "This Needs to be Unique"; }
public function GetBrandName() { return "My Better Business Name"; }
// no more logo
}
8. Now run the update command. It will pull the changes from your MyFirstProfile class and send them to Paypal.
> php ./vendor/bin/update-experience-profile THE-EXPERIENCE-PROFILE-ID-FROM-LIST MyFirstProfile
9. Remove the profile from Paypal.
> php ./vendor/bin/remove-experience-profile THE-EXPERIENCE-PROFILE-ID-FROM-LIST
cullylarson/paypal-experience-cli 适用场景与选型建议
cullylarson/paypal-experience-cli 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 02 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「paypal」 「profile」 「experience」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cullylarson/paypal-experience-cli 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cullylarson/paypal-experience-cli 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cullylarson/paypal-experience-cli 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PayPal SDK for ExpressCheckout and AdaptivePayments. Supports recurring payments, simple payments, parallel payments and chained payments.
A module for Pluf to manage user profiles and user accounts
A PayPal IPN (Instant Payment Notification) listener for PHP
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
The Flarum extension that allows users to private their profiles.
Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-03