Download the PHP package ownpay/ownpay-laravel without Composer
On this page you can find all versions of the php package ownpay/ownpay-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ownpay-laravel
OwnPay Laravel SDK
Official Laravel SDK for the OwnPay payment gateway platform. This package provides a clean, fluent interface for integrating OwnPay payments into your Laravel application.
Features
- ๐ Secure Authentication - Bearer token authentication with SHA-256 hashing
- ๐ณ Payment Management - Create, retrieve, and manage payment intents
- ๐ Transaction Tracking - Query and filter transactions with pagination
- ๐ฐ Refund Processing - Create and track refunds
- ๐ฅ Customer Management - Create and manage customer profiles
- ๐ Webhook Handling - HMAC-SHA256 signature verification
- ๐ก๏ธ Error Handling - Comprehensive exception hierarchy
- ๐ Type Safety - PHP 8.3+ enums, readonly classes, and value objects
- ๐งช Testing Ready - Mock-friendly HTTP client integration
- ๐ PSR Compliant - PSR-4, PSR-12, and PSR-18 standards
Requirements
- PHP 8.3+
- Laravel 11.x, 12.x, or 13.x
Installation
Install the package via Composer:
The package will automatically register its service provider and facade.
Publish Configuration
Publish the configuration file:
This will create config/ownpay.php in your application.
Publish Migrations (Optional)
If you want to log webhooks to a database table:
Configuration
Add the following environment variables to your .env file:
Configuration Options
| Option | Default | Description |
|---|---|---|
api_key |
null |
Your OwnPay API key (starts with op_) |
webhook_secret |
null |
Webhook signing secret for verification |
base_url |
https://pay.ownpay.org |
Your OwnPay instance URL |
timeout |
30 |
Request timeout in seconds |
retry_attempts |
3 |
Number of retry attempts for failed requests |
retry_delay |
100 |
Base delay in milliseconds between retries |
verify_ssl |
true |
Whether to verify SSL certificates |
log_channel |
null |
Log channel for SDK logging |
cache_ttl |
0 |
Cache TTL in seconds (0 to disable) |
Usage
Using the Facade
Using Dependency Injection
Payment Flow
Webhook Handling
Setup Webhook Route
The package automatically registers a webhook route at /webhooks/ownpay. You can customize this in your routes:
Listen for Webhook Events
Create an event listener in your EventServiceProvider:
Example Listener
Transaction Management
Customer Management
API Key Management
Error Handling
The package provides a comprehensive exception hierarchy:
Value Objects
The package uses type-safe value objects:
Money
Status Enums
Testing
Running Tests
Mocking HTTP Calls
Verifying Webhooks in Tests
Artisan Commands
Test Connection
Verify Webhook
Security
API Key Security
- API keys are stored securely using
#[\SensitiveParameter]attribute - Keys are never logged or exposed in error messages
- Use environment variables for sensitive configuration
Webhook Verification
All incoming webhooks are verified using HMAC-SHA256 signatures:
- Signature:
hash_hmac('sha256', $payload, $secret) - Timing-safe comparison using
hash_equals() - Timestamp validation to prevent replay attacks
Best Practices
- Never commit API keys to version control
- Use HTTPS for all API communication
- Verify webhook signatures before processing
- Implement idempotency for critical operations
- Handle rate limits gracefully with retry logic
- Log all payment events for audit trail
API Reference
Payments
| Method | Description |
|---|---|
createPayment(array $data) |
Create a new payment intent |
getPayment(string $id) |
Get payment by ID |
Transactions
| Method | Description |
|---|---|
listTransactions(array $params) |
List transactions with filters |
getTransaction(string $id) |
Get transaction by ID |
Refunds
| Method | Description |
|---|---|
createRefund(array $data) |
Create a refund |
listRefunds(array $params) |
List refunds with filters |
getRefund(string $id) |
Get refund by transaction ID |
Customers
| Method | Description |
|---|---|
createCustomer(array $data) |
Create a customer |
listCustomers(array $params) |
List customers |
getCustomer(string $id) |
Get customer by email or phone |
Webhooks
| Method | Description |
|---|---|
testWebhook() |
Test webhook endpoint |
listWebhookDeliveries() |
List webhook deliveries |
API Keys
| Method | Description |
|---|---|
listApiKeys() |
List API keys |
generateApiKey(array $params) |
Generate new API key |
revokeApiKey(int $id) |
Revoke API key |
Health
| Method | Description |
|---|---|
health() |
Check API health status |
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you discover a security vulnerability, please email [email protected]. All security vulnerabilities will be promptly addressed.
License
The MIT License (MIT). Please see License File for more information.
All versions of ownpay-laravel with dependencies
ext-bcmath Version *
ext-hash Version *
ext-json Version *
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/config Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
psr/log Version ^3.0