定制 ruswallet/sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ruswallet/sdk

Composer 安装命令:

composer require ruswallet/sdk

包简介

Official PHP SDK for the RusWallet credit/installment API.

README 文档

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.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-20