ruswallet/sdk
Composer 安装命令:
composer require ruswallet/sdk
包简介
Official PHP SDK for the RusWallet credit/installment API.
README 文档
README
Official PHP SDK for the RusWallet credit/installment API. Targets PHP 8.2+ and uses Guzzle for HTTP.
composer require ruswallet/sdk
Quick start
use RusWallet\Sdk\Client; use RusWallet\Sdk\DTO\CreateApplicationRequest; use RusWallet\Sdk\DTO\Customer; use RusWallet\Sdk\DTO\Item; use RusWallet\Sdk\Enums\CreditType; use RusWallet\Sdk\Enums\ItemType; $ruswallet = new Client( apiKey: getenv('RUSWALLET_API_KEY'), baseUrl: 'https://api.ruswallet.ru', ); $response = $ruswallet->createApplication(new CreateApplicationRequest( orderId: 'SHOP-12345', items: [ new Item('iPhone 15 Pro 256GB', 119990, 1, ItemType::Product), ], formSuccessUrl: 'https://shop.example.ru/order/12345/thanks', creditType: CreditType::Installment, // or CreditType::Credit; default installment customer: new Customer( phone: '+79991234567', firstName: 'Иван', lastName: 'Иванов', ), )); header('Location: ' . $response->redirectUrl()); exit;
If customer is omitted, the response will contain customer_form_url — that
URL is the RusWallet hosted form where the user enters their PII (two-phase
flow). redirectUrl() automatically prefers it.
Authentication
Pass your partner's server API key. Never use the widget public key
(pk_…) from server-side code: that's the browser-safe key, not the secret one.
Errors
The SDK throws:
AuthenticationExceptionon 401/403ValidationExceptionon 422 (carries->errorsarray)ApiExceptionon other 4xx/5xxRusWalletExceptionon network errors
Development
composer install
composer test
composer analyse
See CONTRIBUTING.md for conventions and CHANGELOG.md for release notes.
License
Released under the MIT License.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-20