ruswallet / sdk
Official PHP SDK for the RusWallet credit/installment API.
v0.1.0
2026-06-20 15:38 UTC
Requires
- php: ^8.2
- ext-json: *
- guzzlehttp/guzzle: ^7.5
- psr/http-client: ^1.0
- psr/http-message: ^1.1 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.50
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.5
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.