pay2house/laravel-sdk

Laravel SDK for Pay2House payment gateway integration

dev-master 2025-06-07 09:36 UTC

This package is auto-updated.

Last update: 2025-06-07 09:36:55 UTC


README

Laravel package for Pay2House payment gateway integration.

Latest Version on Packagist Total Downloads

Installation

You can install the package via composer:

composer require espolin/pay2house-laravel-sdk

Configuration

Publish and edit the configuration file:

php artisan vendor:publish --provider="espolin\Laravel\Pay2HouseServiceProvider"

Add your Pay2House credentials to your .env file:

PAY2HOUSE_API_URL=https://api.pay2house.com
PAY2HOUSE_MERCHANT_ID=your_merchant_id
PAY2HOUSE_API_KEY=your_api_key
PAY2HOUSE_SECRET_KEY=your_secret_key
PAY2HOUSE_WEBHOOK_SECRET=your_webhook_secret

Usage

Payments

use espolin\Laravel\Facades\Pay2House;

// Create a payment
$payment = Pay2House::payments()->create([
    'amount' => 100.00,
    'currency' => 'RUB',
    'description' => 'Payment description',
    'return_url' => 'https://your-site.com/success',
    'cancel_url' => 'https://your-site.com/cancel',
]);

// Get payment details
$details = Pay2House::payments()->getDetails($payment->id);

Wallets

// Get wallets
$wallets = Pay2House::wallets()->getWallets();

// Create wallet
$wallet = Pay2House::wallets()->create([
    'currency' => 'RUB',
    'name' => 'My Wallet'
]);

// Get wallet statement
$statement = Pay2House::wallets()->getStatement($wallet->id, [
    'from' => '2024-01-01',
    'to' => '2024-01-31'
]);

Transfers

// Create transfer
$transfer = Pay2House::transfers()->create([
    'from_wallet_id' => 'wallet_123',
    'to_wallet_id' => 'wallet_456',
    'amount' => 50.00,
    'currency' => 'RUB',
    'description' => 'Transfer description'
]);

// Get transfer details
$details = Pay2House::transfers()->getDetails($transfer->id);

Cards

// Issue a card
$card = Pay2House::cards()->issue([
    'wallet_id' => 'wallet_123',
    'cardholder_name' => 'John Doe',
    'delivery_address' => [
        'country' => 'RU',
        'city' => 'Moscow',
        'address' => 'Red Square 1'
    ]
]);

// Top up card
$topup = Pay2House::cards()->topUp($card->id, [
    'amount' => 100.00,
    'currency' => 'RUB'
]);

Webhooks

The package automatically registers webhook routes. You can customize webhook handling by extending the WebhookController:

php artisan vendor:publish --tag=pay2house-controllers

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.