evp/paysera-wallet-php-client
Composer 安装命令:
composer require evp/paysera-wallet-php-client
包简介
PHP client for Paysera.com Wallet API
README 文档
README
This is repository for PHP client, used with Paysera.com Wallet API.
OAuth example
<?php // setup autoloader for Paysera Wallet API library require_once '../../lib-wallet-php-client/src/Paysera/WalletApi/Autoloader.php'; Paysera_WalletApi_Autoloader::register(); // credentials for API $clientId = 'CLIENT_ID'; // $secret - shared secret to use in MAC auth $secret = 'SECRET'; // or information about certificate to use in SSL auth //$secret = Paysera_WalletApi_Http_ClientCertificate::create() // ->setCertificatePath('/path/to/cert.crt') // ->setPrivateKeyPath('/path/to/private.key'); // create main object to use for all functionality $api = new Paysera_WalletApi($clientId, $secret); // for sandbox environment, use the following code instead: // $api = new Paysera_WalletApi($clientId, $secret, Paysera_WalletApi_Util_Router::createForSandbox()); // get service, responsible for OAuth code grant type integration $oauth = $api->oauthConsumer(); // example how to get ask and get information about paysera.com user session_start(); try { if (!isset($_SESSION['token'])) { // no token in session - let's get the token $token = $oauth->getOAuthAccessToken(); // this gets code query parameter if available and exchanges for token if ($token === null) { // no code parameter - redirect user to authentication endpoint $redirectUri = null; // URL of this file; it's optional parameter header('Location: ' . $oauth->getAuthorizationUri(array( // scopes are optional, no scope allows to get user ID/wallet ID Paysera_WalletApi_OAuth_Consumer::SCOPE_EMAIL, // to get user's main email address // Paysera_WalletApi_OAuth_Consumer::SCOPE_IDENTITY, // this scope allows to get personal code, name and surname // Paysera_WalletApi_OAuth_Consumer::SCOPE_FULL_NAME, // use this scope if only name and surname is needed // Paysera_WalletApi_OAuth_Consumer::SCOPE_IDENTITY_OFFLINE, // this allows to get identity by user ID, after token has expired, using API, not related to token ), $redirectUri)); } else { $_SESSION['token'] = $token; } } if (isset($_SESSION['token'])) { $tokenRelatedClient = $api->walletClientWithToken($_SESSION['token']); echo '<pre>'; $user = $tokenRelatedClient->getUser(); var_dump($user); // $user->getId(); // you can save user ID (on paysera.com), user's email etc. // var_dump($api->walletClient()->getUserIdentity($userId)); // if you have offline scope, you can get info by user ID later echo '</pre>'; $_SESSION['token'] = $tokenRelatedClient->getCurrentAccessToken(); // this could be refreshed, re-save } } catch (Exception $e) { echo '<pre>', $e, '</pre>'; }
Contacts
If you have any further questions feel free to contact us:
„Paysera LT“, UAB
Pilaitės pr. 16
LT-04352 Vilnius
Email: info@paysera.lt
Tel. +37052071558
evp/paysera-wallet-php-client 适用场景与选型建议
evp/paysera-wallet-php-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 150.29k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2013 年 07 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 evp/paysera-wallet-php-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 evp/paysera-wallet-php-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 150.29k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 18
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2013-07-01