shahzad / revolut-merchant-api
Laravel package for integrating with Revolut Merchant API
Requires
- php: ^8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- larastan/larastan: ^2.6
- mockery/mockery: ^1.5
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0|^11.0
This package is not auto-updated.
Last update: 2026-03-23 10:01:14 UTC
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.