Official PHP SDK for the RusWallet credit/installment API.

Maintainers

Package info

github.com/ruswallet/php-sdk

pkg:composer/ruswallet/sdk

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-06-20 15:38 UTC

This package is auto-updated.

Last update: 2026-06-20 16:03:21 UTC


README

Packagist Version Total Downloads PHP Version CI License

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:

  • AuthenticationException on 401/403
  • ValidationException on 422 (carries ->errors array)
  • ApiException on other 4xx/5xx
  • RusWalletException on 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.