shahzad/revolut-merchant-api
最新稳定版本:1.0.0
Composer 安装命令:
composer require shahzad/revolut-merchant-api
包简介
Laravel package for integrating with Revolut Merchant API
README 文档
README
A comprehensive Laravel package for the Revolut Merchant API, providing a clean and intuitive interface for payment processing, order management, and merchant operations.
Features
- 💳 Complete Payment Processing: Create orders, process payments, handle refunds
- 🏪 Merchant Management: Locations, Apple Pay domains, webhook configuration
- 📊 Reporting: Generate settlement reports, payout statements, custom reports
- ⚖️ Dispute Handling: Manage payment disputes and evidence submission
- 🔄 Payout Management: Track payouts and manage beneficiary accounts
- 🧪 Webhook Testing: Test synchronous webhooks for all event types
- 🔒 Secure & Reliable: Built-in error handling, validation, and retry mechanisms
- 🎯 Developer Friendly: Clean API, comprehensive tests, and detailed documentation
Requirements
- PHP 8.1 or higher
- Laravel 10.0, 11.0, or 12.0
- Composer
- ext-json extension
- ext-curl extension
Installation
Install via Composer:
composer require shahzad/revolut-merchant-api
Quick Start
Laravel Service Provider (Auto-discovered)
The package will be auto-discovered by Laravel. Simply install and you're ready to go!
Using the Facade
use RevolutMerchant; // Create a payment order $order = RevolutMerchant::orders()->create([ 'amount' => 2500, // €25.00 in cents 'currency' => 'EUR', 'description' => 'Premium Subscription', 'merchant_order_id' => 'ORDER-12345' ]); echo "Order created: {$order['id']}\n"; echo "Checkout URL: {$order['checkout_url']}\n"; // Retrieve order details $orderDetails = RevolutMerchant::orders()->find($order['id']); echo "Order status: {$orderDetails['state']}\n";
Using Dependency Injection
use Shahzad\RevolutMerchantApi\RevoltMerchantClient; class PaymentController extends Controller { public function createOrder(RevoltMerchantClient $client) { $order = $client->orders()->create([ 'amount' => 2500, 'currency' => 'EUR', 'description' => 'Premium Subscription', 'merchant_order_id' => 'ORDER-12345' ]); return response()->json($order); } }
Configuration
Authentication
This package uses Secret Key authentication with the Revolut Merchant API. You need to obtain your secret key from your Revolut Merchant Dashboard.
Important: The package has been updated to use secret_key instead of the deprecated api_key for better security and compatibility with Revolut's latest API requirements.
Environment Variables
REVOLUT_SECRET_KEY=your_secret_key_here REVOLUT_MERCHANT_ENVIRONMENT=sandbox # or 'production'
Service Container Configuration
The client is automatically registered in Laravel's service container. You can configure it in config/revolut-merchant-api.php:
return [ 'app_key' => env('REVOLUT_APP_KEY'), 'secret_key' => env('REVOLUT_SECRET_KEY'), 'environment' => env('REVOLUT_MERCHANT_ENVIRONMENT', 'sandbox'), 'timeout' => env('REVOLUT_MERCHANT_TIMEOUT', 30), 'retry_attempts' => env('REVOLUT_MERCHANT_RETRY_ATTEMPTS', 3), 'retry_delay' => env('REVOLUT_MERCHANT_RETRY_DELAY', 1000), 'base_url' => env('REVOLUT_MERCHANT_BASE_URL'), // Optional ];
Manual Client Initialization (if needed)
use Shahzad\RevolutMerchantApi\RevoltMerchantClient; $client = new RevoltMerchantClient([ 'secret_key' => config('revolut-merchant-api.secret_key'), 'environment' => config('revolut-merchant-api.environment'), 'timeout' => config('revolut-merchant-api.timeout', 30), 'retry' => [ 'enabled' => true, 'max_attempts' => config('revolut-merchant-api.retry.max_attempts', 3), 'retry_delay' => config('revolut-merchant-api.retry.retry_delay', 1000), ] ]);
Resources
The client provides dedicated resource classes for different API areas:
- Orders: Payment order management
- Payments: Payment processing and status tracking
- Refunds: Refund processing and management
- Customers: Customer data management
- Webhooks: Webhook configuration and management
- Disputes: Dispute handling and evidence submission
- Payouts: Payout tracking and management
- Report Runs: Report generation (settlement, payout statements, custom)
- Locations: Merchant location management
- Apple Pay: Apple Pay domain verification and configuration
- Synchronous Webhooks: Test webhooks for all event types
Documentation
For comprehensive documentation, examples, and API reference, see DOCUMENTATION.md.
Troubleshooting
Common Issues
401 Unauthorized: Make sure you're using your Secret Key (not API Key) from your Revolut Merchant Dashboard. The secret key should be set in your .env file as REVOLUT_SECRET_KEY.
404 Not Found: Some endpoints like merchant profile may return 404 if they're not available for your account type. This is expected behavior.
Field Name Changes: If you're upgrading from an older version, note that reference has been changed to merchant_order_id in order creation.
Testing
Run the test suite:
# Run all tests php vendor/bin/phpunit # Run static analysis composer analyse
For comprehensive testing documentation, see DOCUMENTATION.md.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
This package is open-sourced software licensed under the MIT license.
Support
- 📚 Documentation: DOCUMENTATION.md
- 🐛 Issues: GitHub Issues
- 📧 Email: support@revolut.com
- 🌐 API Docs: Revolut Developer Portal
Note: This package is not officially maintained by Revolut. It's a community-driven effort to provide a clean PHP interface to the Revolut Merchant API.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-16